Android app not showing

It looks like my # $ #% $% # $ recipient was not an application element in the manifest

Hi

I just created a helloworld appwidget to see how it works. I followed the dev example on the adroid dev website. But for some reason, the widget does not want to show in the list of widgets.

AndroidManifest.xml

 <receiver android:name="VoiceRIAWidget" android:label="Voice RIA">
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
        </intent-filter>
        <meta-data android:name="android.appwidget.provider"
            android:resource="@xml/appwidget_info" />
    </receiver>

appwidget_info.xml

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="Voice RIA" android:minWidth="50dp" android:minHeight="50dp"
    android:updatePeriodMillis="86400000" android:initialLayout="@layout/appwidget">
</appwidget-provider>

VoiceRIAWidget

public class VoiceRIAWidget extends AppWidgetProvider
{

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager,
            int[] appWidgetIds)
    {

        final int N = appWidgetIds.length;

        for (int i = 0; i < N; i++)
        {
            int appWidgetId = appWidgetIds[i];

            CharSequence text = "Hello";

            RemoteViews views = new RemoteViews(context.getPackageName(),
                    R.layout.appwidget);

            views.setTextViewText(R.id.appwidget_text, text);

            appWidgetManager.updateAppWidget(appWidgetId, views);
        }

        super.onUpdate(context, appWidgetManager, appWidgetIds);
    }
}

appwidget.xml   

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/appwidget_text" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:textColor="#ff000000" />

I can’t see what I am missing, but nothing is displayed in the list.

+5
source share
3 answers

I had the same problem. My mistake was that I only put the receiver tag in my manifest tag when I had to put it in my application tag. This was my non-working XML:

<manifest....>
  ....
  <receiver ...>
    ...
  </receiver>
  <application ...>
    ...
  </applciation>
</manifest>

XML:

<manifest...>
  ....
  <application...>
    ...
    <receiver...>
      ...
    </receiver>
  </application>    
</manifest>

, !

+6

. , , SD-. .

+4

ran into a similar problem. I put metadata outside the recipient that you already did right in the first place.

0
source

All Articles