How can I launch the camera of the device from a button in a Webview?
I have this code in Android:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webview = (WebView)findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("file:///android_asset/camtest.html");
}
And the Html file is very simple:
<html>
<body>
<form enctype="multipart/form-data" method="post">
<h2>capture=camera</h2>
<input type="file" accept="image/*;capture=camera"></input>
</form>
</body>
</html>
When I launch the app, and click in the button,
The log shows this:
02-10 12:00:03.775: V/WebViewInputDispatcher(10110): blockWebkitDraw
02-10 12:00:03.775: V/WebViewInputDispatcher(10110): blockWebkitDraw lockedfalse
02-10 12:00:04.085: D/webview(10110): blockWebkitViewMessage= false
And the camera doesn't launch.
What do I miss ?
you can use Phonegap
extend Activity to
DroidGap
then create folder
www
insideassets folder
and inside folderwww
create folderjs
and pu inside it phonegap.jsthen create file
index.html
:and after this you must add library
cordova.jar
then run your application