L'image orange sera en position 5
Voici la liste des images. Rappel: la premiere case d'une liste a l'index 0.
L'index 5 correspond donc a la case 6
['red_image', 'red_image', 'red_image', 'red_image', 'red_image', 'orange_image', 'red_image', 'red_image', 'red_image']
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert a value from dip to pixel. | |
* | |
* @param displayMetrics the {@link android.util.DisplayMetrics} used to convert. | |
* @param dip the value in dip to convert. | |
* @return a value in pixel. | |
*/ | |
public static int dipToPx(DisplayMetrics displayMetrics, float dip) { | |
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, displayMetrics); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyActivity extends Activity { | |
private Toast mTextToast; | |
... | |
private void makeToast(String message) { | |
if (mTextToast != null) { | |
mTextToast.cancel(); | |
} |