Hi all,

        My application has two components,one is Activity and
BroadcastReceiver.

I am using the BroadcastReceiver as inner class of my Application.

The BroadcastReceiver's onReceive method is initiating a new Thread as
Thread object,every time.

In that i am trying to update the activity if it is in fore ground.If
it is in back ground i am simply ignoring.


But some times my application is hanging as my application's
"HeapWorker" thread  is taking 80-90% of the CPU.

Some tme it is showing  BroadcastReceiver time out.

I am receiving BroadcastRequest almost one for every second.

My BroadcastReceiver class look  like as following.


public class Test extends Application
{
   ....
   .....

  public static class Receiver extends BroadcastReceiver
 {
      public void onReceive(Context ctxt,Intent i1)
      {
           final Context context = ctxt;
           new Thread()
           {
                Intent i1 = new Intent();
                i1.setAction(...);
                context.startActivity(i1);
          }.start();

     }
 }
}


Am i doing correct?

Any help highly appreciated.



-- 
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