How to call and execute a function without blocking the application android (this is the location function).
I know I must use the thread but I do not know how, I hope to have a code ready.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the following to run code on a separate (non-UI) Thread:
This creates a new Thread (and corresponding Runnable which contains the code to be run inside its
run()method ) and starts it — calling the code in the Runnable.Alternatively, you could look into
AsyncTask(more info here) which avoids using Threads directly.