0

I'm new to android development but experienced in iOS development. I see there are several purpose built classes for network communication.

I need to make several network connections in synchronous order, but of course dispatch them on a background thread asynchronously. I was planning to wrap everything in a Thread runnable instead of using AsyncTask or Volley.

Are there going to be any issues with this? Or any good reasons not to do it?

new Thread(new Runnable() {
        public void run() {

               // Run all my network connections in synchronous order here

        }
    }).start();

Thank-you for your time!

Wapiti
  • 80
  • 1
  • 9

1 Answers1

0

No, other than possibly needing to write some stuff yourself.

AsyncTask is a Thread. It just has some code wrapped around it to make posting results to the UI thread easy.

Volley is a 3rd party library. I have no clue what they use under the hood, but it will either be an AsyncTask or Thread.

So if you have some special use case that makes a Thread more convenient, go for it. In fact its pretty common if you're doing direct socket IO.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127