android - Widget is not loaded on AVD -


i'm trying create widget android. contains such files:

res/xml/widgetinfo.xml:

<?xml version="1.0" encoding="utf-8"?> <appwidget-provider   xmlns:android="http://schemas.android.com/apk/res/android"   android:minwidth="146dip"   android:minheight="146dip"   android:updateperiodmillis="3600000"   android:initiallayout="@layout/main" /> 

res/layout/main.xml:

<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >     <linearlayout >         <textview android:text="my widget" />     </linearlayout> </framelayout> 

androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.justmad.thegame"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk android:minsdkversion="10" />      <application         android:icon="@drawable/ic_launcher"         android:label="@string/app_name">         <receiver android:name="widgetprovider">             <intent-filter>                 <action android:name="android.appwidget.action.appwidget_update" />             </intent-filter>             <meta-data android:name="android.appwidget.provider"                 android:resource="@xml/widgetinfo" />         </receiver>     </application> </manifest> 

src/com.test.widgetprovider:

package com.test;  import android.appwidget.appwidgetprovider;  public class widgetprovider extends appwidgetprovider { } 

but when run in avd , trying add widget displays message "problem loading widget". logcat shows nothing in verbose mode. so, wrong?

  1. you need implement onupdate() in appwidgetprovider.

  2. your layout not work. tell trying layout in, say, activity. missing android:layout_width , android:layout_height on linearlayout , textview. also, unclear framelayout doing you.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -