I am developing a program which have 2 buttons : Start and End. When i click Start it will start to get Locations in every 30sec. and send them to a server using socket connection. When i click the End button it will stop all works.
Can i do this without using thread? If i need to use threads what is the best way to implement it. Should i listen LocationProvider with LocationListener to get locations every 30sec and send them in a thread or should i create connection thread and get location in every and send.
I am developing a program which have 2 buttons : Start and End. When
Share
If you make a connection in the UI main thread, you application will become unresponsive until the connection is terminated, which is wrong!!! You have to create a thread for each connection you establish, this is strongly recommended.
You will have to create a thread that will sleep for 30 seconds each time and then do the work that you said.
Your work should be done in threads, do not use the main thread for these things