1. Are you ready for the Galaxy S20? Here is everything we know so far!

Main Thread Question

Discussion in 'Android Development' started by rick smith, Nov 21, 2021.

  1. rick smith

    rick smith Lurker
    Thread Starter

    Quick question wanted to verify this handler would be running in the main thread and not a background thread.
    Trying to keep the send() function in the background

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.fu);
    map = false;
    // Send Telm and Update HP Dist
    Handler handlert = new Handler();
    handlert.postDelayed(new Runnable() {
    @override
    public void run() {
    if (gpsrunning == 1 && !isNaN(gpsla) && !isNaN(gpslo)) {
    send();
    }
    handlert.postDelayed(this, 1000);
    }
    }, 1000);
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...