Android BroadcastReceiver within Activity

后端 未结 7 1457
后悔当初
后悔当初 2020-11-28 23:59

I\'m just trying this little sample project, all it does: Activity one has a Button that sends a Broadcast. Activity two displays a toast when received. Below is the code, t

7条回答
  •  攒了一身酷
    2020-11-29 00:13

     Toast.makeText(getApplicationContext(), "received", Toast.LENGTH_SHORT);
    

    makes the toast, but doesnt show it.

    You have to do Toast.makeText(getApplicationContext(), "received", Toast.LENGTH_SHORT).show();

提交回复
热议问题