ExecutorService - How to create Background Thread in Android using Executors | AsyncTask Alternative

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ม.ค. 2025

ความคิดเห็น • 20

  • @INDE-SOFT
    @INDE-SOFT 2 ปีที่แล้ว +1

    Hello.
    I can use an ExecutorService, to send information to a database with volley, when the application has closed. I need it to send information to the database in the background..?

    • @DailyCoding
      @DailyCoding  2 ปีที่แล้ว

      Yes, if the app is in the foreground we can use this. You can use this as an alternative of AsyncTask.

    • @INDE-SOFT
      @INDE-SOFT 2 ปีที่แล้ว

      @@DailyCoding if I kill the application, will the ExecutorService continue sending information to the database or does the ExecutorService also stop...?

    • @DailyCoding
      @DailyCoding  2 ปีที่แล้ว

      It will stop working

    • @INDE-SOFT
      @INDE-SOFT 2 ปีที่แล้ว

      @@DailyCoding How can I make a process send information to the database after the application has been closed, I'm working with android 11

    • @DailyCoding
      @DailyCoding  2 ปีที่แล้ว

      @@INDE-SOFT what about the Service? Use it.

  • @m.e.ssofttech2806
    @m.e.ssofttech2806 2 ปีที่แล้ว +1

    How to perform all methods async task such as PreExecute(),doInBackground(),onProgress() and postExecute()

    • @DailyCoding
      @DailyCoding  2 ปีที่แล้ว

      Great question but already made a separate video to answer this question. Check out the playlist or video description.

  • @SumanDas-ey8ro
    @SumanDas-ey8ro 2 ปีที่แล้ว +1

    Terrific 👌😊

  • @iceapps1256
    @iceapps1256 2 ปีที่แล้ว

    Great video Yar

  • @intecdown6145
    @intecdown6145 ปีที่แล้ว

    What's up, I consume many apis to populate my database and I use synchronize in each thread with AsyncTask, my question is how can I achieve it this way?

    • @DailyCoding
      @DailyCoding  ปีที่แล้ว +1

      Just place database or dao code inside the run method of the executor service.

  • @rishabh7022
    @rishabh7022 2 ปีที่แล้ว +1

    Nice video!!!

  • @arshadrayyan5410
    @arshadrayyan5410 2 ปีที่แล้ว

    If we need to update more ui in main thread instead of handler and UI thread instead of that anything is available for update UI?

    • @DailyCoding
      @DailyCoding  2 ปีที่แล้ว

      If you are doing long running work in the background then use ResultReceiver or Broadcast Receiver to update the UI.

  • @getachewsharew5904
    @getachewsharew5904 2 ปีที่แล้ว

    Excellent ! specially with out using the library (Glid)