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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:58:37+00:00 2026-05-28T01:58:37+00:00

Index , Gainers , Losers are the 3 buttons . On each button click,

  • 0

Index,Gainers,Losers are the 3 buttons.
On each button click, listView gets populated with corresponding data.

3rd column %Chg can be negative or positive.

Based on value of %Chg value, corresponding arrow should be displayed in imageView placed after %Chg column value i.e. up arrow for positive value and down arrow for negative value …

On any button click, I’m passing value of %Chg column in an array named updown to Adapter class

Based on that value, Adapter should set the down arrow or up arrow

Code snippet from Adapter class(getView() method)

public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        LayoutInflater inflater = activity.getLayoutInflater();

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.list_table, null);
            holder = new ViewHolder();

            holder.txtFirst = (TextView) convertView
                    .findViewById(R.id.FirstText);
            holder.txtSecond = (TextView) convertView
                    .findViewById(R.id.SecondText);
            holder.txtThird = (TextView) convertView
                    .findViewById(R.id.ThirdText);
            holder.ivarrow = (ImageView) convertView.findViewById(R.id.ivarrow);
            holder.l1 = (LinearLayout) convertView
                    .findViewById(R.id.tableLayout);

            convertView.setTag(holder);

        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        HashMap<String, String> map = list.get(position);
//Setting the row background
        if (count % 2 == 0) {
            try {
                InputStream is1 = ctx.getAssets().open("cellbg.png");
                Drawable d1 = Drawable.createFromStream(is1, "cellbg");
                holder.l1.setBackgroundDrawable(d1);

            } catch (Exception e) {
                throw new Error(" exception in TableListAdapter "
                        + e.getMessage());
            }
        } else {
            try {
                InputStream is2 = ctx.getAssets().open("cellbg1.png");
                Drawable d2 = Drawable.createFromStream(is2, "cellbg1");
                holder.l1.setBackgroundDrawable(d2);
            } catch (Exception e) {
                throw new Error(" exception in TableListAdapter "
                        + e.getMessage());
            }
        }
        count++;
//setting the arrow
        if (i < updown.length) {
            if (updown[i] > 0) {
                holder.ivarrow.setImageResource(R.drawable.up);
                Log.v("up", "up");
            } else {
                holder.ivarrow.setImageResource(R.drawable.down);
                Log.v("down", "down");
            }
            Log.v("i=", i + " ,updown=" + updown[i]);
            i++;
        }

        holder.txtFirst.setText(map.get(FIRST_COLUMN));
        holder.txtSecond.setText(map.get(SECOND_COLUMN));
        holder.txtThird.setText(map.get(THIRD_COLUMN));
        return convertView;
    }

.

Log is showing correct data but arrow is getting displayed in only 1st row. i.e. if Last value of list is positive, it shows up arrow to 1st row and if Last value of list is negative, it shows down arrow to 1st row…

How to display corresponding arrow to each row??

I’m new to android development. So ANY HELP WILL BE LIFE-SAVER !!!
.

screen

  • 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-28T01:58:37+00:00Added an answer on May 28, 2026 at 1:58 am
    if (i < updown.length) {
            if (updown[i] > 0) 
                holder.ivarrow.setImageResource(R.drawable.up);
            else 
                holder.ivarrow.setImageResource(R.drawable.down);
            Log.v("i=", i + " ,updown=" + updown[i]);
            i++;
        }
    

    replace your code with :

    if (updown[position] > 0) 
                holder.ivarrow.setImageResource(R.drawable.up);
            else 
                holder.ivarrow.setImageResource(R.drawable.down);
    

    And I think it Works for you

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

Sidebar

Related Questions

Depending on the clicked button out of 3 button , different data gets populated
When creating an index over a column that is going to be UNIQUE (but
Given a columns' index, how can you get an Excel column name? The problem
I want to index a computed column in my database table which uses a
Does index on a varchar column make the query run slower? I can make
In index.html.erb I display all products, and next to each product I have Edit
My index.html : <body> <select id=car> <option value=TOYOTA>TOYOTA</option> <option value=BMW>BMW</option> </select> <input type=button id=get_btn
I index.html page that post data to page1.asp page1.asp transform the data and Post
my index.php has a body column width of about 400px The single.php has a
index.html <html> <head> </head> <body> <input type=text id=inputtext><input type=button value=submit id=submit> <br> <div id=response>

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.