I have a String variable that is declared and edited in the Main Activity.
I would like it to be display in a widget, but not sure how.
In the Widget file I have:
remoteViews.setTextViewText(R.id.widgetAmount, String.valueOf(number))
but the number variable is declared in another class.
You should send a
Broadcastusing anIntent, that contains the value you want to display in your App Widget. Create anIntentand add the value:Now in your
AppWidgetProviderclass’s onReceive you can access this value:Hope this helps.