Hi, I want to develop a tabbed application on Android. At the same time, I want the search functionality to be present on some tabs. For this reason, I declared some activites in manifest file and added them to TabHost. But the problem is that when I make a search, it calls onCreate() method of the current activity which resided in tab content. What I want is to make searchManager call onNewIntent() method so that a new activity is not created and I can handle the search in existing activity. I'm posting my manifest and TabActivity source file to be more clear:
Part of manifest file:
<activity
android:name="KarniyarikTabsWidget"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="UrunTab"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity android:name="ArabaTab" android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity android:name="GecmisTab" android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTop">
</activity>
<activity android:name="HakkindaTab" android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTop">
</activity>
Tab Activity onCreate method:
public class KarniyarikTabsWidget extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("UrunTab")
.setIndicator("Ürün",res.getDrawable(R.drawable.product))
.setContent(new Intent(this, UrunTab.class));
tabHost.addTab(spec);
//Do the same for other tabs
spec = tabHost.newTabSpec("ArabaTab")
.setIndicator("Araba",res.getDrawable(R.drawable.car))
.setContent(new Intent(this, ArabaTab.class));
tabHost.addTab(spec);
//Do the same for other tabs
spec = tabHost.newTabSpec("GecmisTab")
.setIndicator("Geçmiş",res.getDrawable(R.drawable.history))
.setContent(new Intent(this, GecmisTab.class));
tabHost.addTab(spec);
//Do the same for other tabs
spec = tabHost.newTabSpec("HakkindaTab")
.setIndicator("Hakkında",res.getDrawable(R.drawable.about))
.setContent(new Intent(this, HakkindaTab.class));
tabHost.addTab(spec);
}
Any help would be appreciated.