Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid widget that download and prints bitmaps don't work
    primarykey
    data
    text
    <p>I need to create a widget that will download on the sdcard some bitmaps every minute and will print them on the screen. i have tried to do with </p> <pre><code>private class MyTime extends TimerTask </code></pre> <p>but is don't work. the widget don't update:( the images have 30K in total. can you help me with this i need only a sample of the code and where i can put my code for the widget to work. this is the code:</p> <pre><code>public class MyWidget extends AppWidgetProvider { public int tt=0; @Override public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds ) { if(tt==0) { Timer timer = new Timer(); timer.scheduleAtFixedRate(new MyTime(context, appWidgetManager), 1, 10000); tt=1; } } private class MyTime extends TimerTask { RemoteViews remoteViews; AppWidgetManager appWidgetManager; long t=0,lastUpdate=0; ComponentName thisWidget; public MyTime(Context context, AppWidgetManager appWidgetManager) { this.appWidgetManager = appWidgetManager; remoteViews = new RemoteViews(context.getPackageName(), R.layout.main); thisWidget = new ComponentName(context, MyWidget.class); } @Override public void run() { DateFormat dateFormat = new SimpleDateFormat("dd/MM HH:mm"); //get current date time with Date() Date date = new Date(); remoteViews.setTextViewText(R.id.Clock,dateFormat.format(date)); appWidgetManager.updateAppWidget(thisWidget, remoteViews); if(t==0 || t + 100000&lt;=System.currentTimeMillis()) { checkUpdate(); display(); t=System.currentTimeMillis(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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