按钮单击事件可在Internet上打开书签

时间:2016-02-14 12:04:26

标签: java android android-studio

我正在制作一个应用程序,要求用户通过按钮点击事件直接进入互联网上的书签屏幕。我搜索了一些例子,但似乎找不到一个。我正在寻求实现的目标。

我的onclick事件上的logcat

02-14 14:47:42.046 32686-32686/ideadline.ideadline E/AndroidRuntime: FATAL EXCEPTION: main
  java.lang.IllegalStateException: Could not execute method of the activity
      at android.view.View$1.onClick(View.java:3817)
      at android.view.View.performClick(View.java:4452)
      at android.view.View$PerformClick.run(View.java:18428)
      at android.os.Handler.handleCallback(Handler.java:725)
      at android.os.Handler.dispatchMessage(Handler.java:92)
      at android.os.Looper.loop(Looper.java:176)
      at android.app.ActivityThread.main(ActivityThread.java:5365)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
      at dalvik.system.NativeStart.main(Native Method)
   Caused by: java.lang.reflect.InvocationTargetException
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at android.view.View$1.onClick(View.java:3812)
      at android.view.View.performClick(View.java:4452) 
      at android.view.View$PerformClick.run(View.java:18428) 
      at android.os.Handler.handleCallback(Handler.java:725) 
      at android.os.Handler.dispatchMessage(Handler.java:92) 
      at android.os.Looper.loop(Looper.java:176) 
      at android.app.ActivityThread.main(ActivityThread.java:5365) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:511) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 
      at dalvik.system.NativeStart.main(Native Method) 
   Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=chrome://bookmarks/ }
      at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1661)
      at android.app.Instrumentation.execStartActivity(Instrumentation.java:1434)
      at android.app.Activity.startActivityForResult(Activity.java:3434)
      at android.app.Activity.startActivityForResult(Activity.java:3395)
      at android.app.Activity.startActivity(Activity.java:3630)
      at android.app.Activity.startActivity(Activity.java:3598)
      at ideadline.ideadline.StudyNotes.onClickbtnSavedArticles(StudyNotes.java:38)
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:511) 
      at android.view.View$1.onClick(View.java:3812) 
      at android.view.View.performClick(View.java:4452) 
      at android.view.View$PerformClick.run(View.java:18428) 
      at android.os.Handler.handleCallback(Handler.java:725) 
      at android.os.Handler.dispatchMessage(Handler.java:92) 
      at android.os.Looper.loop(Looper.java:176) 
      at android.app.ActivityThread.main(ActivityThread.java:5365) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:511) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 
      at dalvik.system.NativeStart.main(Native Method) 

1 个答案:

答案 0 :(得分:1)

我不确定其他浏览器,但在Google Chrome浏览器中,您可以使用直接在浏览器中打开书签目录的网址:chrome:// bookmarks /

Chrome Bookmarks

对于其他浏览器,您只需查找备选方案并使用JavaScript来区分用户使用的浏览器。

希望这有点帮助:)