How to show Tabs in the in th SubActivity? - android

I make an application in which i had made 5 Tabs on the First Tab there is a ListView When i Click on any ListItem i had call another activity with intent .Now there us a problem As & when i click on Listitem The Tabs will Dissapears How can i show Tabs on my SubActivity .
Any help willl be Appretiated.

That is the normal behavior in Android, not very nice.
I usually create the first Activity in a Tab extending from this class
public class TabActivityGroup extends ActivityGroup {
protected LocalActivityManager manager;
protected ArrayList<String> mIdList;
public TabActivityGroup() {
this(false);
}
public TabActivityGroup(boolean single) {
super(single);
}
public void onCreate(Bundle ins) {
super.onCreate(ins);
manager = getLocalActivityManager();
mIdList = new ArrayList<String>();
}
public void startChildActivity(String Id, Intent intent) {
Log.d(this.getClass().getName(), "startChildActivity " + Id + " / " + mIdList.size());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Window window = manager.startActivity(Id, intent);
if (window != null) {
mIdList.add(Id);
setContentView(window.getDecorView());
}
}
#Override
public void finishFromChild(Activity child) {
Log.d(this.getClass().getName(), "finishFromChild("+child.getClass().getName()+") mIdList.size " + mIdList.size());
int index = mIdList.size() - 1;
if (index < 1) {
finish();
}else{
Log.e(getClass().getName(), "destroy " + mIdList.get(index));
manager.destroyActivity(mIdList.get(index), true);
mIdList.remove(index);
index--;
String lastId = mIdList.get(index);
Activity previous = manager.getActivity(lastId);
setContentView(previous.getWindow().getDecorView());
}
}
/**
* Overrides the default implementation for KeyEvent.KEYCODE_BACK so that
* all systems call onBackPressed().
*/
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
goBack();
return true;
}
return super.onKeyUp(keyCode, event);
}
public void goBack() {
Log.d(this.getClass().getName(), "goBACK() : " + mIdList.size());
int length = mIdList.size();
if (length > 1) {
Activity current = manager.getActivity(mIdList.get(length - 1));
current.finish();
}else{
((MyApplication)getApplication()).systemExit(this);
//This just calls to System.exit
}
}
}
You can then create a Tab like this
public class TabOne extends TabActivityGroup {
#Override
public void onCreate(Bundle b) {
super.onCreate(b);
startChildActivity(OneActivity.class.getName(), new Intent(this, OneActivity.class));
}
Things to keep in mind:
The tab has nothing inside, just starts the real tab activity with
the startChildActivity method. This is to get a nice behavior when
going back and reach the first activity and the app needs to close.
Be very careful with the Context on the subactivities as you have
to use the TabActivityGroup context. You can do this manually by
calling getParent(), or better defining a method that loops calling
getParent() until you find the root parent.

Related

Handling tab press inside a activity group to do back press functionality

I am Implementing tabhost with 5 tabs.On 5th tab i have an activitygroup with 2 child activity.From child activity if i press back button the app returns to the parent activity.
But what i need is on pressing tab button too it has to return to the parent activity.
this is my activity group:
public class Activitygroup extends ActivityGroup {
private Stack<String> stack;
public static Activitygroup grp;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
grp = new Activitygroup();
if (stack == null) {
stack = new Stack<String>();
}
push("HomeStackActivity", new Intent(this,Extras.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
}
#Override
public void finishFromChild(Activity child) {
pop();
}
#Override
public void onBackPressed() {
pop();
}
public void push(String id, Intent intent) {
Window window = getLocalActivityManager().startActivity(id,
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
if (window != null) {
stack.push(id);
setContentView(window.getDecorView());
}
}
public void pop() {
if (stack.size() == 1) {
finish();
}
LocalActivityManager manager = getLocalActivityManager();
manager.destroyActivity(stack.pop(), true);
if (stack.size() > 0) {
Intent lastIntent = manager.getActivity(stack.peek()).getIntent()
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Window newWindow = manager.startActivity(stack.peek(), lastIntent);
setContentView(newWindow.getDecorView());
}
}
this is where i am handling second tab press in tabhost activity:
int numberOfTabs = tabHost.getTabWidget().getChildCount();
for (int t = 0; t < numberOfTabs; t++) {
tabHost.getTabWidget().getChildAt(t).setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
String currentSelectedTag = MainActivity.this.getTabHost().getCurrentTabTag();
String currentTag = (String) v.getTag();
if (currentSelectedTag.equalsIgnoreCase(currentTag)) {
MainActivity.this.getTabHost().setCurrentTabByTag(currentTag);
String newSelectedTabTag = MainActivity.this.getTabHost().getCurrentTabTag();
if (newSelectedTabTag.toLowerCase().indexOf("extras") != -1) {
"BACKPRESS FUNCTIONALITY"-MUST BRING THE PARENT ACTIVITY ON TOP HERE
}
return true;
}
}
return false;
}
});
}
Iphone has this functionality by default.On pressing tab on current activity it bring the parent activity on top.Please suggest me some workaround for this.thanks in advance!!!
This code is used to sense the tab press from the child activity
int numberOfTabs = tabHost.getTabWidget().getChildCount();
for (int t = 0; t < numberOfTabs; t++) {
tabHost.getTabWidget().getChildAt(t).setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
String currentSelectedTag = MainActivity.this.getTabHost().getCurrentTabTag();
String currentTag = (String) v.getTag();
if (currentSelectedTag.equalsIgnoreCase(currentTag)) {
MainActivity.this.getTabHost().setCurrentTabByTag(currentTag);
String newSelectedTabTag = MainActivity.this.getTabHost().getCurrentTabTag();
if (newSelectedTabTag.toLowerCase().indexOf("extras") != -1) {
****Here call a static method to check whether the child activity is active****
childactivity.getappcontext();
}
return true;
}
}
return false;
}
});
}
In child activity paste this code.If the child activity is active then it'll be closed when pressing the tab hence the parent activity will be visible.
#Override
public void onStart() {
super.onStart();
active=true;
}
#Override
public void onStop() {
super.onStop();
active=false;
}
public static void getAppContext() {
if(active){
System.out.println("gallery");
galleryActivity1.finish();
}
}
Feel free to ask if not clear.Would love to help.

