Android Open Source - AppSearchWidget News Widget Provider






From Project

Back to project page AppSearchWidget.

License

The source code is released under:

Apache License

If you think the Android project AppSearchWidget listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.testwidget;
/*from w  ww.  ja  va 2 s  . c  om*/
import android.app.PendingIntent;
import android.app.Service;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.widget.RemoteViews;

public class NewsWidgetProvider extends AppWidgetProvider {
  @Override
  public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);
    
    if (intent.getAction().equals(Constants.NEW_ITEMS_INTENT)) {
      Log.i(TAG, "New items available.");
      CharSequence[] newItems = intent.getCharSequenceArrayExtra("newItems");
    }
  }

  private static String TAG = "NewsWidgetProvider"; 
  
  @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager,
      int[] appWidgetIds) {
    Log.i(TAG, "onUpdate called");

    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.news_widget_layout);
    Intent helloClickedIntent = new Intent(context, InputHandlerService.class);
    helloClickedIntent.putExtra("buttonClicked", "btnHello");
    PendingIntent helloClickedPendingIntent = PendingIntent.getService(context, 0, helloClickedIntent, 0);
    views.setOnClickPendingIntent(R.id.btnHello, helloClickedPendingIntent);

    Log.i(TAG, "Set pending click handling intent 2");
    
    
    appWidgetManager.updateAppWidget(appWidgetIds, views);
  }
  
  
}




Java Source Code List

com.example.testwidget.AppLaunchCountComparator.java
com.example.testwidget.AppLaunchIntentService.java
com.example.testwidget.AppLaunchTimeComparator.java
com.example.testwidget.AppListRemoteViewsService.java
com.example.testwidget.AppListViewFactory.java
com.example.testwidget.AppSearchService.java
com.example.testwidget.ApplicationListItem.java
com.example.testwidget.Constants.java
com.example.testwidget.InputHandlerService.java
com.example.testwidget.KeyImageButton.java
com.example.testwidget.KeyInputHandler.java
com.example.testwidget.KeyboardMode.java
com.example.testwidget.LaunchCountBookKeeper.java
com.example.testwidget.LaunchStats.java
com.example.testwidget.LetterIntent.java
com.example.testwidget.LettersWidgetProvider.java
com.example.testwidget.MainActivity.java
com.example.testwidget.NewsWidgetProvider.java
com.example.testwidget.ResourceAlphabetMapEnglish.java