When you find out that your toast's Show method is actually executed, but not displayed in the interface,
There may be two points in the wrong place:
1.Context Context object has a problem, not the current context object or something;
2.message (that is, the problem that the toast will display) has a problem, and the message may end with "".
If neither of these issues is wrong, consider that Android does not allow UI changes in child threads
To solve this problem, it is easy to display the toast by passing the received data through handler in a child thread.
For example, when implementing the feedback page.
This is the code in the child thread when the feedback is successful, and the feedback failure is not written.
New= success_send;handler.sendmessage (message);
The following is the data obtained in the handler
PrivateHandler Handler =NewHandler () { Public voidhandlemessage (android.os.Message msg) {String text=NULL; Switch(msg.what) { CaseContent_null:text= "Feedback content cannot be empty"; Break; CaseSuccess_send:text= "Thank you for your feedback"; default: Break; } Toast Toast= Toast.maketext (feedbackactivity. This, text, Toast.length_long); Toast.setgravity (Gravity.top,0, 0); Toast.show (); LOG.D (TAG, text); }; };
Analysis of why the toast in Android doesn't show up