Create a Timer to send HTTP request Periodically - Android

android

Solution

public class MyActivity extends Activity {
Timer t ;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    t = new Timer();
    t.schedule(new TimerTask() {

        public void run() {


            //Your code will be here 

        }
      }, 1000);

   }
}

Problem

I want to end HTTP request from a Android device to a web server and check a particular data of a database periodically (once a minute). I couldn't implement a timer for this. Thanks

Original source

Related problems