Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:19:22+00:00 2026-05-30T10:19:22+00:00

I am using an AsyncTask to get the data and then loading it into

  • 0

I am using an AsyncTask to get the data and then loading it into a ListView. My code is :

AsyncTaskTwitterFeeds asyncTaskTwitterFeeds = new AsyncTaskTwitterFeeds(TwitterFeedsActivity.this);
    asyncTaskTwitterFeeds.execute("");
    loadList();

In the above code, once AsyncTask is executed, the flow, comes to loadlist() method and the program crashes. The reason I found was that the array which is used in the Adapter is still being populated. I want to know that how I can hold once AsyncTask is executed and only when its completed then flow should go to loadlist() method. Here is the LogCat error:

02-25 18:50:25.879: E/AndroidRuntime(19851): FATAL EXCEPTION: main
02-25 18:50:25.879: E/AndroidRuntime(19851): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cubix.twitterfeed/com.cubix.twitterfeed.TwitterFeedsActivity}: java.lang.NullPointerException
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.app.ActivityThread.access$1500(ActivityThread.java:132)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1033)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.os.Looper.loop(Looper.java:143)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.app.ActivityThread.main(ActivityThread.java:4196)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at java.lang.reflect.Method.invokeNative(Native Method)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at java.lang.reflect.Method.invoke(Method.java:507)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at dalvik.system.NativeStart.main(Native Method)
02-25 18:50:25.879: E/AndroidRuntime(19851): Caused by: java.lang.NullPointerException
02-25 18:50:25.879: E/AndroidRuntime(19851):    at java.util.Arrays$ArrayList.<init>(Arrays.java:47)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at java.util.Arrays.asList(Arrays.java:169)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.widget.ArrayAdapter.<init>(ArrayAdapter.java:125)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at com.cubix.twitterfeed.TwitterAdapter.<init>(TwitterAdapter.java:17)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at com.cubix.twitterfeed.TwitterFeedsActivity.loadList(TwitterFeedsActivity.java:48)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at com.cubix.twitterfeed.TwitterFeedsActivity.onCreate(TwitterFeedsActivity.java:30)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
02-25 18:50:25.879: E/AndroidRuntime(19851):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1780)
02-25 18:50:25.879: E/AndroidRuntime(19851):    ... 11 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:19:24+00:00Added an answer on May 30, 2026 at 10:19 am

    AsyncTask has a method onPostExecute() that executes on the main UI thread after the AsyncTask has finished its job in the method doInBackground(). You could use that method to populate the list if loadList() is called to populate the list with the results from the AsyncTask.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using AsyncTask to get data from a server and want to show
I'm using AsyncTask and some pretty common Android code to get the contents of
I have a listview that's populated by rows that get their data from a
I'm using AsyncTask s to fetch data in response to the user pressing a
I have 2 spinner, each spinner's data loaded from database using AsyncTask i call
I'm trying to get html content. Everything works in AsyncTask thread. This is my
This is related to my previous post Problem with downloading multiple files using AsyncTask
I parse XML data and put it into an object. This takes fairly long
I am using an Intent to Broadcast data from a AsyncTask thread back to
With 3.0 we got the fancy LoaderManager , which handles data loading using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.