我正在尝试使用android webview实现类似facebook的功能.没有"确认"对话框,它工作正常.但是当它需要确认时它不起作用.这是我正在使用的代码片段.
private void setUpWebView() {
likeWebView.setVerticalScrollBarEnabled(false);
likeWebView.setHorizontalScrollBarEnabled(false);
likeWebView.setWebViewClient(new FacebookWebViewClient());
likeWebView.setWebChromeClient(new MyChromeClient());
likeWebView.getSettings().setJavaScriptEnabled(true);
String url = getFacebookLikeUrl();
likeWebView.loadUrl(url);
}
Run Code Online (Sandbox Code Playgroud)
我也在设置ViewClient和WebChromeClient.
private String getFacebookLikeUrl() {
return "http://www.facebook.com/plugins/like.php?" + "href="
+ URLEncoder.encode(mUrl) + "&access_token="
+ URLEncoder.encode(facebook.getAccessToken());
}
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.提前致谢.
我想将图像设置为联系人图标.该图像存储在缓存中.这是我的代码 -
Intent myIntent = new Intent();
myIntent.setAction(Intent.ACTION_ATTACH_DATA);
myIntent.setType("image/jpeg");
myIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(getApplicationContext().getCacheDir()
.getAbsolutePath()
+ "/" + fileName));
startActivityForResult(Intent.createChooser(myIntent, "Set As"),
200);
Run Code Online (Sandbox Code Playgroud)
这段代码给了我选项 - 联系人图标,壁纸.当我选择联系人图标时,联系人列表正在打开.当我从联系人列表中选择任何联系人时,该应用程序正在崩溃.
日志是 -
E/AndroidRuntime(15004): FATAL EXCEPTION: main
E/AndroidRuntime(15004): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.android.contacts/contacts/lookup/0r2-5C48544A48463C46323C2C/2 (has extras) }} to activity {com.android.contacts/com.android.contacts.AttachImage}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.camera.action.CROP (has extras) }
E/AndroidRuntime(15004): at android.app.ActivityThread.deliverResults(ActivityThread.java:3515)
E/AndroidRuntime(15004): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
E/AndroidRuntime(15004): at android.app.ActivityThread.access$2800(ActivityThread.java:125)
E/AndroidRuntime(15004): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
E/AndroidRuntime(15004): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(15004): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(15004): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime(15004): …Run Code Online (Sandbox Code Playgroud)