Hi

Only Toast widget will work for broadcast reciever is it possible to show
the images or any other thing we can't place..

On Thu, Jul 30, 2009 at 11:29 AM, Sudeep Jha <sudeep.neti...@gmail.com>wrote:

> Still no broadcasting.Can anybody give me an example code on broadcasting
> an intent from an activity to call another application?
>
>
> On Wed, Jul 29, 2009 at 7:26 PM, Mark Murphy <mmur...@commonsware.com>wrote:
>
>>
>> Sudeep Jha wrote:
>> > 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.
>>
>> I don't see anything obviously wrong, so here are some things to look at:
>>
>> 1. Make sure you have your <receiver> in the proper place in the
>> manifest. It should be a child of <application> and a peer of any
>> <activity> or related component elements.
>>
>> 2. I am not certain if a Toast will work from a BroadcastReceiver. If
>> you are concerned that your Log statement might not be being logged, try
>> bumping it to warning (Log.w) or error (Log.e).
>>
>> 3. Check LogCat for warnings. For example, if Android cannot find your
>> BroadcastReceiver for some reason, you will get a warning in LogCat, not
>> an error.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://twitter.com/commonsguy
>>
>> Android App Developer Training: http://commonsware.com/training.html
>>
>>
>>
>
>
> --
> Warm Regards,
> Sudeep
>
>
> >
>


-- 
Regards
-------------------
Desu Vinod Kumar
vinny.s...@gmail.com
09176147148

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to