Hi Alexander,
I am certainly not especially good at widgets, but in this case it
looks as if you have some problems with the xml defiining either the
widget or most probably the layout when going to landscape.
Good luck
  /Johan

On Jan 22, 9:05 am, Alexander Golikov <[email protected]> wrote:
> Hello,
>
> I've created a simple analog clock widget for SonyEricsson X10 mini
> pro. It just changes the style of standard android AnalogClock widget.
> Widget works fine until screen orientation changes when I slide the
> physical keyboard. At this moment I recieve the following error:
>
> W/AppWidgetHostView( 1305): updateAppWidget couldn't find any view,
> using error
> view
> W/AppWidgetHostView( 1305): android.view.InflateException: Binary XML
> file line
> #12: Error inflating class android.widget.AnalogClock
> W/AppWidgetHostView( 1305):     at
> android.view.LayoutInflater.createView(Layout
> Inflater.java:513)
> W/AppWidgetHostView( 1305):     at
> com.android.internal.policy.impl.PhoneLayoutI
> nflater.onCreateView(PhoneLayoutInflater.java:56)
> W/AppWidgetHostView( 1305):     at
> android.view.LayoutInflater.createViewFromTag
> (LayoutInflater.java:563)
> W/AppWidgetHostView( 1305):     at
> android.view.LayoutInflater.rInflate(LayoutIn
> flater.java:618)
> W/AppWidgetHostView( 1305):     at
> android.view.LayoutInflater.inflate(LayoutInf
> later.java:407)
> W/AppWidgetHostView( 1305):     at
> android.view.LayoutInflater.inflate(LayoutInf
> later.java:320)
> W/AppWidgetHostView( 1305):     at
> android.widget.RemoteViews.apply(RemoteViews.
> java:900)
> W/AppWidgetHostView( 1305):     at
> android.appwidget.AppWidgetHostView.updateApp
> Widget(AppWidgetHostView.java:208)
> W/AppWidgetHostView( 1305):     at
> android.appwidget.AppWidgetHost.createView(Ap
> pWidgetHost.java:217)
> W/AppWidgetHostView( 1305):     at
> com.sonyericsson.homescreen.HomeScreen.create
> AppWidget(HomeScreen.java:1026)
> W/AppWidgetHostView( 1305):     at
> com.sonyericsson.homescreen.HomeScreen.access
> $3100(HomeScreen.java:105)
> W/AppWidgetHostView( 1305):     at
> com.sonyericsson.homescreen.HomeScreen$Widget
> LoaderThread.run(HomeScreen.java:2423)
> W/AppWidgetHostView( 1305): Caused by:
> java.lang.reflect.InvocationTargetExcepti
> on
> W/AppWidgetHostView( 1305):     at
> android.widget.AnalogClock.<init>(AnalogClock
> .java:62)
> W/AppWidgetHostView( 1305):     at
> java.lang.reflect.Constructor.constructNative
> (Native Method)
> W/AppWidgetHostView( 1305):     at
> java.lang.reflect.Constructor.newInstance(Con
> structor.java:446)
> W/AppWidgetHostView( 1305):     at
> android.view.LayoutInflater.createView(Layout
> Inflater.java:500)
> W/AppWidgetHostView( 1305):     ... 11 more
> W/AppWidgetHostView( 1305): Caused by: java.lang.RuntimeException:
> Can't create
> handler inside thread that has not called Looper.prepare()
> W/AppWidgetHostView( 1305):     at
> android.os.Handler.<init>(Handler.java:121)
> W/AppWidgetHostView( 1305):     at
> android.widget.AnalogClock.<init>(AnalogClock
> .java:52)
> W/AppWidgetHostView( 1305):     ... 15 more
>
> My code is here:
>
> public class ClockWidget extends AppWidgetProvider
> {
>     public void onReceive(Context context, Intent intent)
>     {
>         String action = intent.getAction();
>         if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action))
>         {
>             RemoteViews views = new
> RemoteViews(context.getPackageName(), R.layout.widget);
> AppWidgetManager.getInstance(context).updateAppWidget(intent.getIntArrayExt­ra(AppWidgetManager.EXTRA_APPWIDGET_IDS),
> views);
>         }
>     }
>
> }
>
> And layout file is as follows:
>
> <?xml version="1.0" encoding="utf-8"?>
> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>                                 android:id="@+id/Widget"
>                                 android:layout_width="fill_parent"
>                                 android:layout_height="fill_parent"
>                                 android:gravity="center">
>         <AnalogClock android:saveEnabled="true" android:id="@+id/AnalogClock"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content" android:dial="@drawable/
> widgetdial" android:hand_hour="@drawable/widgethour"
> android:hand_minute="@drawable/widgetminute"/>
> </RelativeLayout>
>
> Could you please advise what can cause such problem.
>
> Thanks,
> Alexander

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