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

  • Home
  • SEARCH
  • 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 6058531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:36:34+00:00 2026-05-23T08:36:34+00:00

Let say that I have two Activity to develop in Android. Upon the end

  • 0

Let say that I have two Activity to develop in Android. Upon the end user click a button in Activity A, the application supposed to pull data off a JSON API and present that information on Activity B.

So my question is, what’s the best practice or pattern? i.e.

  1. Activity A will call an AsyncTask and perform JSON call. Pull the data, push it into the Intent via putExtra, and call Activity B?
  2. Activity A will call Activity B, Activity B onCreate will call an AsyncTask and perform the JSON call?
  3. Other suggestions?

Which one is the prefer pattern?

And which gives better user experience? (e.g. imagine where the error dialog will be if connection fail to the server.)

  • 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-23T08:36:35+00:00Added an answer on May 23, 2026 at 8:36 am

    I think normally something of your #2 approach is done. In most cases, though, you need to tell Activity B what type of information to request from the JSON API. So say in Activity A you are choosing an item from a list, and Activity B will get more information about that item. In this example Activity A will simply pass a reference to which item was selected, and then Activity B can use that reference to make a JSON request for more information about that item. Does that make sense?

    I usually try to pass as little information as I can in Intent extras so I would steer clear of your first solution.

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

Sidebar

Related Questions

Let's say that I have a site where once the user selects a few
Let's say that I have written a custom e-mail management application for the company
Let us say that I have two Xcode projects open on a Mac and
Let's say that I have two .Net applications running on a single machine. Both
Let's say that I have two links. <li><a href=# id=VALUE1 class=charName>Name 1</a></li> <li><a href=#
Let just say that we have two classes, A and B . Here is
Let say that I have a website with some information that could be access
Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12,
Let's say that you have overridden an object's equals() and hashCode() methods, so that
Let's say that I have a widget that displays summary information about how many

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.