I am using this code to stop the selected running applications in android phone:
Button view = (Button)findViewById(R.id.button1);
view.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
String appname = getIntent().getExtras().getString("appname");
String pname=appname.split("\n")[3];
int id=Integer.parseInt(pname);
finish();
android.os.Process.killProcess(id);
The Id is correct but this code is not working... any help?? Is there any other code to kill processes by using their id??