Saku
Saku

Reputation: 180

Toast Alert Dialog is not displaying in ListView

I wrote an Application in which we can add items to the list view..i'm doing validation for that if any one making the same entry it should display an alert

Toast.makeText(getApplicationContext(), "Serial No Already Exist..",Toast.LENGTH_LONG);

But it not displaying while I'm running on emulator. I'm sure that my validation code is correct.

Upvotes: 3

Views: 231

Answers (3)

RobinHood
RobinHood

Reputation: 10969

Everything is perfect except one that you forget to append .Show() at the end, and also check this .

Toast.makeText(getApplicationContext(), "Serial No Already Exist..",Toast.LENGTH_LONG).Show();

Instead#

Toast.makeText(getApplicationContext(), "Serial No Already Exist..",Toast.LENGTH_LONG);

Upvotes: 2

Sardor Dushamov
Sardor Dushamov

Reputation: 1667

Try:

Toast.makeText(getApplicationContext(), "Serial No Already Exist..",Toast.LENGTH_LONG).show();

Upvotes: 7

G_S
G_S

Reputation: 7110

add the show() to the toast like this

Toast.makeText(getApplicationContext(), "Serial No Already Exist..",Toast.LENGTH_LONG).show();

You need to specify show() to make the toast visible

Upvotes: 2

Related Questions