Only a subset of Android view classes can be used in a widget (supported by
RemoteViews). I believe the list is somewhere in widgets chapter in the
development guide. That subset is fixed, you can't extend it by adding your
own views.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

22.10.2010 1:36 пользователь "sergio" <[email protected]> написал:

Hi all.

I have built an empty custom view as follows:

public class MyView extends View {

       public MyView(Context context, AttributeSet attrs) {
               super(context, attrs);
       }

       @Override
       protected void onDraw(Canvas canvas) {
               super.onDraw(canvas);
       }
}

I would like to use my custom view to create a home application widget
(i.e. a class extending AppWidgetProvider), which will ultimately
consist of some buttons, a text field and my custom view.

In the main layout of my app I call it as follows, i.e.

       <com.example.widget.MyView android:id="@+id/my_widget"
               android:layout_gravity="left"
               android:layout_height="fill_parent"
               android:layout_width="wrap_content"/>

but when placing the widget on the home screen I get the following
error:

Error inflating AppWidget
AppWidgetProviderInfo(provider=ComponentInfo{com.example.widget/
com.example.widget.MyWidget}

Could anyone shed some light on this?

Cheers,

SegioL

--
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]<android-developers%[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

Reply via email to