Programmers learn & share
0 votes

Problem :

I am getting bellow in Android Studio

java.lang.runtimeexception: an error occurred while executing doinbackground()

by (6.9k points)   | 194 views

1 Answer

0 votes


1.I think you must be running the AsyncTask as bellow which is not correct:

new MyAsyncTask().execute(); 

2.which clearly suggests that you are not passing any argument to it.

3.And in  doInBackground method you must be trying to get a value as bellow

 String newstr=args[0];

but args array has length 0.

So you are facing issue.

4. You need to start the AsycTask as bellow to resolve your issue:

new MyAsyncTask().execute(yqlURL);

Further Readings:

by (36.1k points)  
edited by
2,227 questions
2,734 answers
241 users