J'essaie d'exécuter un toast dans la séquence afin d'afficher un flux rss ruuning. Je reçois l'erreur suivante lors de l'exécution: java.lang.RuntimeException: Ce Toast n'a pas été créé avec Toast.makeText()erreur lors de l'affichage toast
Mon code est:
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast_layout,
(ViewGroup) findViewById(R.id.toast_layout_root));
ImageView image = (ImageView) layout.findViewById(R.id.toastimage);
image.setImageResource(R.drawable.bball_icon);
TextView text = (TextView) layout.findViewById(R.id.toasttext);
Toast toast = new Toast(getApplicationContext());
toast.setView(layout);
for (int i=0;i<episode_titles.size();i++)
{
toast.setText(episode_titles.get(i).toString());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.show();
}
Pouvez-vous publier le logcat de votre erreur? – caiocpricci2
02-28 11: 11: 10.421: E/AndroidRuntime (9715): java.lang.RuntimeException: Ce Toast n'a pas été créé avec Toast.makeText() – user1163234
En fait, nous avons besoin du logcat qui se réfère à l'erreur réelle, vous avez mentionné en cours d'exécution : java.lang.RuntimeException! – caiocpricci2