I was wondering if it is possible to change the text and the image of a crouton when it is already displayed. And how?
In the simple case you can't easily. However, I imagine if you provide a custom view and maintain a reference to it you could modify the view at will. Here are the custom view make methods:
public static Crouton make(Activity activity, View customView);
public static Crouton make(Activity activity, View customView, ViewGroup viewGroup);
public static Crouton make(Activity activity, View customView, int viewGroupResId);
public static Crouton make(Activity activity, View customView, int viewGroupResId, final Configuration configuration);
There are also corresponding show methods.
You might also be able to do it with the default view using findViewById
. From the source, the IDs of the image and text are:
private static final int IMAGE_ID = 0x100;
private static final int TEXT_ID = 0x101;
You'll just have to make sure you search the correct view (sub)hierarchy.