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 8543423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:17:53+00:00 2026-06-11T12:17:53+00:00

I have an AsyncTask which retrieves data from a server and then needs to

  • 0

I have an AsyncTask which retrieves data from a server and then needs to start a new Activity to display the data.

doing this within the ASync onPostExecute works… (but doesn’t start the new activity)

setContentView(R.layout.activity_list);
TextView textListDate = ((TextView)findViewById(R.id.textListDate));
textListDate.setText(FormatUtilities.formatDateLong(list.getDateFor()));

doing this results in a null pointer exception (due to TextListDate being null

Intent in = new Intent(super.getAppContext(), List.class);
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
super.getAppContext().startActivity(in);
TextView textListDate = ((TextView)findViewById(R.id.textListDate));
textListDate.setText(FormatUtilities.formatDateLong(list.getDateFor()));

and doing this results in a screen loading with what i want, and then being blanked almost immediatley…

Intent in = new Intent(super.getAppContext(), List.class);
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
super.getAppContext().startActivity(in);
setContentView(R.layout.activity_list);
TextView textListDate = ((TextView)findViewById(R.id.textListDate));
textListDate.setText(FormatUtilities.formatDateLong(list.getDateFor()));

any suggestions on what I am missing? I assume it is something to do with findViewById trying to access the view of the “current” activity and not the new one…

Do i somehow need to pass my data to the new Activity and do the findViewById inside the next activity?

thanks for the help.

  • 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-06-11T12:17:54+00:00Added an answer on June 11, 2026 at 12:17 pm

    1)- You should save your data in ArrayList or according to the response from server, And put that data with key,value pair with intent , and then retrieve that intent in next Activity.
    2)- Now you can display that data in desired place i.e. Listview,Text view etc.

    thanks

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

Sidebar

Related Questions

I have an Activity that retrieves data from a web service. This data is
i have a code which download the apk from server by using Asynctask, Currently
I have a Service downloading data every second from a web server (This Service
I have created an app which retrieves the data from a url using xml
I have an app that needs to pull data from a server and insert
I have an Android application which retrieves information from the web using an AsyncTask
I have the following asynctask class which is not inside the activity. In the
I have an Activity class which has an attribute that references an AsyncTask instance
I have a class that extends AsyncTask , which fetches the gps cordinates from
I have some problem with Android AsyncTask. There is an Activity which contains some

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.