I have created an alert dialog with a list of apps (in text). So when I click on any of them, that particular app launches. I did this using AlertDialog fragment and using this code:
apps = new String[]{"App1","App2","App3"};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choose the app");
builder.setItems(apps, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// The 'which' argument contains the index position
// of the selected item
//Code to launch the apps
}
});
return builder.create();
Is it possible to display the app icons along with the app names? If yes, what changes should I make to the code?
How do I get the app icons of installed apps on the phone?