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
use startactivityforresult(uninstallintent, 1); //1 request_code
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
Post a Comment