Android close current activity and return to previous activity -


in second activity, can uninstall app after uninstall finished, second activity remains. need go previous activity after uninstall finished

uri packageuri = uri.parse("package:"+packageinfo.packagename);             intent uninstallintent = new intent(intent.action_delete, packageuri);             startactivity(uninstallintent); 

update first activity (firstactivity.java)

firstactivity.java

  1. use startactivityforresult(uninstallintent, 1); //1 request_code

  2. after unintalling app, firstactivity.onactivityresult automatically called, can use method something.

    @override protected void onactivityresult(int requestcode, int resultcode, intent data) {  super.onactivityresult(requestcode, resultcode, data); if (requestcode == 1) {     if (resultcode == result_ok) {         // un-installed         finish();     }     else {         // failed un-install     }   } } 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

python - Error: Unresolved reference 'selenium' What is the reason? -

asp.net ajax - Jquery scroll to element just goes to top of page -