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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:49:09+00:00 2026-06-04T07:49:09+00:00

I have 4 TextViews , 2 ImageViews , 2 Buttons and 2 widgets that

  • 0

I have 4 TextViews, 2 ImageViews, 2 Buttons and 2 widgets that are part of a row definition in a ListView. The data comes from XML and a SimpleAdapter. To access these TextViews I implement the ViewBinder in a custom class and override the setViewValue. This works and the two TextViews I want to dynamically change are handled in the setViewValue. What is confusing to me is why my other two TextViews don’t get passed through setViewValue. I say this based upon setting a breakpoint where the execution thread only enters twice. I was expecting to see it 4 or more times?

Here is the setViewValue where I have a breakpoint set.

@Override     
public boolean setViewValue(View view, Object data, String text)
{
    if(view.getId() == R.id.txtvw1)
    {             
//blah do some stuff
    }
    else if (view.getId() == R.id.txtvw2)
    {
//Blah do some stuff
    }

    return true;
} 

xml declaration of the TextViews(1 shows and 4 doesn’t):

<TextView
        android:id="@+id/txtvw1"
        android:layout_centerHorizontal="true"
        android:layout_width="185dp"
        android:layout_height="25dp"
        android:textSize="20sp"
        android:layout_marginTop="60dp"
        android:gravity="center"
        android:inputType="none"
        android:text="@string/str_StaticA"
        android:textColor="#C0F700" />

    <TextView
        android:id="@+id/txtvw4"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="35dp"
        android:layout_width="95dp"
        android:layout_height="50dp"
        android:textSize="18dp"
        android:layout_marginTop="110dp"
        android:gravity="center"
        android:inputType="none"
        android:text="IMHO:"
        android:textColor="#FFBA19" />

So in summary why does the execution enter the override only twice AND it just so happens to be the exact two I want to update?

Well through additional reading and deductive reasoning a few more pieces of information have come to light. In my mind ever View in the ListView row XML would pass through the ViewBinder but that was WRONG! From what I can figure you attach the ViewBinder to the DataAdapter via setViewBinder. Well since the DataAdapter is told what View(s) to use to populate the data in it it makes sense that only the two were showing. I was only revealing two to it.

Here is a snippet where I specify the Views involved in the populating process and pass them on the constructor of the DataAdapter:

String[] from = new String[] {"txtvw_PrevLift", "txtvw_PrevReps", "ActuLiftPikr", "ActulRepsPikr" };
int[] to = {R.id.txtvw_PrevLift, R.id.txtvw_PrevReps, R.id.ActuLiftPikr, R.id.ActulRepsPikr };

LiftDataAdapter LiftDataAdapter = new LiftDataAdapter(this, LiftDataMaps, R.layout.liftdatalayout, from, to);

While this seems to make sense I don’t know that my deductive reasoning is accurate. Will update as I find more information.

  • 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-04T07:49:10+00:00Added an answer on June 4, 2026 at 7:49 am

    If you set a ViewBinder on SimpleAdapter all the Views you declared(in the to array in your case) will be passed to the ViewBinder‘s setViewValue() method no matter what. If the setViewValue method doesn’t return true meaning the data binding for that View has failed(for whatever reason) then you get the default action(for a TextView), setting the text from the data Hashmap. Right now you declared the setViewValue to do something for only two TextViews(checking by their ids) and also to return true no matter what. When you’ll enter the setViewValue for the other Views in your row layout you’ll again enter the setViewValue, don’t match the ids(so no updates for those Views) and return true(which will tell the adapter that the binding was successful and this View doesn’t require any more work). A look at the source code for the SimpleAdapter.bindView method will show you how the ViewBinder is used.

    Also, I see that you use a custom adapter, are you sure you don’t interfere with the normal SimpleAdapter logic?(also don’t use the same name for the class and variable name)

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

Sidebar

Related Questions

I have a fairly complex layout (containing RelativeLayouts, TextViews and ImageViews) that I want
I have multiple textviews in main.xml <LinearLayout... > <textview adndroid:tag=A> ... till to Z.
I' have a view that contains several textViews an ImageView and a Button .
I have a PopupWindow that has tow buttons inside of it. They work as
I have created a custom listview using adapter. Each row of the list view
I have a listview with a custom adapter, the adapter contains two TextViews and
I have a simple ListView and on that ListView I have placed a number
I have Radio buttons that are created dynamically. LinearLayout linLayRoot = (LinearLayout)dialogView.findViewById(R.id.dialog_layout_root); RadioGroup radGp
I have query in dynamic listview buttons. I have 2 buttons in my dynamic
I have ImageViews and TextViews in my layout (activity is inside a Tab), and

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.