OnResume() is not called in TabHost in Android?

I am working with Tabs in my application. Worked on the TabHost Class to make it customize.
When I have PARENT --> CHILD activity, in this case on back press, onResume of Parent Activity is not called in my application.
I am using the below code:
public class TabGroupActivity extends ActivityGroup {
private ArrayList<String> mIdList;
private HashMap<String, Window> mWindowStorage = new HashMap<String, Window>();//UPDATED
private boolean _isFromResume;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (mIdList == null) mIdList = new ArrayList<String>();
}
/**
* This is called when a child activity of this one calls its finish method.
* This implementation calls {#link LocalActivityManager#destroyActivity} on the child activity
* and starts the previous activity.
* If the last child activity just called finish(),this activity (the parent),
* calls finish to finish the entire group.
*/
#Override
public void finishFromChild(Activity child) {
LocalActivityManager manager = getLocalActivityManager();
int index = mIdList.size()-1;
if (index < 1) {
finish();
return;
}
String actName = mIdList.get(index);
manager.destroyActivity(actName, true);
mWindowStorage.remove(actName);
mIdList.remove(index); index--;
String lastId = mIdList.get(index);
Window newWindow = null;
if(mWindowStorage.containsKey(lastId)){
newWindow = mWindowStorage.get(lastId);
}else{
Intent lastIntent = manager.getActivity(lastId).getIntent();
newWindow = manager.startActivity(lastId, lastIntent);
}
setContentView(newWindow.getDecorView());
}
/**
* Starts an Activity as a child Activity to this.
* #param Id Unique identifier of the activity to be started.
* #param intent The Intent describing the activity to be started.
* #throws android.content.ActivityNotFoundException.
*/
public void startChildActivity(String Id, Intent intent) {
Window window = null;
if(mWindowStorage.containsKey(Id)){
window = mWindowStorage.get(Id);
if(_isFromResume){
setFromResume(false);
mIdList.clear();
mIdList.add(Id);
mWindowStorage.clear();
mWindowStorage.put(Id, window);
}
}else{
window = getLocalActivityManager().startActivity(Id,intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
if (window != null) {
mIdList.add(Id);
mWindowStorage.put(Id, window);
}
}
setContentView(window.getDecorView());
}
/**
* The primary purpose is to prevent systems before android.os.Build.VERSION_CODES.ECLAIR
* from calling their default KeyEvent.KEYCODE_BACK during onKeyDown.
*/
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
//preventing default implementation previous to android.os.Build.VERSION_CODES.ECLAIR
return true;
}
return super.onKeyDown(keyCode, event);
}
/**
* Overrides the default implementation for KeyEvent.KEYCODE_BACK
* so that all systems call onBackPressed().
*/
#Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
onBackPressed();
return true;
}
return super.onKeyUp(keyCode, event);
}
/**
* If a Child Activity handles KeyEvent.KEYCODE_BACK.
* Simply override and add this method.
*/
#Override
public void onBackPressed () {
int length = mIdList.size();
if ( length > 0) {
Activity current = getLocalActivityManager().getActivity(mIdList.get(length-1));
current.finish();
}
}
public void setFromResume(boolean isFromResume) {
_isFromResume = isFromResume;
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Activity activity = getLocalActivityManager().getCurrentActivity();
RegisterDeRegisterResponse register = RegisterDeRegisterResponse
.getInstance();
register.notifyRegisteredUser(requestCode, resultCode, data);
register.deRegisterForServerResponse((IResultResponse) activity);
}
public void switchTab(int i) {
WeddingTabActivity parentActivity = (WeddingTabActivity) getParent();
parentActivity.switchTab(i);
}
}
Also worked with default startChildActivity(String Id, Intent intent) and finishFromChild(Activity child) methods but in that case every Activity is relaunched on BackPress.
#Override
public void finishFromChild(Activity child) {
LocalActivityManager manager = getLocalActivityManager();
int index = mIdList.size()-1;
if (index < 1) {
finish();
return;
}
manager.destroyActivity(mIdList.get(index), true);
mIdList.remove(index); index--;
String lastId = mIdList.get(index);
Intent lastIntent = manager.getActivity(lastId).getIntent();
Window newWindow = manager.startActivity(lastId, lastIntent);
setContentView(newWindow.getDecorView());
}
public void startChildActivity(String Id, Intent intent) {
Window window = getLocalActivityManager().startActivity(Id,intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
if (window != null) {
mIdList.add(Id);
setContentView(window.getDecorView());
}
}
In tab host I have done a whole project and then same problem I have the onresume does not get called.. and the activity group is now deprecated and you will be not able to call onresume check this may be it will help.. best of luck

Tabbar issues in Android?

Currently i am working in Android application, Using Tabbar to create five tabs like 1,2,3,4 and 5. 1st tab using ListActivity to create ListView, when i select the ListItem from ListView, the ListItem value goes to 3rd tab and also i am getting the value in 3rd tab fine, but the problem is the value pass from 1st tab to 3rd tab, at the time 1st tab only selected, but i want 3rd tab select.
How to fix this?, please help me.
Thanks in Advance
Source code for your reference:
1st Tab :
#Override
protected void onListItemClick(ListView l, final View v, int position, long id)
{
super.onListItemClick(l, v, position, id);
String SelectedItem = l.getItemAtPosition(position).toString();
System.out.println("Selected Item: "+ SelectedItem);
System.out.println("position Item: "+ position);
String SelectedPhoneNumber = phoneNumber.get(position);
System.out.println("SelectedPhoneNumber " + SelectedPhoneNumber);
// Using TabGroupActivity, so
Intent i = new Intent(getParent(), 3rdTab.class);
i.putExtra("DestinationNumber", SelectedPhoneNumber);
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
parentActivity.startChildActivity("Sample", i);
}
TabGroupActivity.java
public class TabGroupActivity extends ActivityGroup
{
private ArrayList<String> mIdList;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if (mIdList == null) mIdList = new ArrayList<String>();
}
#Override
public void finishFromChild(Activity child)
{
LocalActivityManager manager = getLocalActivityManager();
int index = mIdList.size()-1;
if (index < 1)
{
finish();
return;
}
manager.destroyActivity(mIdList.get(index), true);
mIdList.remove(index); index--;
String lastId = mIdList.get(index);
Intent lastIntent = manager.getActivity(lastId).getIntent();
Window newWindow = manager.startActivity(lastId, lastIntent);
setContentView(newWindow.getDecorView());
}
public void startChildActivity(String Id, Intent intent) {
Window window = getLocalActivityManager().startActivity(Id,intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
if (window != null) {
mIdList.add(Id);
setContentView(window.getDecorView());
}
}
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
//preventing default implementation previous to android.os.Build.VERSION_CODES.ECLAIR
return true;
}
return super.onKeyDown(keyCode, event);
}
/**
* Overrides the default implementation for KeyEvent.KEYCODE_BACK
* so that all systems call onBackPressed().
*/
#Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
onBackPressed();
return true;
}
return super.onKeyUp(keyCode, event);
}
#Override
public void onBackPressed ()
{
int length = mIdList.size();
if ( length > 1)
{
Activity current = getLocalActivityManager().getActivity(mIdList.get(length-1));
current.finish();
}
}
}
Have you looked through the sample application at the bottom of this post?
More specifically:
Does your main activity follow the format of TabSample.java and add the tabs to a TabHost?
Do your tabbed Activities extend TabGroupActivity? You can see in the sample that the author creates a new class that extends TabGroupActivity for each tab (eg TabGroup1Activity, TabGroup2Activity), then each of those Activities launches another activity (such as OptionsActivity or EditActivity).
If all else fails, you should also be able to manually change the selected tab using tabHost.setCurrentTab(int tabIndex).

