tags:

views:

72

answers:

2

Hi friends i had a prob with app i.e when i am moving to the previous window the control goes to the splash screen of my app because the previous activity is killed by android runtime. how to make the previous activity alive. or how to create activity again and how to access it from present activity/....

plz help me....fnds

A: 

When you have a Splash activity i think the correct way is closing in and start the main activity

Intent mainIntent =new Intent(Splash.this,MainActivity.class);
Splash.this.startActivity(mainIntent);
Splash.this.finish();

then from your main activity start call your subactivities

why is killed your mainactivity? are you calling finish()

Jorgesys
i am not calling finish() in app due to less space it is killed by runtime, my problem is when you want traverse b/w multiple screen (activities) u need go back to home screen in the same u entered in to the present screen but the previous activities are killed then how do we make this thing happen to see that we can traverse all the screens in opp direction, plz help me
Ramesh Bugatha
A: 

U can make use of a default constructor to close and open screen

if u want to move between screens

1-2-3-4

&&

4-3-2-1 android it self take care of it.. for this u no need to worry

for example if u want traverse in a specific way like 4-2-3-1 android doesn't allow u

so simply create constructor and assign present activity to it and make use of that variable close screen at any time

Here is the sample shows how to do it.....

Here is the activity class

public class One extends Activity {

private One Screen;

public One() { Screen=this; }

when u want close this activity simply use

Screen.finish();

instead of this.finish();

when u want invoke new activity of u r liking simply use

Screen.finish(); Intent i = new Intent(One.this, YourActivity.class); Log.i(TAG, "calling YourActivity Screen"); startActivity(i);

if u want pass any data between the screens u can make use of

    i.putExtra("valuename", actualvalue);

and u can retrive the value using

Intent startIntent = getIntent();
    String actualvalue = startIntent.getStringExtra("valuename");
Ramesh Bugatha