In an application main activity I have the following code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button=(Button)findViewById(R.id.Button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
* Intent intent = new Intent("com.example.broadcast");
Intent.putExtra("example","Broadcasting ");
sendBroadcast(intent);*
}
});
Here is the broadcastreceiver code:
public class CustomBroadCast extends BroadcastReceiver {
/**
* @see android.content.BroadcastReceiver#onReceive(Context,Intent)
*/
@Override *
public void onReceive(Context context, Intent intent) {
Log.i("INFORMATION","Broadcasting message");
String dummyText = intent.getStringExtra(**"example");
Toast.makeText(context, dummyText , Toast.LENGTH_SHORT).show();*
}
}
In manifest file of CustomBroadCast class apllication:
* <receiver android:name=".CustomBroadCast">
<intent-filter>
<action android:name="com.example.broadcast" />
</intent-filter>
</receiver>*
This is not working.What I am missing here?please help.[?]
--
Warm Regards,
Sudeep
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
<<inline: 322.png>>

