Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio debug for doInBackground code of an AsyncTask [closed]

I put some break points in my doInBackground() code of AsyncTask class. But when I am debugging the application, control is not going over doInBackground(). Please help me regarding this.

like image 304
Ramachandra Reddy Avula Avatar asked Jun 10 '14 10:06

Ramachandra Reddy Avula


1 Answers

Put the following code fragment in the beginning of doInBackground:

android.os.Debug.waitForDebugger();

Then when you set a breakpoint in that thread, eclipse will find it.

In your emulator,

  • Go to Dev Settings`.
  • Click on Select Debug App
  • Select the app which you are going to debug
  • The checkbox "Wait for Debugger" will be enabled. Check this checkbox

Now try running the app again.

like image 123
Nishanthi Grashia Avatar answered Sep 22 '22 19:09

Nishanthi Grashia