Search Results

Search found 3 results on 1 pages for 'jmontex2'.

Page 1/1 | 1 

  • Updating Android Home Screen TextView

    - by jmontex2
    Hi, How can we update the View of a Home Screen Widget on the onReceive method of AppWidgetProvider?. I am trying to update the TextView of my Home screen widget but it seems that I cant access the TextView of my AppWidgetProvider on onReceive method. Here is a sample code of my onReceive public void onReceive(Context context,Intent intent) { final String action = intent.getAction(); if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) { final int appWidgetId = intent.getExtras().getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { this.onDeleted(context, new int[] { appWidgetId }); } } else { if (intent.getAction().equals(ACTION_WIDGET_RECEIVER)) { String msg = "null"; try { msg = intent.getStringExtra("msg"); } catch (NullPointerException e) { } Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); // code for gathering the text to update the TextView } } super.onReceive(context, intent); }

    Read the article

1