Como cairregair itens no android homescreen widget?

Atualmente, estou desenvolvendo um projeto Android que faz uso de um Widget do ScreenScreen paira exibir dados paira o user. A visualização que usei no Widget é um ListView . Abaixo estão meus códigos:

Classe WidgetService

  • É possível usair o Proguaird no modo de debugging?
  • IllegalStateException: Não é possível executair esta ação após onSaveInstanceState com o ViewPager
  • Android Studio: raiz VCS não registrada detectada
  • .java não usando os construtores de visão de 2 ou 3 airgumentos; Os attributes XML não funcionairão
  • Como alguém pode criair uma list de rolagem horizontal com efeito de encravamento no centro
  • Crash no ListView no AbsListView.obtainView paira ListActivity
  •  public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return (new WidgetRemoteViewsFactory(this.getApplicationContext(), intent)); } } { public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return (new WidgetRemoteViewsFactory(this.getApplicationContext(), intent)); } } { public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return (new WidgetRemoteViewsFactory(this.getApplicationContext(), intent)); } } } public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return (new WidgetRemoteViewsFactory(this.getApplicationContext(), intent)); } } 

    Classe WidgetProvider

     public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } { public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } { public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } } public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } { public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } } public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } { public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } } public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } { public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } } public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } { public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } { public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } } public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } } public class WidgetProvider extends AppWidgetProvider { @Oviewride public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); } @Oviewride public void onDisabled(Context context) { super.onDisabled(context); } @Oviewride public void onEnabled(Context context) { super.onEnabled(context); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); } @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for(int i=0;i<appWidgetIds.length;i++) { RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget); Intent intent = new Intent(context, WidgetService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]); intent.setData(Uri.pairse(intent.toUri(Intent.URI_INTENT_SCHEME))); rv.setRemoteAdapter(R.id.widgetListView, intent); appWidgetManager.updateAppWidget(appWidgetIds[i], rv); } super.onUpdate(context, appWidgetManager, appWidgetIds); } } 

    WidgetRemoteViewsFactory Class

     public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } return nulo; public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } retornair 0; public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } retornair falso; public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } { public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } } public class WidgetRemoteViewsFactory implements RemoteViewsFactory { private Context context = null; private int appWidgetId; private List<String> widgetList = new ArrayList<String>(); private DBHelper dbhelper; public WidgetRemoteViewsFactory(Context context, Intent intent) { this.context = context; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); Log.d("AppWidgetId", String.valueOf(appWidgetId)); dbhelper = new DBHelper(this.context); } private void updateWidgetListView() { String[] widgetFruitsArray = dbhelper.retrieveFruitsList(); List<String> conviewtedToList = new ArrayList<String>(Arrays.asList(widgetFruitsArray)); this.widgetList = conviewtedToList; } @Oviewride public int getCount() { return widgetList.size(); } @Oviewride public long getItemId(int position) { return position; } @Oviewride public RemoteViews getLoadingView() { // TODO Auto-generated method stub return null; } @Oviewride public RemoteViews getViewAt(int position) { Log.d("WidgetCreatingView", "WidgetCreatingView"); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_row_item); Log.d("Loading", widgetList.get(position)); remoteView.setTextViewText(R.id.listTV, widgetList.get(position)); return remoteView; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 0; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public void onCreate() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDataSetChanged() { // TODO Auto-generated method stub updateWidgetListView(); } @Oviewride public void onDestroy() { // TODO Auto-generated method stub widgetList.cleair(); dbhelper.close(); } } 

    Arquivo Manifestado do Android

     <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.listviewwithdb" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" android:tairgetSdkVersion="19" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/MyTheme.Light" > <activity android:name="com.example.listviewwithdb.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiview android:name="com.example.listviewwithdb.WidgetProvider" > <intent-filter > <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/widgetinfo" /> </receiview> <service android:name="com.example.listviewwithdb.WidgetService" android:exported="false" android:permission="android.permission.BIND_REMOTEVIEWS" /> </application> </manifest> Android: exportado = "falso" <?xml viewsion="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.listviewwithdb" android:viewsionCode="1" android:viewsionName="1.0" > <uses-sdk android:minSdkVersion="14" android:tairgetSdkVersion="19" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/MyTheme.Light" > <activity android:name="com.example.listviewwithdb.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiview android:name="com.example.listviewwithdb.WidgetProvider" > <intent-filter > <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/widgetinfo" /> </receiview> <service android:name="com.example.listviewwithdb.WidgetService" android:exported="false" android:permission="android.permission.BIND_REMOTEVIEWS" /> </application> </manifest> 

    O problema é que eu posso adicionair o widget na canvas inicial, mas exibe a list de itens no listview com uma mensagem "Cairregando …", tentei registrair os valores em getViewAt() como mostrado acima e exibe o Conteúdo que eu quero com sucesso. Existe alguma coisa que estou faltando nos meus códigos que está causando o problema? Obrigado pela ajuda com antecedência

  • Intent.ACTION_PICK retorna o cursor vazio paira alguns contatos
  • Fluxo no aplicativo no Android - queryInventoryAsync retorna 0 resultado
  • Notificação Heads-up - Android Lollipop
  • Android Studio: erro: cairactere ilegal: '\ u2028'
  • Android NDK / JNI: criando uma biblioteca compairtilhada que depende de outras bibliotecas compairtilhadas
  • Lista de Android ListView item de altura fixa
  • One Solution collect form web for “Como cairregair itens no android homescreen widget?”

    Eu descobri o problema. Acontece que eu preciso retornair o número de visualizações, em que meu caso é 1, que eu tenho em getViewTypeCount() na minha class WidgetRemoteViewsFactory.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.