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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:42:15+00:00 2026-05-27T16:42:15+00:00

I have an application which contains TextViews and ImageButtons organized in various layouts. This

  • 0

I have an application which contains TextViews and ImageButtons organized in various layouts.

This application receives data from a server and this data is used to fill in TextViews and change ImageButtons icons.

The screen shows the data of a single agent and the system must support multiple agents (let’s say two for simplicity, foreground and background).

I have to provide a menu to choose of which agent to display data on the Views (when foreground and background agents are switched, I need to show the latest values I received for the ex-background agent).
Only the data of a single agent can be displayed at any given time on the screen and I cannot use multiple activities.

This problem may have many solutions, but I’m looking for a smart design which can allow me to save some time during development.

A base attempt:

  • Do not duplicate Views, only duplicate content (icon status, strings…)
  • Every time an update for an agent is received, save it in the data structure of that agent (do not miss “background” agent data)
  • Only update the views for the current “foreground” agent
  • When the user requests an agent switch (display data of the background agent), update all the views with the content of the new “foreground” agent by calling a function which calls all the functions I use to update the views when a new value is received

A desired attemp:

  • Have a single Layout of the GUI which contains all the views for an agent, for each agent
  • Hide/Show this maxi layout when agent switch is required

However I do not know exactly how to implement this: is this feasible? Do you have any suggestions?

  • 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-27T16:42:16+00:00Added an answer on May 27, 2026 at 4:42 pm

    This is how I decided to design the software.
    With two classes I made a clean design which is very easy to use, with a small compromise on the maintenance side, but still highly usable.

    The first class (classA) stores, for each agent, the value to display for each view of the GUI.
    So, if I know the current foreground agent (state variable of the application), I can access a map<agentId, classA> and get the value for each view.
    Similarly, when a new value is received, I just store it into the classA object of the related agent.

    The second class (classB) is in charge of updating each GUI element, so:

    • It stores the reference to each view object of the GUI
    • It stores a reference to the map<agentId, classA>
    • For each GUI element, it has a method to update it which takes a agentId parameter to access the right classA object from where the right value is retrieved
    • It has a single updateAll method which calls every update method (used when an agent switch is required)

    Usage example

    When a new data for an agent is received i just do the following (pseudocode):

    newBloodPressureValue(agentId, value) {
        [map<agentId, classA>].get(agentId).setBloodPressureValue(value)
        if (agentId is foregroundAgent)
            classB.updateBloodPressureField(agentId)
    }
    

    Design advantages:

    • It let me use a single activity
    • It let me design the GUI layout statically through the XML file
    • It easily supports multiple agents

    Design disadvantages:

    • If a GUI item must be added, three point must be edited: reference in classB members, update method, update method call in updateAll method

    Comments, critics, suggestions are highly appreciated.

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

Sidebar

Related Questions

we have a delphi application which contains a TXTextControl (v. 13.0). This application uses
I have an application which is supposed to retrieve data from a Website every
I have an EAR application which contains an MDB and a WAR. In this
We have an existing big application which contains a lot of data. We'd like
I have a web application which contains both secure (SSL) and non-secure pages. A
I have a winform application which contains a window resizable but one requirement is
I have my main application delegate which contains a method that returns an object.
I have a user control in my wp7 application which contains two text boxes
A simple question. I have an ASP.NET web application which contains several assemblies and
In my console application have an abstract Factory class Listener which contains code for

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.