My app displays all user apps in a ListView
, I want to take the user to the screen where they can uninstall that app onclick. However, the code I am using opens the info screen for about 1/4 second and then takes the user back to the app. Where am I wrong??
ListView listView = (ListView) findViewById(R.id.mobile_list);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String packageName = results.get(position);
Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("package:" + packageName));
startActivity(intent);
}
});
I would like to take the user directly to the message where it asks "are you sure you want to uninstall <appname>.apk?"