Skip to content Skip to sidebar Skip to footer

Tabgroupactivity - Startchildactivity - Not Working

I have been using TabActivity and I want the tab to display on every child activity. I have flow like this MainActivity(TabActivity) -> TabGroupActivity1(TabGroupActivity) ->

Solution 1:

Okay, I found other alternative.

Instead of... checking flag in the child activity and redirecting on different page.

I am checking the flag in the parnt activity Like this

if (getLNApplication().isLogin()) {
    startChildActivity("Report", newIntent(this, ReportActivity.class));
}else{
    startChildActivity("LogIn", newIntent(this, LoginActivity.class));
}

and from LoginActivity on Successful login i am Starting ReportActivity like bellow

parentActivity.startChildActivity("EditActivity", newIntent(getParent(), ReportActivity.class));

and I also handle the back press as of I don't want user to go back on login page again. I handle the back key in TabGroupActivity

like this

@OverridepublicvoidonBackPressed() {
    intlength= mIdList.size();
    if (length > 1) {
        Activitycurrent= getLocalActivityManager().getActivity(
                mIdList.get(length - 1));
        // Added code to disable back press only for the ReportActivityif(current instanceof ReportActivity){
            Log.i("TabGroup", "I am instance of ReportActivity" );
            return;
        }
        current.finish();
    }
}

Post a Comment for "Tabgroupactivity - Startchildactivity - Not Working"