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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:41:00+00:00 2026-06-14T03:41:00+00:00

Imagine there is a MainActivity in which there is a ListView with an ArrayAdapter

  • 0

Imagine there is a MainActivity in which there is a ListView with an ArrayAdapter. In the views that belong to the MainActivity I update the data directly; for example, in my PageAdapter class:

@Override
public void finishUpdate(View arg0) {
    ViewPager vp = (ViewPager) arg0;
    if (vp.getCurrentItem() != this.current_item){
        this.current_item = vp.getCurrentItem();
        ContentStatus status;
        switch(vp.getCurrentItem()){
        case(0): 
            status = ContentStatus.NOTINTERESTING;
            break;
        case(2): 
            status = ContentStatus.INTERESTING;
            break;
        default: 
            status = ContentStatus.ACTIVE;
        }
        MainActivity.content.setItemStatus(content.identifier, status);
        final Activity act = (Activity) this.context;
        ArrayAdapter adapter = (ArrayAdapter) ((ListView) act.findViewById(R.id.view_sequence)).getAdapter();
        adapter.notifyDataSetChanged();
    }
}

I need to reproduce this code in another activity which opens from the MainActivity and uses the same data, because if the user changes some data from the other activity and then closes it and returns to the MainActivity I must redraw MainActivity‘s views. As a variant, should I use Activity‘s onResume() method to update all views that haves bindings to data?

  • 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-14T03:41:01+00:00Added an answer on June 14, 2026 at 3:41 am

    should I use activitie’s onResume method to update all views that haves bindings to data?

    Short answer? Yes – if your activity’s view state might change every time the activity is paused and resumed, then it makes sense to update them all on a resume. This is more in line with the ‘android way’ if you will – two activities should not affect each other unless they are somehow working with the same data. If they are working with the same data, You might consider making your second activity a Fragment instead; that way all operations related to that bit of data are tied to a single activity with multiple fragments.

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

Sidebar

Related Questions

Imagine there is a jar (named lib.jar ) that contains a single class and
Imagine this scenario: in our company there is an employee that play around graphic,css,html
I would like to ask you: Imagine that you have a site and there
Good morning all. Is there any jsf control that escapes the html tags? Imagine
Imagine there's a picturebox which loads a monochrome image. And there is a need
I've got a vector of samples that form a curve. Let's imagine there are
imagine there is an sql and in some part of that SP, there is
Imagine you have those 3 tables: And imagine there is massive data according to
Imagine there is a Customer class with an instance Load() method. When the Load()
Imagine there is an arbitrary set of strings. We now suppose that they are

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.