55.7 Creating and Sending the Broadcast Intent
Having created the framework for the SendBroadcast application, it is now time to implement the code to send the broadcast intent. This involves implementing the broadcastIntent() method specified previously as the onClick target of the Button view in the user interface. Locate and double-click on the MainActivity.java file and modify it to add the code to create and send the broadcast intent. Once modified, the source code for this class should read as follows:
package com.ebookfrenzy.sendbroadcast;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
public class MainActivity extends AppCompatActivity {
.
.
public void broadcastIntent(View view)
{
Intent intent = new Intent();
...