android - Sending a broadcast to MainActivity and then showing a TextView
问题 I want to unhide a TextView once a method is called in another View file. The TextView is in MainActivity. For this, I am planning to send a broadcast from the View file to MainActivity, but it didn't work. How would I achieve this? 回答1: Step 0 : Define an action : public static final String ACTION_SHOW_TEXT= "showText"; Step 1 : Create your Broadcast receiver in your MainActivity : BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent