Hi Kostya,

Thanks again.  I have exactly that code for both config activities, so I
don't think that's the problem.  Thanks for the stack trace, I was seeing
that warning in the logs, but it didn't have a stack trace associated with
it for some reason, I'm not sure why.

I've tracked down the source of the warnings and they should be quiet now :)

The problem he was reporting was when he added a clock component, then
removed it, it was removed from the list of widgets.  Can you check to see
if that happens on your device?

Thanks for your help,
Ash

2012/1/5 Kostya Vasilyev <[email protected]>

> The code in Launcher looks up the widget info object by the widget id.
> Does your code properly handle that?
>
> Here is my code from a widget config activity:
>
> Intent resultValue = new Intent();
>  resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
> setResult(RESULT_OK, resultValue);
>  finish();
>
> Where mAppWidgetId is initialized inside onCreate:
>
> Intent intent = getIntent();
>  Bundle extras = intent.getExtras();
> if (extras != null) {
> mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,
>  AppWidgetManager.INVALID_APPWIDGET_ID);
> }
>
> FWIW, I can't get your widget to crash on a Galaxy Nexus with 4.0.1, tried
> both the switcher bar and the clock, but I did get a bunch of these in the
> logcat when creating the clock:
>
> 01-05 19:59:28.047 W/ResourceType(30663): No known package when getting
> value for resource number 0xffffffff
> 01-05 19:59:28.055 W/ImageView(30663): Unable to find resource: -1
> 01-05 19:59:28.055 W/ImageView(30663):
> android.content.res.Resources$NotFoundException: Resource ID #0xffffffff
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.content.res.Resources.getValue(Resources.java:1019)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.content.res.Resources.getDrawable(Resources.java:663)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.widget.ImageView.resolveUri(ImageView.java:542)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.widget.ImageView.setImageResource(ImageView.java:315)
> 01-05 19:59:28.055 W/ImageView(30663): at
> sirocco.widgets.AwesomeClockActivity.setBackground(AwesomeClockActivity.java:672)
> 01-05 19:59:28.055 W/ImageView(30663): at
> sirocco.widgets.AwesomeClockActivity.skinExamples(AwesomeClockActivity.java:531)
> 01-05 19:59:28.055 W/ImageView(30663): at
> sirocco.widgets.AwesomeClockActivity.setCurrentSkin(AwesomeClockActivity.java:747)
> 01-05 19:59:28.055 W/ImageView(30663): at
> sirocco.widgets.AwesomeClockActivity.onCreate(AwesomeClockActivity.java:379)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.app.Activity.performCreate(Activity.java:4465)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.app.ActivityThread.access$600(ActivityThread.java:122)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.os.Looper.loop(Looper.java:137)
> 01-05 19:59:28.055 W/ImageView(30663): at
> android.app.ActivityThread.main(ActivityThread.java:4340)
> 01-05 19:59:28.055 W/ImageView(30663): at
> java.lang.reflect.Method.invokeNative(Native Method)
> 01-05 19:59:28.055 W/ImageView(30663): at
> java.lang.reflect.Method.invoke(Method.java:511)
> 01-05 19:59:28.055 W/ImageView(30663): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
> 01-05 19:59:28.055 W/ImageView(30663): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
> 01-05 19:59:28.055 W/ImageView(30663): at
> dalvik.system.NativeStart.main(Native Method)
>
> Hope this helps.
>
> -- Kostya
>
> 5 января 2012 г. 18:43 пользователь Ash McConnell <[email protected]
> > написал:
>
> Hi Kostya,
>>
>> Sorry for the late reply, it has been a hectic holiday period.
>>
>> I couldn't get it to cause any problems in the emulator or any warnings
>> on my Android 2.2 device (Motorola Defy)
>>
>> I got the user to send me a log file using a logfile capture app.  There
>> was one exception of interest: -
>>
>> "
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): FATAL EXCEPTION: main
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): java.lang.RuntimeException:
>> Failure delivering result ResultInfo{who=null, request=5, result=-1,
>> data=Intent { (has extras) }} to activity 
>> {com.android.launcher/com.**android.launcher2.Launcher}:
>> java.lang.NullPointerException
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at android.app.ActivityThread.
>> **deliverResults(ActivityThread.**java:2976)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at android.app.ActivityThread.
>> **handleSendResult(**ActivityThread.java:3019)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at android.app.ActivityThread.
>> **access$1100(ActivityThread.**java:122)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at
>> android.app.ActivityThread$H.**handleMessage(ActivityThread.**java:1176)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at android.os.Handler.**
>> dispatchMessage(Handler.java:**99)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at
>> android.os.Looper.loop(Looper.**java:137)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at android.app.ActivityThread.
>> **main(ActivityThread.java:4340)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at java.lang.reflect.Method.*
>> *invokeNative(Native Method)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at java.lang.reflect.Method.*
>> *invoke(Method.java:511)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at com.android.internal.os.**
>> ZygoteInit$**MethodAndArgsCaller.run(**ZygoteInit.java:784)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at com.android.internal.os.**
>> ZygoteInit.main(ZygoteInit.**java:551)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at dalvik.system.NativeStart.
>> **main(Native Method)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): Caused by:
>> java.lang.NullPointerException
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at com.android.launcher2.**
>> Launcher.getSpanForWidget(**Launcher.java:941)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at com.android.launcher2.**
>> Launcher.completeAddAppWidget(**Launcher.java:964)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at com.android.launcher2.**
>> Launcher.completeAdd(Launcher.**java:492)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at com.android.launcher2.**
>> Launcher.onActivityResult(**Launcher.java:528)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at android.app.Activity.**
>> dispatchActivityResult(**Activity.java:4649)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): at android.app.ActivityThread.
>> **deliverResults(ActivityThread.**java:2972)
>> 12-21 12:24:46.919 E/AndroidRuntime(21552): ... 11 more
>> 12-21 12:24:46.919 W/ActivityManager(  176):   Force finishing activity
>> com.android.launcher/com.**android.launcher2.Launcher
>> "
>>
>> Here is the relevant file
>> http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.1_r1/com/android/launcher2/Launcher.java?av=f
>>
>>
>> It seems like it can't get the appWidgetInfo object on line 959.  I have
>> checked my AppWidgetProviderInfo XML and it seems to comply to the
>> guidelines/rules.  I'm not sure what I've done wrong here
>>
>> Any suggestions would be welcome.
>> All the best,
>> Ash
>>
>>
>>
>>
>>  --
>> 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
>>
>
>  --
> 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
>



-- 
Awesome Widgets <http://www.siroccosoftware.com/awesome>
Online Racing Championship <http://onlineracingchampionship.com>
Twitter <http://twitter.com/AshMcConnell>

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

Reply via email to