[Solved] close and exit from my App in android


try to set listener on your exit Button (

in my example is : btn_exit

)
your app will exit at all 🙂

    public class testprj extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button btn_exit = (Button) findViewById(R.id.btn1);
    btn_exit .setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
            System.exit(0);
        }
    });
    }
 }

**

also make sure that the first activity is finished (onStop() ==> make
finish() )

**

2

solved close and exit from my App in android