the thing is i have made an application in which icons are there.. when we click on icon, it changes its image.. (i.e it glows). and open another activity.. but when back is pressed, its still in glowing state.. so i want to revert it to original statewhen back is pressed
package sditm.app;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.Toast;
public class page1 extends Activity {
/** Called when the activity is first created. */
ImageView about;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.page1);
about=(ImageView)findViewById(R.id.imageView6);
about.setClickable(true);
about.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-gener2ated method stub
about.setImageResource(R.drawable.helps);
Intent i=new Intent(getApplicationContext(),aboutActivity.class);
startActivity(i);
Toast.makeText(getApplicationContext(), "Enter all fields", Toast.LENGTH_SHORT).show();
about.setImageResource(R.drawable.help);
}
});
}
}
use
onResume()to restore image previous state: