Greetings,

I have an Android application which displays 2 Android Activity icons:
"Comp 1" and "Comp 2".
Both "Comp 1" and "Comp 2" shows TabActivities with tabs within.
Problem:
Right after deploying my application, I can enter into any of "Comp 1"
or "Comp 2" TabActivity, but when I leave the activity and when I try
to enter the other TabActivity, the tabs shown are the same from the
previous one "Comp 1" or "Comp 2" it always depends on which I start
first.
Objective:
For any of the "Comp N", open correctly the tabs assigned on the
TabActivities(see code on this post).

Please, allow me to show my code.
I will show AndroidManifest.xml, TabActivity for "Comp 1" and
TabActivity for "Comp 2". They're a bit extensive, so I apologize in
advance for any extra and unnecessary info they may contain. I just
didn't want to take risk to forget to provide any important
information on the first post.

AndroidManifest.xml ("Comp 1"=MMComponentTabAssembler, "Comp
2"=TabAssembler)
[syntax="xml"]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      android:versionCode="1"
      android:versionName="1.0"
      android:installLocation="internalOnly"
      package="be.multitel.android.mmnd">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <uses-library android:name="com.google.android.maps" />

        <activity android:name=".activity.TabAssembler"
                  android:label="@string/app_name"
                  android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category
android:name="android.intent.category.LAUNCHER" />

            </intent-filter>
        </activity>

                    <activity android:name=".activity.NetworkDispatcher1"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.TAB" /
>
            </intent-filter>
        </activity>

        <activity android:name=".activity.Device"
                  android:label="@string/app_test_device_name">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.TAB" /
>
            </intent-filter>
        </activity>

        <activity android:name=".activity.SMS"
                  android:label="@string/sms_app_name">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.TAB" /
>
            </intent-filter>
        </activity>

        <activity android:name=".activity.NetworkDispatcherActivity"
                  android:label="@string/
test_network_dispatcher_app_name">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.TAB" /
>
            </intent-filter>
        </activity>

        <!-- Begin :: Code for standard MMComponentTabAssembler tab
view.
                Use this code to include new components activities that
extend from MMSuperComponent.
        -->
        <activity android:name=".activity.MMComponentTabAssembler"
                  android:label="Comp 1"
                  android:theme="@android:style/
Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
        <activity android:name=".activity.GPS"
                  android:label="GPS">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.TAB" /
>
            </intent-filter>
        </activity>
        <activity android:name=".activity.GPSPreferences"
                  android:label="GPSPrefs">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.TAB" /
>
            </intent-filter>
        </activity>
        <activity android:name=".activity.StandardSetupActivity"
                  android:label="Setup">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.TAB" /
>
            </intent-filter>
        </activity>
        <!-- End :: Code for standard MMComponentTabAssembler tab
view. -->

        <service android:exported="true"
android:name=".service.NetworkDispatcherService"
android:process=":remote">
                <intent-filter>
                        <action android:name="NetworkDispatcherService">
                        </action>
                </intent-filter>
        </service>
        <service android:exported="true"
android:name=".service.NetHubService" android:process=":remote"/>


        <receiver android:name=".service.utils.NetworkListener">
            <intent-filter>
                <action android:name=
                    "android.net.conn.CONNECTIVITY_CHANGE" />
                <action android:name=
                    "android.provider.Telephony.SMS_RECEIVED" />
                <action android:name=
 
"be.multitel.android.mmnd.service.utils.SocketListener.ACK_RECEIVED" /
>
            </intent-filter>
        </receiver>

        <receiver
android:name=".service.utils.MMNetworkDispatcherReceiver" >
            <intent-filter>
                <action android:name=
                    "android.net.conn.CONNECTIVITY_CHANGE" />
                <action android:name=
                    "CONNECTIVITY_CHANGE" />
                <action android:name=
                    "android.provider.Telephony.SMS_RECEIVED" />
                <action android:name=
 
"be.multitel.android.mmnd.service.utils.SocketListener.ACK_RECEIVED" /
>
            </intent-filter>
        </receiver>

        <receiver android:name=".service.utils.MMReceiver" >
            <intent-filter>
            <action android:name="ACTION_MM_CONNECT" />
            <action android:name="ACTION_MM_DISCONNECT" />
            <action
android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESREQ" />
            <action
android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESRELEASE" />
            <action
android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESINFOREQ" />
            <action
android:name="ACTION_EVENT_CMD_DISPATCHER_BWINFOREQ" />
            <action
android:name="ACTION_EVENT_CMD_DISPATCHER_LATENCYINFOREQ" />
            <category android:name="COMPONENT_CATEGORY_GPS"/>
            </intent-filter>
        </receiver>

    </application>

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission
android:name="android.permission.ACCESS_WIFI_STATE" />
        <uses-permission android:name="android.permission.SEND_SMS" />
        <uses-permission android:name="android.permission.RECEIVE_SMS"/>
        <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>

</manifest>
[/syntax]


"Comp 1" TabActivity = MMComponentTabAssembler
[syntax="java"]
public class MMComponentTabAssembler extends TabActivity {

        public static final String TAG =
MMComponentTabAssembler.class.getName();

        @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.standard_tabbed_pane);
        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

        //Multimodal component tab
        intent = new Intent().setClass(this, GPS.class);
        intent.addCategory(Const.COMPONENT_CATEGORY_GPS); //Used to
produce Intents to the MMComponent
        intent.addCategory(Const.ACTIVITY_CATEGORY_GPS); //Used to
consume Intents on the BroadcastReceiver associated to the Activity

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

        //preferences tab
        intent = new Intent().setClass(this, GPSPreferences.class);

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

        //standard setup tab
        intent = new Intent().setClass(this,
StandardSetupActivity.class);
        intent.addCategory(Const.COMPONENT_CATEGORY_GPS); //Used to
produce Intents to the MMComponent
        intent.addCategory(Const.ACTIVITY_CATEGORY_GPS); //Used to
consume Intents on the BroadcastReceiver associated to the Activity
        spec =
tabHost.newTabSpec("standard_setup_tab").setIndicator("Setup",
 
res.getDrawable(R.drawable.ic_tab_standard_setup))
                      .setContent(intent);
        tabHost.addTab(spec);
        tabHost.setCurrentTab(0);
    }

        @Override
        protected void onResume() {
                super.onResume();
                Log.d(TAG,"Activity group lifecicle :: onResume().");
        }

        @Override
        protected void onPause() {
                super.onPause();
                Log.d(TAG,"Activity group lifecicle :: onPause().");
        }

        @Override
        protected void onStop() {
                super.onStop();
                Log.d(TAG,"Activity group lifecicle :: onStop().");
        }

        @Override
        protected void onDestroy() {
                super.onDestroy();
                Log.d(TAG,"Activity group lifecicle :: onDestroy().");
        }
}
[/syntax]

"Comp 2" TabActivity = TabAssembler
[syntax="java"]
public class TabAssembler extends TabActivity  {
        @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_tab);
        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

        intent = new Intent().setClass(this,
NetworkDispatcher1.class);
        // Initialize a TabSpec for each tab and add it to the TabHost
        spec =
tabHost.newTabSpec("netword_dispatcher").setIndicator("NDispatcher",
                          res.getDrawable(R.drawable.ic_tab_mmnd))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, Device.class);
        spec = tabHost.newTabSpec("test_device").setIndicator("Test
Device",
 
res.getDrawable(R.drawable.ic_tab_test_device))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, SMS.class);
        spec = tabHost.newTabSpec("test_sms").setIndicator("SMS",
                        res.getDrawable(R.drawable.ic_tab_sms))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this,
NetworkDispatcherActivity.class);
        spec =
tabHost.newTabSpec("test_network_dispatcher").setIndicator("Test ND",
 
res.getDrawable(R.drawable.ic_tab_test_network_dispatcher))
                      .setContent(intent);
        tabHost.addTab(spec);
        tabHost.setCurrentTab(3);

    }
}
[/syntax]

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to