में नई गतिविधियां बनाता है I Android पर एक टैबड एप्लिकेशन विकसित करना चाहता हूं। साथ ही, मैं कुछ टैब पर खोज कार्यक्षमता मौजूद होना चाहता हूं। इस कारण से, मैंने मैनिफेस्ट फ़ाइल में कुछ गतिविधियां घोषित कीं और उन्हें टैबहोस्ट में जोड़ा। लेकिन समस्या यह है कि जब मैं कोई खोज करता हूं, तो यह वर्तमान गतिविधि की क्रिएट() विधि को कॉल करता है जो टैब सामग्री में रहता है। मैं चाहता हूं कि खोज प्रबंधक को न्यूइन्टेंट() विधि पर कॉल करें ताकि एक नई गतिविधि नहीं बनाई जा सके और मैं मौजूदा गतिविधि में खोज को संभाल सकूं। मैं अपने प्रकट और TabActivity स्रोत फ़ाइल पोस्टिंग कर रहा हूँ और अधिक स्पष्ट होने के लिए:खोज TabActivity
मैनिफ़ेस्ट फ़ाइल का हिस्सा:
<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>
टैब गतिविधि onCreate विधि:
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);
}
मुझे लगता है कि ये दो बग संबंधित हैं: http://code.google.com/p/android/issues/detail?id=17137 http://code.google.com/p/android/issues/detail? आईडी = 4155 – Agos
क्या आपने इसे हल किया? –