How to get XML using AsyncTask and Timer?

后端 未结 5 907
星月不相逢
星月不相逢 2020-12-15 01:44

In order to get XML data from a server repeatedly, I\'m attempting to use AsyncTask and Timer as per Mark Murphy\'s suggestion.

I get the following error:

         


        
5条回答
  •  温柔的废话
    2020-12-15 02:48

    I'd use the service with alarm manager

       I    Intent updateIntent = new Intent(ACTION_UPDATE_ALL);
            updateIntent.setClass(this, UpdateService.class);
            PendingIntent pendingIntent = PendingIntent.getService(this, 0, updateIntent, 0);
            AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
            alarmManager.set(AlarmManager.RTC, nextUpdate, pendingIntent);
    

提交回复
热议问题