backpress is not being called inside activity group android

In my android application i am using activity group inside tabs,am maintaining the list of previous screens as well.The issue is,if we press back immediately after the screen gets loaded ,the Backpress method is not called and the app gets exited,whereas if i do the same after a delay say 30 secs in the screen it works as expected.Could not resolve the issue at all.Have debugged the code and have noticed that the new screen is added to the stacklist but the backpress method itself is not called.Tried implementing backpress in the activity and also in tabgroup class but no use.Please let me know where i am going wrong.The code that i use to add a activity is
Intent intent = new Intent(context, TrialActivity.class);
intent.putExtra("feedId", moreitems.get(arg2).getItem_id());
intent.putExtra("heading", moreitems.get(arg2).getItem_name());
TabGroupActivity parentActivity = (TabGroupActivity) ((Activity) context)
.getParent();
parentActivity.startChildActivity(moreitems.get(arg2).getItem_name()
+ Calendar.getInstance().getTimeInMillis(), intent);
MyTabgroup class is
#SuppressWarnings("deprecation")
public class TabGroupActivity extends ActivityGroup {
private ArrayList<String> mIdList;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (mIdList == null)
mIdList = new ArrayList<String>();
}
#Override
protected void onPause()
{
super.onPause();
}
#Override
protected void onResume() {
// to start the first activity every time on reload( on focus of tab).
// remove the search activity if it is in the stack
if (mIdList != null && mIdList.size() > 0) {
int index = -1;
for (int i = 0; i < mIdList.size(); i++) {
String firstId = mIdList.get(i);
if (firstId != null
&& "search".equalsIgnoreCase(firstId.substring(0,
firstId.length() - 1))) {
index = i;
}
}
if (index != -1) {
LocalActivityManager manager = getLocalActivityManager();
manager.destroyActivity(mIdList.get(index), true);
mIdList.remove(index);
index--;
String lastId = mIdList.get(index);
Intent lastIntent = manager.getActivity(lastId).getIntent();
Window newWindow = manager.startActivity(lastId, lastIntent);
setContentView(newWindow.getDecorView());
}
}
super.onResume();
}
/**
* This is called when a child activity of this one calls its finish method.
* This implementation calls {#link LocalActivityManager#destroyActivity} on
* the child activity and starts the previous activity. If the last child
* activity just called finish(),this activity (the parent), calls finish to
* finish the entire group.
*/
#Override
public void finishFromChild(Activity child) {
LocalActivityManager manager = getLocalActivityManager();
int index = mIdList.size() - 1;
if (index < 1) {
Alerts.exit("Confirm",
"Do you really wish to exit from iDream Media?", this);
return;
}
manager.destroyActivity(mIdList.get(index), true);
mIdList.remove(index);
index--;
String lastId = mIdList.get(index);
Intent lastIntent = manager.getActivity(lastId).getIntent();
Window newWindow = manager.startActivity(lastId, lastIntent);
setContentView(newWindow.getDecorView());
}
/**
* Starts an Activity as a child Activity to this.
*
* #param Id
* Unique identifier of the activity to be started.
* #param intent
* The Intent describing the activity to be started.
* #throws android.content.ActivityNotFoundException.
*/
public void startChildActivity(String Id, Intent intent) {
Window window = getLocalActivityManager().startActivity(Id,
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP));
if (window != null) {
mIdList.add(Id);
setContentView(window.getDecorView());
}
}
/**
* The primary purpose is to prevent systems before
* android.os.Build.VERSION_CODES.ECLAIR from calling their default
* KeyEvent.KEYCODE_BACK during onKeyDown.
*/
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// onBackPressed();
// preventing default implementation previous to
// android.os.Build.VERSION_CODES.ECLAIR
return true;
}
return super.onKeyDown(keyCode, event);
}
/**
* Overrides the default implementation for KeyEvent.KEYCODE_BACK so that
* all systems call onBackPressed().
*/
#Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
onBackPressed();
return true;
}
return super.onKeyUp(keyCode, event);
}
/**
* If a Child Activity handles KeyEvent.KEYCODE_BACK. Simply override and
* add this method.
*/
#Override
public void onBackPressed() {
int length = mIdList.size();
if (length > 1) {
Activity current = getLocalActivityManager().getActivity(
mIdList.get(length - 1));
current.finishFromChild(current);
}
}
}
Please let me know where i am going wrong.
I finally found out that the issue was beacause of the ads display on top of tab.Referred to the below link and it got resolved.
Back button behavior with tabs and ActivityGroup

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) -> Activity1 -> Activity2
Now i want to redirect on Activity2 only if the flag is true. so that my code for that is something like bellow.
TabGroupActivity
public class TabGroupActivity extends ActivityGroup {
private ArrayList<String> mIdList;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (mIdList == null) mIdList = new ArrayList<String>();
}
/**
* This is called when a child activity of this one calls its finish method.
* This implementation calls {#link LocalActivityManager#destroyActivity} on the child activity
* and starts the previous activity.
* If the last child activity just called finish(),this activity (the parent),
* calls finish to finish the entire group.
*/
#Override
public void finishFromChild(Activity child) {
LocalActivityManager manager = getLocalActivityManager();
int index = mIdList.size()-1;
if (index < 1) {
finish();
return;
}
manager.destroyActivity(mIdList.get(index), true);
mIdList.remove(index); index--;
String lastId = mIdList.get(index);
Intent lastIntent = manager.getActivity(lastId).getIntent();
Window newWindow = manager.startActivity(lastId, lastIntent);
setContentView(newWindow.getDecorView());
}
/**
* Starts an Activity as a child Activity to this.
* #param Id Unique identifier of the activity to be started.
* #param intent The Intent describing the activity to be started.
* #throws android.content.ActivityNotFoundException.
*/
public void startChildActivity(String Id, Intent intent) {
Window window = getLocalActivityManager().startActivity(Id,intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
if (window != null) {
mIdList.add(Id);
setContentView(window.getDecorView());
}
}
/**
* The primary purpose is to prevent systems before android.os.Build.VERSION_CODES.ECLAIR
* from calling their default KeyEvent.KEYCODE_BACK during onKeyDown.
*/
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
//preventing default implementation previous to android.os.Build.VERSION_CODES.ECLAIR
return true;
}
return super.onKeyDown(keyCode, event);
}
/**
* Overrides the default implementation for KeyEvent.KEYCODE_BACK
* so that all systems call onBackPressed().
*/
#Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
onBackPressed();
return true;
}
return super.onKeyUp(keyCode, event);
}
/**
* If a Child Activity handles KeyEvent.KEYCODE_BACK.
* Simply override and add this method.
*/
#Override
public void onBackPressed () {
int length = mIdList.size();
if ( length > 1) {
Activity current = getLocalActivityManager().getActivity(mIdList.get(length-1));
current.finish();
}
}
}
now code for TabGroupActvity1
public class TabGroupActyvity1 extends TabGroupActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startChildActivity("OptionsActivity", new Intent(this,Activity1.class));
}
}
now in Activity1
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
if(flag){
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
Intent previewMessage = new Intent(parentActivity, Activity2.class);
parentActivity.startChildActivity("Activity2", previewMessage);
}else{
setContentView(R.layout.row);
//...
}
}
this is not working,
the same code the one in bellow works in some click event but not working in my case
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
Intent previewMessage = new Intent(parentActivity, Activity2.class);
parentActivity.startChildActivity("Activity2", previewMessage);
please give some suggestion how to do this.
have I explain the problem well... do I need to add some more details?
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", new Intent(this, ReportActivity.class));
}else{
startChildActivity("LogIn", new Intent(this, LoginActivity.class));
}
and from LoginActivity on Successful login i am Starting ReportActivity like bellow
parentActivity.startChildActivity("EditActivity", new Intent(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
#Override
public void onBackPressed() {
int length = mIdList.size();
if (length > 1) {
Activity current = getLocalActivityManager().getActivity(
mIdList.get(length - 1));
// Added code to disable back press only for the ReportActivity
if(current instanceof ReportActivity){
Log.i("TabGroup", "I am instance of ReportActivity" );
return;
}
current.finish();
}
}

Categories

Resources