mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
35 lines
623 B
Java
35 lines
623 B
Java
package com.phonegap.demo;
|
|
|
|
import android.webkit.WebView;
|
|
|
|
|
|
public class CameraLauncher {
|
|
|
|
private WebView mAppView;
|
|
private DroidGap mGap;
|
|
int quality;
|
|
|
|
CameraLauncher(WebView view, DroidGap gap)
|
|
{
|
|
mAppView = view;
|
|
mGap = gap;
|
|
}
|
|
|
|
public void takePicture(int quality)
|
|
{
|
|
mGap.startCamera(quality);
|
|
}
|
|
|
|
/* Return Base64 Encoded String to Javascript */
|
|
public void processPicture( String js_out )
|
|
{
|
|
mAppView.loadUrl("javascript:navigator.camera.win('" + js_out + "');");
|
|
}
|
|
|
|
public void failPicture(String err)
|
|
{
|
|
mAppView.loadUrl("javascript:navigator.camera.fail('" + err + "');");
|
|
}
|
|
|
|
}
|