Reloading an application

  • Replies:3
bonofred
  • Forum posts: 3

Jun 16, 2011, 11:00:57 PM via Website

Hi guys , this is my first post :-) (Sorry for the bad english)

I have one activity A which load B when i push a button ,
When i push the button HOME and I come back to my application , i don't have the activity B but the A . I'd like to have the old activity which has been loaded (the B ) .

How can I do ? May i add something on the manisfest ?

— modified on Jun 16, 2011, 11:02:51 PM

Reply
Steven Blum
  • Forum posts: 882

Jun 17, 2011, 12:08:59 AM via Website

What are the programs and what type of phone are you using? Also, can you give me an example of what happens, exactly?

— modified on Jun 17, 2011, 12:09:24 AM

Reply
bonofred
  • Forum posts: 3

Jun 17, 2011, 12:24:58 AM via Website

Ok , My manifest :
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.ikomobi.test"
4 android:versionCode="1"
5 android:versionName="1.0">
6 <application android:icon="@drawable/icon" android:label="@string/app_name">
7
8
9 <activity android:name=".Start"
10 android:label="@string/app_name">
11 <intent-filter>
12 <action android:name="android.intent.action.MAIN" />
13 <category android:name="android.intent.category.LAUNCHER" />
14 </intent-filter>
15 </activity>
16
17 <activity android:name=".Test1"
18 android:screenOrientation="portrait">
19 <intent-filter>
20 <action android:name="android.intent.action.VIEW" />
21 </intent-filter>
22 </activity>
23
24 </application>
25</manifest>

I have two activities : Start and Test1 , there's a Button on Start which load Test1 and that's all

1public class Start extends Activity implements OnClickListener{
2
3 Button next;
4
5 /** Called when the activity is first created. */
6 @Override
7 public void onCreate(Bundle savedInstanceState) {
8 super.onCreate(savedInstanceState);
9 setContentView(R.layout.main);
10 next = (Button) findViewById(R.id.Button01);
11 next.setOnClickListener(this);
12 }
13
14 @Override
15 public void onClick(View arg0) {
16 if( arg0 == next ){
17 Intent intent = new Intent(this,Test1.class);
18 startActivity(intent);
19
20 }
21 }
22}

This is the code for Test1 :
1public class Test1 extends Activity implements OnClickListener{
2
3 public Button next;
4
5 /** Called when the activity is first created. */
6 @Override
7 public void onCreate(Bundle savedInstanceState) {
8 super.onCreate(savedInstanceState);
9 setContentView(R.layout.test1);
10 next = (Button) findViewById(R.id.Button01);
11 }
12
13 @Override
14 public void onClick(View v) {
15 // TODO Auto-generated method stub
16
17 }
18
19
20}

All I want is I want to quit the application (with the button HOME) and come back exactly at the same place (for example , if i was at B , i want to restart at B and keep the activity A)

I hope i'm clear (shy)

Reply
bonofred
  • Forum posts: 3

Jun 17, 2011, 12:28:23 AM via Website

To be clear with that example , when I'm starting the application , I'm on the activity Start (that's logic) , then I push the button next , thanks to the intent , i can go to the activty Test1. So now , I want to quit the application (with HOME) , and when i come back to the application that's not Test1 but Start who's has been loaded.

Reply