简体   繁体   中英

How to add 2 toast message in 1 java class?

I am trying to add another Toast message for my application, I've already made the first one when data is empty Toast message pop up and say " Sorry data still empty" and I would like make another one message pop up when there is data is available like "Data successfully loaded".

Here is my code:

if (gamename.isEmpty()){
            Toast.makeText(spk_activity.this,"Sorry Data Still Empty",Toast.LENGTH_SHORT).show();

You can just write another code in your activity. Like below

if (gamename.isLoaded()){ Toast.makeText(spk_activity.this,"Data succesfully loaded",Toast.LENGTH_SHORT).show();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM