[Solved] I am trying to parse a data from the following link

Thank You Everyone for Helping out. But I found my answer from the search over the internet. Here I used VOLLEY to call the link. JSON PARSER CLASS public class ParseJSON { public static String[] position1; public static String[] team; public static String[] points; public static final String JSON_ARRAY = “data”; public static final String … Read more

[Solved] @Override error after adding public interface OnTaskCompleted

According this code you will get null pointer exception. because you have not assign the listener in code. public class saveData extends AsyncTask < List < String > , Void, Void > { private OnTaskCompleted listener; boolean myflag = false; @Override public void onPreExecute() {} @Override protected Void doInBackground(List < String > …params) {} @Override … Read more

[Solved] android FATAL EXCEPTION: AsyncTask #2 [closed]

URI website = new URI(“http://example=” + et.getText() + “json”); You didn’t connect your EditText et with it’s view. So et.getText will give you an error. URI website = new URI(“http://example=” + et.getText() + “json”); change it to URI website = uRI; and pass your URI while processing doInBackground like – String uRI = “http://www.example.com/example.json”; JSONObject … Read more

[Solved] IllegalArgumentException: width should be > 0?

Without any code from your end, what I can suggest is to do something like : recyclerView.post(new Runnable() { @Override public void run() { // Execute your AsyncTask here by providing Width } }); Because the problem I can guess is your RecyclerView is not properly inflated when you call the AsyncTask with width Also … Read more

[Solved] Why not do all the operations in the main thread(Android)? [closed]

From the docs: When an application is launched, the system creates a thread of execution for the application, called “main.” This thread is very important because it is in charge of dispatching events to the appropriate user interface widgets, including drawing events. In other words, ALL UI-related tasks occur on the same thread, and it … Read more

[Solved] if i run method in doinbackgroundand when it is running i am click any button then i got error…how to solve? [closed]

Here is my guess. Cannot be very specific unless you post the codes: In the doInBackground method, it calls MainActivity.addToListview method, which modifies UI and some object isn’t ready yet. The null object may depend on your async task finishing or you forgot to set it up? 1 solved if i run method in doinbackgroundand … Read more

[Solved] passing string data from onPostExecute method of AsyncTask to other activity

In my opinion two options are available on the table! 1.Create your AsyncTask class as an inner class inside your Activity class, and then you can gain access for all super class properties. public class MyActivity extends Activity { int property1; void method1() { } private class MyTask extents AsyncTask<Void, Void, Void> { @Override protected … Read more

[Solved] Why is my app is crashing while using async task?

You are Calling Activity in a Background Thread Thats Why you are getting Error You Need to Call Like this Thread thread=new Thread(){ @Override public void run() { try { sleep(5*1000); runOnUiThread(new Runnable() { @Override public void run() { Intent i = new Intent(getApplicationContext(),MainActivity2.class); startActivity(i); } }); } catch (Exception ex) {} } }; thread.start(); … Read more