Note that there are some explanatory texts on larger screens.

plurals
  1. POServices and Broadcast Receivers
    primarykey
    data
    text
    <p>I just want to know if I have to declare a class that extends a service in my manifest?</p> <pre><code>&lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;receiver android:name="com.cherise.readerwidget.MyWidgetProvider" &gt; &lt;intent-filter&gt; &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_info" /&gt; &lt;/receiver&gt; &lt;service android:name="com.cherise.readerwidget.UpdateWidgetService" android:enabled="true" android:exported="true" &gt; &lt;/service&gt; &lt;/application&gt; </code></pre> <p>In this class, I have an AsyncTask that does HttpConnections.</p> <p>It doesnt seem to update my widget in the post execute.</p> <p>Please help</p> <pre><code> protected void onPostExecute(String details) { for(int widgetId : allWidgetIds) { RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.widget_layout); //remoteViews.setTextViewText(R.id.update, news.get(0).getTitle()); remoteViews.setTextViewText(R.id.update, "Bloemfontein: " + details + " F"); Intent clickIntent = new Intent(getApplicationContext(), MyWidgetProvider.class); clickIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); clickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, allWidgetIds); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, clickIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.update, pendingIntent); appWidgetManager.updateAppWidget(widgetId, remoteViews); } stopSelf(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload