gpt4 book ai didi

android - 从选项卡布局调用Intent.ACTION_DIAL

转载 作者:行者123 更新时间:2023-12-03 00:21:03 25 4
gpt4 key购买 nike

我们如何从选项卡布局中调用Intent.ACTION_DIAL

我的代码是

 Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab


// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent(Intent.ACTION_DIAL);

// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost
.newTabSpec("contacts")
.setIndicator("Contacts",
res.getDrawable(R.drawable.tab_contacts))
.setContent(intent);

tabHost.addTab(spec);

但是该应用显示异常
07-14 14:08:21.024: ERROR/AndroidRuntime(543): java.lang.SecurityException: Requesting code from com.android.contacts (with uid 10000) to be run in process org.sipdroid.sipua (with uid 10032)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.app.ActivityThread.getPackageInfo(ActivityThread.java:2330)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2558)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.widget.TabHost.setCurrentTab(TabHost.java:323)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:129)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:453)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.view.View.performClick(View.java:2408)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.view.View$PerformClick.run(View.java:8816)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.os.Handler.handleCallback(Handler.java:587)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.os.Handler.dispatchMessage(Handler.java:92)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.os.Looper.loop(Looper.java:123)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at java.lang.reflect.Method.invokeNative(Native Method)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at java.lang.reflect.Method.invoke(Method.java:521)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-14 14:08:21.024: ERROR/AndroidRuntime(543): at dalvik.system.NativeStart.main(Native Method)
07-14 14:08:21.063: WARN/ActivityManager(58): Force finishing activity org.sipdroid.sipua/.ui.SIPTabWidget
07-14 14:08:21.683: WARN/ActivityManager(58): Activity pause timeout for HistoryRecord{43f7d678 org.sipdroid.sipua/.ui.SIPTabWidget}
07-14 14:08:27.443: DEBUG/dalvikvm(255): GC_EXPLICIT freed 93 objects / 4104 bytes in 135ms
07-14 14:08:32.106: WARN/ActivityManager(58): Activity destroy timeout for HistoryRecord{43f7d678 org.sipdroid.sipua/.ui.SIPTabWidget}

请帮忙

最佳答案

看来您有与此人相同的问题:http://www.mail-archive.com/android-beginners@googlegroups.com/msg14856.html

除非它具有相同的UserID,否则您不能自己使用其他应用程序中的代码。邮件列表中提到使用SharedUserID(http://developer.android.com/guide/topics/security/security.html#userid)欺骗它,但我怀疑这样做是否可行。

总而言之,除非您为应用程序授予根访问权限,否则我认为这是不可能的。

关于android - 从选项卡布局调用Intent.ACTION_DIAL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6691359/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com