Set default camera image to base64. Add comments.

This commit is contained in:
Bryce Curtis 2010-09-03 16:00:21 -05:00
parent d39781f3fb
commit 5d83a44ec3
3 changed files with 16 additions and 2 deletions

View File

@ -25,7 +25,7 @@ public class CameraLauncher extends ActivityResultModule {
private int mQuality; // Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality)
private Uri imageUri; // Uri of captured image
private boolean base64 = false;
private boolean base64 = true;
/**
* Constructor.
@ -36,6 +36,20 @@ public class CameraLauncher extends ActivityResultModule {
public CameraLauncher(WebView view, DroidGap gap) {
super(view, gap);
}
/**
* Set the type of data to return. The data can either be returned
* as a base64 string or a URI that points to the file.
* To display base64 string in an img tag, set the source to:
* img.src="data:image/jpeg;base64,"+result;
* or to display URI in an img tag
* img.src=result;
*
* @param b T=return base64 string (default), F=return URI
*/
public void setBase64(boolean b) {
this.base64 = b;
}
/**
* Take a picture with the camera.

View File

@ -71,6 +71,7 @@ import android.widget.LinearLayout;
* @Override
* public void onCreate(Bundle savedInstanceState) {
* super.onCreate(savedInstanceState);
* super.addModule("com.phonegap.examples.MyModule", "MyModule");
* super.loadUrl("file:///android_asset/www/index.html");
* }
* }

View File

@ -48,7 +48,6 @@ public abstract class Module {
* @param message
*/
public void sendJavascript(String statement) {
System.out.println("Module.sendResponse("+statement+")");
this.gap.callbackServer.sendJavascript(statement);
}