我有一个带有标签的简单 Android 应用程序。我希望第二个选项卡在单击时打开一个 google play 商店 URL。
选项卡加载,但当我单击 tab2 时应用程序崩溃。
TabSpec spec = m_tabhost.newTabSpec("tab1")
.setIndicator("tab1")
.setContent(new Intent().setClass(this, GridActivity.class).putExtra("tabindex", 0));
m_tabhost.addTab(spec);
spec = m_tabhost.newTabSpec("tab2")
.setIndicator("tab2")
.setContent(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("market://search?q=pub:Google Inc.")));
m_tabhost.addTab(spec);
这是错误:
01-16 18:53:58.734: W/dalvikvm(10611): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
01-16 18:53:58.738: W/System.err(10611): java.lang.SecurityException: Requesting code from com.android.vending (with uid 10060) to be run in process soundboard.code.bhak (with uid 10130)
01-16 18:53:58.757: W/System.err(10611): at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1296)
01-16 18:53:58.757: W/System.err(10611): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1546)
01-16 18:53:58.757: W/System.err(10611): at android.app.ActivityThread.startActivityNow(ActivityThread.java:1491)
01-16 18:53:58.757: W/System.err(10611): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
01-16 18:53:58.757: W/System.err(10611): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
01-16 18:53:58.757: W/System.err(10611): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:657)
01-16 18:53:58.757: W/System.err(10611): at android.widget.TabHost.setCurrentTab(TabHost.java:329)
01-16 18:53:58.757: W/System.err(10611): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:133)
01-16 18:53:58.757: W/System.err(10611): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:456)
01-16 18:53:58.761: W/System.err(10611): at android.view.View.performClick(View.java:2538)
01-16 18:53:58.761: W/System.err(10611): at android.view.View$PerformClick.run(View.java:9152)
01-16 18:53:58.761: W/System.err(10611): at android.os.Handler.handleCallback(Handler.java:587)
01-16 18:53:58.761: W/System.err(10611): at android.os.Handler.dispatchMessage(Handler.java:92)
01-16 18:53:58.765: W/System.err(10611): at android.os.Looper.loop(Looper.java:130)
01-16 18:53:58.765: W/System.err(10611): at android.app.ActivityThread.main(ActivityThread.java:3687)
01-16 18:53:58.765: W/System.err(10611): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 18:53:58.765: W/System.err(10611): at java.lang.reflect.Method.invoke(Method.java:507)
01-16 18:53:58.769: W/System.err(10611): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
01-16 18:53:58.769: W/System.err(10611): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-16 18:53:58.769: W/System.err(10611): at dalvik.system.NativeStart.main(Native Method)
01-16 18:53:58.792: D/BugSenseHandler(10611): Transmitting stack trace: java.lang.SecurityException: Requesting code from com.android.vending (with uid 10060) to be run in process soundboard.code.bhak (with uid 10130)
有什么建议么?