android - can not create new activity in tabhost
I have a problem with开发者_如何学JAVA tabhost widget. I have some activities in tabs which are working fine. When I want to open a new activity from inside one of the tabs, runtime gives me the
Instrumentation.checkStartActivityResult(int, Object) line: 1504
ActivityNotFoundException
I put the activity in the manifest file and it's ok(I can run it if i put it in a tab). But when i try to fire the activity from another activity which is currently in one of the tabs, it get this exception. Any help is appreciated.
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".CoaActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainMenu"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".favorites"></activity>
<activity android:name=".FoodMenu"></activity>
<activity android:name=".Info"></activity>
<activity android:name=".Restaurants"></activity>
<activity android:name=".Home"></activity>
<activity android:name=".RestaurantInfo"></activity>
</application>
favorites, foodmenu, info, restaurants, home have their own tabs. But restaurant info doesnt have its own tab. And when i try to run restaurant info by an intent I have the exception.
I found a solution for my problem. You have to use a ActivityGroup object, that fires other Intent objects. There is a little bit tutorial here : http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity. Hope it helps..
精彩评论