Debugging a Widget causes ANR

by Salv0 » Fri, 14 Jan 2011 21:18:38 GMT

Sponsored Links
 Hi all :)
I'm trying to debug an AppWidget but I incurred in a problem :D If not
setting the breakpoint the widget works good without ANR and the
commands Log.v are executed flawlessly. Then I placed a breakpoint on
the top of the following method:

    public void onReceive(Context context, Intent intent) {
    Log.v(TAG, "onReceive 1"); // BP on this line
    super.onReceive(context, intent);
    String action = intent.getAction();

    // Checks on action and computations ...

    Log.v(TAG, "onReceive 2");
    Log.v(TAG, "onReceive 3");

The breakpoint stops the execution as expected but then the process
dies. The problem is that the breakpoint ( I guess xD ) cause an ANR
and the ActivityManager kills the process. That's the Log:

01-07 14:32:38.886: ERROR/ActivityManager(72): ANR in
01-07 14:32:38.886: INFO/Process(72): Sending signal. PID: 475 SIG: 9
01-07 14:32:38.906: INFO/ActivityManager(72): Process
com.salvo.wifiwidget (pid   475) has died.

This cause the debug to stop. So the question is: there's a way to
debug the widget without incurring in the ANR?? thanks in advance for
the answers


Other Threads

1. Camera Preview Sample


has anyone of you a sample code which uses the camera preview callback
in help with the SurfaceHolder.SURFACE_TYPE_NORMAL?

I want to generate a own preview to analyse the picture and to display
some infos into the picture.
but i still have some problems to display a own preview ( only the
camera picture, no analyse ).

For Example:

Additional, only the emulator displays this result, on my g1 i get a
black screen with some exceptions.

Can anybody help me, please!



2. Design guidelines question; Services vs. Intent broadcasts.

I'm writing an application that consists of a background Service and
one or several Activities acting as UI towards this. There will most
likely be several different UIs for this service that will installed
later on, like custom widgets or UIs. The question is how to solve
this in the most efficient way.

Is it better to only use Intents for communication between UI and
Service (sending control commands with Intents from the UI and
listening for Intents from the Service for state and data updates) or
should I prefer using IPC communication (AIDL -> Java Stub, binding to
the service etc..)? Since the UI might be started long after the
service is started, I would either need to use sticky intents to
signal current state, or have a very frequent intent sent by the
service if choose to go with the Intent-based design. Which one would
be the preferred way in that case?

I've read that sticky intents are much more resource consuming than
normal intents, but are intents more consuming than IPC directly
towards the service?

Also, is really an AIDL the right way to allow third-party
integration? Intents sounds better, since they are also asynchronous.

Please advice. :)


// Erik

3. OpenIntent Simulator - Get black screen when selecting SensorSimulator

4. Load URL in Background in WebView

5. How to deal with service permission?

6. How to hang an outgoing call? (Revisited, Partly solved here)

7. How to get audio file from SD card?