// Example 1: Set an icon using a drawable resource AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(R.drawable.my_icon); builder.setTitle("Alert!"); builder.setMessage("This is an alert message."); builder.show(); // Example 2: Set an icon using a bitmap Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.my_icon); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(new BitmapDrawable(getResources(), icon)); builder.setTitle("Alert!"); builder.setMessage("This is an alert message."); builder.show();In the first example, we set the icon using a drawable resource - `R.drawable.my_icon`. In the second example, we create a bitmap using `BitmapFactory.decodeResource`, and set it as the icon using `new BitmapDrawable()`. The package library for `android.app.AlertDialog.Builder` is `android.app`.