David Marsh
David Marsh

Reputation: 147

Use a drawable in rate app dialog

I have a dialog pop up to rate my app and on this dialog is the android icon.

What i want is to be able to chose a drawable instead of the system icon like have my app icon in its place! this is my first time in using a rate app dialog so apologies if this is a basic question to you all as to me its a tough one, i think you should only need this one section of code where the icon is but if you require the full class then i can post that.

 builder.setMessage(message)
                .setTitle("Rate " + APP_TITLE)
                .setIcon(context.getApplicationInfo().icon)
                .setCancelable(false)

Upvotes: 2

Views: 143

Answers (2)

ViramP
ViramP

Reputation: 1709

You can set icons with two ways:
Set the Drawable

AlertDialog.Builder setIcon (Drawable icon)


Set the resource id of the Drawable

  AlertDialog.Builder setIcon (int iconId)

Upvotes: 1

himanshu1496
himanshu1496

Reputation: 1921

You can just pass the resource Id of your app icon drawable, for example:

builder.setMessage(message)
            .setTitle("Rate " + APP_TITLE)
            .setIcon(R.drawable.app_logo)
            .setCancelable(false);

In this case app_logo can be drawable having your app icon.

Upvotes: 2

Related Questions