Set title and (title) icon for a custom alert dialog

Posted by Ecki on Stack Overflow See other posts from Stack Overflow or by Ecki
Published on 2011-01-17T10:51:20Z Indexed on 2011/01/17 10:53 UTC
Read the original article Hit count: 294

I don't manage to set a neither a title nor a (title) icon to my custom alert dialog. My code:

public class AddingFavoriteDialog extends AlertDialog {

. . .

private OnAddingFavoriteListener onAddingFavoriteListener; private Context context; private GeocodingManager geocodingManager; private FavoritesActivity favoritesActivity;

public AddingFavoriteDialog(Context context, OnAddingFavoriteListener onAddingFavoriteListener) { super(context, android.R.style.Theme_Dialog);

this.context = context; this.onAddingFavoriteListener = onAddingFavoriteListener; this.geocodingManager = new GeocodingManager(context); this.favoritesActivity = (FavoritesActivity) context; }

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.adding_favorite_dialog2);

setTitle("MYTITLE");

setIcon(R.drawable.star_gold);

. . . }

What am i doing wrong? I also tried to set it by calling super.setTitle("MYTITLE"); in onCreate() as well as in the constructor.

© Stack Overflow or respective owner

Related posts about android

Related posts about title