How to kill whole application in onne single click.. finish() is not working?? it redirects to tha previous activity...pls guide me.
public void onClick(View arg0) {
// TODO Auto-generated method stub
WallpaperManager wp = WallpaperManager
.getInstance(getApplicationContext());
try {
Display d = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
int width = d.getWidth();
int height = d.getHeight();
wp.setBitmap(b1);
} catch (IOException e) {
Log.e("error", "Cannot set image as wallpaper", e);
}
finish();
}
System.exit()
does not kill your app if you have more than one activity on the stack
Use android.os.Process.killProcess(android.os.Process.myPid());
this way.
for sample
public void onBackPressed() {
android.os.Process.killProcess(android.os.Process.myPid());
super.onBackPressed();
}
For more detail see Is quitting an application frowned upon? , How to force stop my android application programmatically?
I hope this will help you.