Kailash Dabhi
Kailash Dabhi

Reputation: 3513

i just want to start my application from initial state

I have 2 activity when I press the image on 1 activity it launches the 2 activity. Each time when 2 activity launch it triggers the http request and form the table.

It works fine but when i press "back" button and then again start the application and came to the 2 activity.

It doesnt clear the previous data of table and add the data which came from http request. I didnt use a database its just a xml tablelayout.

Simply I just want to start my application from initial state.

I dont want the android system to remember the activity's previous state when I backpressed the whole application.

Please help me on this.

Upvotes: 0

Views: 198

Answers (3)

user1793842
user1793842

Reputation:

then may be i think you should completely close the application on back press so your problem will be solved. this is the code :--

 @Override
 public void onBackPressed() 
 {
    finish();
    android.os.Process.killProcess(android.os.Process.myPid());
 }

this method kills the application and Ofcourse your problem!

Upvotes: 1

Mohit
Mohit

Reputation: 2960

if i'm getting correct (from your question) , You need to check the views before making http call e.g let us say u have a textview there in table layout, then check like this before making the http call:

   if(getthevalueoftextview!=null){ 

           textview.setText("");
       }

Upvotes: 0

Sankar
Sankar

Reputation: 1691

In manifest, for second activity write android:noHistory="true", then it won't remember history.

Upvotes: 1

Related Questions