in my project i use listview (list of program installed in device) and inside listview i have button for each row. when user clicked button i want to delete program. now in arrayadapter (custom list) i have (button.setOnClickListener) when user clicked button my unintall code must run pls help me
my uninstallApp class:
public class UninstallApp extends ArrayAdapter<String>{
public BlackListAdapter(Context context,int layoutResourceId, ArrayList<String> appsName,
ArrayList<String> appsPackageName,ArrayList<Drawable> appsIcon) {
super(context, layoutResourceId, appsName);
... . . . }
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
btnDell.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri packageUri =Uri.parse("package:com.mk88.rootdetection");
Intent uninstallIntent =
new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
// where runing startactivity ?????
//startActivity(uninstallIntent);
}
});
return rowView;
}
}
}
but when clicked button my program has stop. pls help me. tnx