Android – Applying Alternate Row Color in ListView with SimpleAdapter

We have talked about how to make a ListView in Android Application using SimpleAdapter.

If you want to add different colors to the background of each row, you can create another adapter which extends the SimpleAdapter and overrides the getView() method. For example, create the SpecialAdapter.java as follow.

import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;

public class SpecialAdapter extends SimpleAdapter {
	private int[] colors = new int[] { 0x30FF0000, 0x300000FF };
	
	public SpecialAdapter(Context context, List<HashMap<String, String>> items, int resource, String[] from, int[] to) {
		super(context, items, resource, from, to);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
	  View view = super.getView(position, convertView, parent);
	  int colorPos = position % colors.length;
	  view.setBackgroundColor(colors[colorPos]);
	  return view;
	}
}

 

Instead of calling SimpleAdapter in your application, you should use the SpecialAdapter.

...
/* Use SpecialAdapter instead of SimpleAdapter
SimpleAdapter adapter = new SimpleAdapter(this,fillMaps,R.layout.grid_item,from,to);
*/
SpecialAdapter adapter = new SpecialAdapter(this,fillMaps,R.layout.grid_item,from,to);
...

 

Your final ListView will look like this

                                                                                 

You can add more colors in the colors array inside the SpecialAdapter.java if your want to create a more colorful ListView.

Done =)

Reference: Creating a ListView with Alternating Colors in Android

115 thoughts on “Android – Applying Alternate Row Color in ListView with SimpleAdapter”

  1. So brilliant and so very simple. Clear and precise and easy to follow. Well done.

    Added it to my project, so now my listview rows have some “punch” to them. Makes reading the rows nicer 😀

    Thank you and keep up the good work.

    Like

  2. I hava a problem with this,if you get more items (for example 50)to show, and then how to implement this view (request selected color with seleted item). Need you help,thank you.
    xm form china

    Like

    1. Hi Xianming,

      Do you mean u want to apply different colors on different rows instead of repeating the same colour sequence?

      Kit

      Like

      1. The trouble is that: I want to show the selected item with a different color ,and when the item become not selected ,it goes to former color.I have already achieved it when all items are in one screen,but when the items go out of one screen,the selected item become not selected ,it cannot goes back to its former color. My English is a bit poor,I hope I have expressed myself clearly.

        Like

      2. i see.
        i haven’t tried this before. let me update you later after i have tried it at home.

        Like

      3. ykyuen :
        i see.
        i haven’t tried this before. let me update you later after i have tried it at home.

        OK,thanks a lot!

        Like

      4. Hi Xianming,

        i just realized that my code doesn’t contain the “Colour change” logic.

        could u tell me how you implement it?

        Kit

        Like

      5. you can see my problem and code at this:[http://www.eoeandroid.com/thread-20110-1-1.html].

        Like

      6. i just take a look on your source but i have no clue on the cause of the problem.

        have you ever tried to run in debug mode and see if the ResetColor(View v, int positionPre, int position) function was run probably when there were too many rows?

        Like

      7. Yes,the problem is just involved in the parameter :positionPre. when there are too many rows, row returned by the code[mviewPre = parent.getChildAt(positionPre)] will be not the former selected row;for example,suppose that one screen contains 11 rows,when selected rows goes to 15 rows,the positionPre will be 14(supose going down),but the code[mviewPre = parent.getChildAt(positionPre)]returns 14th row according to current screen,so mviewPre is if fact out of current screen(because that one screen contains 11 rows).So,ResetColor(View v, int positionPre, int position) become nonsense.
        Therefor, I think if there are other solutions, or can solve the problem with [mviewPre = parent.getChildAt(positionPre)].

        Like

      8. Hi ykyuen
        Problem solved,Thank you.[http://www.eoeandroid.com/thread-20110-1-1.html].

        Like

  3. xm :

    Hi ykyuen
    Problem solved,Thank you.[http://www.eoeandroid.com/thread-20110-1-1.html].

    Good to know that you have solved the problem =)

    Like

  4. Hi,

    Nice Article. 🙂

    In my app i need to show a view with 2 textview & 1 image.
    For that view i need to set alternative background color.
    can you please help how to set it ?

    Like

      1. Hey i know this…

        I need to pass 2 textview & 1 image.

        How to pass three items in a List ( that is HashMap )…

        You have any idea ?…

        Like

      2. The ArrayList size equals to the number of row in the ListView. and the number of items in the HashMap contains the items for each row.

        You can put items into the HashMap as many as you want. you just need a key to retrieve it.

        Like

  5. ykyuen :
    The ArrayList size equals to the number of row in the ListView. and the number of items in the HashMap contains the items for each row.
    You can put items into the HashMap as many as you want. you just need a key to retrieve it.

    Can you please give an example for this.?..

    When we are extending with SimpleAdapter the default constructor will be

    public sample(Context context, List<? extends Map> data,
    int resource, String[] from, int[] to) {
    super(context, data, resource, from, to);
    // TODO Auto-generated constructor stub
    }

    In this List<? extends Map> data they asked only for two one for String and another may be object… Then how can we use more then 2 items…?

    Like

    1. you can try to use List<HashMap<String, Object>> to replace the List<? extends Map>

      Then prepare an ArrayList

      // prepare the ListView
      ArrayList<HashMap<String, Object>> arrayList = new ArrayList<HashMap<String, Object>>();
      
      // row 1 hashmap
      HashMap<String, Object> rowOne= new HashMap<String, Object>();
      rowOne.put("key_for_text_1", "rowOneText1");
      rowOne.put("key_for_text_2", "rowOneText2");
      rowOne.put("key_for_image", R.drawable.icon);
      arrayList.add(rowOne);
      
      // row 2 hashmap
      HashMap<String, Object> rowTwo= new HashMap<String, Object>();
      rowTwo.put("key_for_text_1", "rowTwoText1");
      rowTwo.put("key_for_text_2", "rowTwoText2");
      rowTwo.put("key_for_image", R.drawable.icon);
      arrayList.add(rowTwo);
      
      // Sample is your adapter which extends the SimpleAdapter
      Sample sample = new Sample (this,
                  arrayList,
                  R.layout.main,
                  new String[] {"key_for_text_1", "key_for_text_2", "key_for_image"},
                  new int[] {R.id.item1, R.id.item2, R.id.item3});
      
      // Set the adapter to the ListView ...
      

      Like

  6. Hi,
    I tried to use a similar thing, when having only two colors, by simply doing:

    if (position % 2==0)
    view.setBackgroundColor(colors[0]);
    else
    view.setBackgroundColor(colors[1]);

    which is exactly the same. But I have a problem with that: if you have a lot of elements in the list, and that you don’t see some of the elements, then when scrolling down and up again, because Android doesn’t load every element directly but loads only those that you see, then the position will be reset to 0 more than once (can be every time it adds a row if you scroll very slowly). As a result, by scrolling slowly, every row on the top (by scrolling up) will have the position 0, and so the same color.

    Does anybody have the same problem? I am using an EfficientAdapter to display my list.

    Like

    1. you try to use “parent.getFirstVisiblePosition()” to get the position of first row in the view that you can see.

      Like

  7. package com.xm;
    
    import android.app.Activity;
    import android.content.Context;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.AdapterView;
    import android.widget.BaseAdapter;
    import android.widget.ImageView;
    import android.widget.ListView;
    import android.widget.TextView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.AdapterView.OnItemSelectedListener;
    
    public class ITlistView extends Activity {
    	//前一个selected的view的position
    	private int positionPre = -1;
    	//当前屏幕的第一个可见的view的position
    	private int FirstItemPos;
    	//当前选择的view的position
    	private static int posSel = -1;
    
    	@Override
    	public void onCreate(Bundle savedInstanceState) {
    
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.main);
    		// 绑定Layout里面的ListView
    		ListView list = (ListView) findViewById(R.id.ITlistview);
    
    		// 添加并且显示
    		list.setAdapter(new MySimpleAdapter(this));
    
    		// 添加点击
    		list.setOnItemClickListener(new OnItemClickListener() {
    			//前一个selected的view
    			private View mviewPre;
    
    			@Override
    			public void onItemClick(AdapterView parent, View v,
    					int position, long id) {
    				//获得posSel,FirstItemPos和mviewPre
    				posSel = position;				
    				FirstItemPos = parent.getFirstVisiblePosition();
    				mviewPre = parent.getChildAt(positionPre - FirstItemPos);
    				//点击后如果mivewPre不为空,则根据positionPre为它重新设置背景色
    				if (mviewPre != null) {
    					mviewPre
    							.setBackgroundResource((positionPre &amp; 1) == 1 ? R.color.gray
    									: R.color.light);
    				}
    				//如果posSel不等于positionPre,为之前选择过的view重新设置背景色
    				if (posSel != positionPre) {
    					parent.getChildAt(posSel - FirstItemPos)
    							.setBackgroundResource(
    									(posSel &amp; 1) == 1 ? R.color.gray
    											: R.color.light);
    				}
    
    				positionPre = position;
    				//为选择的view设置被选择时的背景色
    				v.setBackgroundResource(R.color.selC);
    				
    				setTitle("点击第" + position + "个项目");
    			}
    		});
    		
    		//itemSelected监听器事件与click监听器事件大致相同
    		OnItemSelectedListener itemSelectedListener = new OnItemSelectedListener() {
    			private View mviewPre;
    
    			@Override
    			public void onItemSelected(AdapterView parent, View v,
    					int position, long id) {
    				posSel = position;
    				FirstItemPos = parent.getFirstVisiblePosition();
    				mviewPre = parent.getChildAt(positionPre - FirstItemPos);
    
    				if (mviewPre != null) {
    					mviewPre
    							.setBackgroundResource((positionPre &amp; 1) == 1 ? R.color.gray
    									: R.color.light);
    				}
    				if (posSel != positionPre) {
    					parent.getChildAt(posSel - FirstItemPos)
    							.setBackgroundResource(
    									(posSel &amp; 1) == 1 ? R.color.gray
    											: R.color.light);
    				}
    
    				positionPre = position;
    
    				v.setBackgroundResource(R.color.selC);
    
    			}
    
    			@Override
    			public void onNothingSelected(AdapterView arg0) {
    
    			}
    
    		};
    
    		list.setOnItemSelectedListener(itemSelectedListener);
    
    		// 添加长按点击
    		/*
    		 * list.setOnCreateContextMenuListener(new OnCreateContextMenuListener()
    		 * {
    		 * 
    		 * @Override public void onCreateContextMenu(ContextMenu menu, View
    		 * v,ContextMenuInfo menuInfo) {
    		 * menu.setHeaderTitle("长按菜单-ContextMenu"); menu.add(0, 0, 0,
    		 * "弹出长按菜单0"); menu.add(0, 1, 0, "弹出长按菜单1"); } });
    		 */
    	}
    
    	// 长按菜单响应函数
    	/*
    	 * @Override public boolean onContextItemSelected(MenuItem item) {
    	 * setTitle("点击了长按菜单里面的第"+item.getItemId()+"个项目"); return
    	 * super.onContextItemSelected(item); }
    	 */
    	public static class MySimpleAdapter extends BaseAdapter {
    		private LayoutInflater mInflater;
    		private Bitmap mIcon1;
    		private Bitmap mIcon2;		
    		
    		public MySimpleAdapter(Context context) {
    			// Cache the LayoutInflate to avoid asking for a new one each time.
    			mInflater = LayoutInflater.from(context);
    
    			// Icons bound to the rows.
    			mIcon1 = BitmapFactory.decodeResource(context.getResources(),
    					R.drawable.icons1);
    			mIcon2 = BitmapFactory.decodeResource(context.getResources(),
    					R.drawable.icons2);			
    		}
    
    		@Override
    		public int getCount() {
    			return TEXTS.length;
    		}
    
    		@Override
    		public Object getItem(int position) {
    
    			return position;
    		}
    
    		@Override
    		public long getItemId(int position) {
    
    			return position;
    		}
    
    		@Override
    		public View getView(int position, View convertView, ViewGroup parent) {
    			ViewHolder holder;
    
    			if (convertView == null) {
    				convertView = mInflater.inflate(R.layout.icon_text_view, null);
    
    				// Creates a ViewHolder and store references to the two children
    				// views
    				// we want to bind data to.
    				holder = new ViewHolder();
    				holder.text = (TextView) convertView.findViewById(R.id.text);
    				holder.icon = (ImageView) convertView.findViewById(R.id.icon);
    
    				convertView.setTag(holder);
    				convertView
    						.setBackgroundResource((position &amp; 1) == 1 ? R.color.gray
    								: R.color.light);
    
    			} else {
    				// Get the ViewHolder back to get fast access to the TextView
    				// and the ImageView.
    				holder = (ViewHolder) convertView.getTag();
    				//当拖动屏幕时为新加进屏幕的view根据position重新设置背景色
    				convertView
    						.setBackgroundResource((position &amp; 1) == 1 ? R.color.gray
    								: R.color.light);
    				//让当前选择的view保持被选择的颜色
    				if (position == posSel) {
    					convertView.setBackgroundResource(R.color.selC);
    				}
    			}
    
    			holder.text.setText(TEXTS[position]);
    
    			holder.icon.setImageBitmap((position &amp; 1) == 1 ? mIcon1 : mIcon2);
    
    			return convertView;
    		}
    
    		static class ViewHolder {
    			TextView text;
    			ImageView icon;
    		}
    	}
    
    	private static final String[] TEXTS = { "板块排行0", "板块搜索1", "社会民生2", "情感人生3",
    			"财经科技4", "时尚女人5", "健康生活6", "影音娱乐7", "联系我们8", "联系我们9", "联系我们10",
    			"联系我们11", "联系我们12", "联系我们13", "联系我们14", "联系我们15", "联系我们16",
    			"联系我们17", "联系我们18" };
    	  
    }
    

    Like

  8. Hi,

    Thanks for the code. however, I have a problem when scrolling the list the selected position is not highlighted. So there is no way of knowing what index is currently selected. Any thoughts?

    Thank you.
    Syd

    Like

    1. Hi Syd,

      you can set the OnItemClickListener to the ListView and you should be able to get the position of the item u clicked. you can add the following piece of code in my example.

      OnItemClickListener itemClickedListener = new OnItemClickListener() {
      
      	public void onItemClick(AdapterView<?> parent, View view, int position,
      			long id) {
      		// TODO Auto-generated method stub
      		Log.d("debug", "postion: " + position);
      		Log.d("debug", "id: " + id);
      	}
      };
      lv.setOnItemClickListener(itemClickedListener);
      

      Regards,
      Kit

      Like

      1. hi ykyuen
        its a great job you did , realy very usefull …
        I added the code above , but I got these problems,
        1-
        code:
        OnItemClickListener itemClickedListener = new OnItemClickListener() {

        error:
        The type new AdapterView.OnItemClickListener(){} must implement the inherited abstract method AdapterView.OnItemClickListener.onItemClick(AdapterView, View, int, long)

        2-
        code :
        public void onItemClick(AdapterView parent, View view, int position,

        error:
        View cannot be resolved to a type

        Marco , from Brazil

        Like

  9. Hi Ykyuen,

    Sorry i did not word my problem correctly. Actually i do know which position is selected but on the ui the list item is not highlited. It is just a ui issue.

    Thanks,
    Syed

    Like

    1. Hi Harikrishnan,

      sorry for the late reply. i also found that when i click the row of the list view on the simulator, sometimes the focus is lost. and i found that this problem is not caused by the colors. and when i used the keyboard arrow button to select the row, the problem would not appear.

      have you tried to deploy it to a android phone?

      Like

    1. try this

      ...
      TextView item2 = (TextView)view.findViewById(R.id.item2);
      item2.setTextColor(android.graphics.Color.YELLOW);
      ...
      

      Like

      1. it works thanks!
        i have no idea why this doesn’t work in main.java. if i call this there, it throws me nullpointerexception.
        sorry for such stupid question =)

        Like

  10. Hi, I want to know how to change the color of the text. I don’t want to change all the text, only a item. Thanks.

    Like

  11. hi
    i set the odd and even row color as you told but when i change the color value it didn’t reflat in the list so please help me in this my line is as below
    private int[] colors = new int[] { 0xE1E2E3, 0xD2D6D8 };

    so how to add add this

    Like

  12. Hi
    I am facing one problem can u please solve it
    How to fill the different color at rectangle gridview using java(android)
    please solve my problem

    thank u

    Like

      1. Hi thank u for gave me this information. but i need one more i want fill 9*9 rectangle gird with different colors( each rectangle with different colors) using java(android code) please tell me

        Like

      2. Hi kumar,

        i can’t give u much more information since i haven’t touched Android development for more than one year.

        For each gridview, you can set the number of columns with the layout xml or setNumColumns().

        To fix the number of rows, just make sure u put 81 items to the adapter and set it to the grid view object.

        For different colors per each item, it could be set by layout xml of the items inside the adapter. If you really cannot make it, i suggest you could follow the HelloGridView example.

        good luck~

        Kit

        Like

  13. Hi
    I am new to android. can u please tell me , I want to create board having 8*8 grid with different colors in each square and placing one coin on alternative squares with moves in Horizontal and vertical and diagonal direction similar to checkers game so please reply me

    Like

  14. Hi ykyuen. I am facing one problem. I have spinner having 5 items(suppose item1, item2, item3, item4…). I want to change the textcolor of the selected item. For example item1 in red, item2 in blue, item3 in green, item4 in black ….).

    Like

  15. hi,
    Thanks for your sample code

    Instead using seperate class of SimpleApadter, can we overide the getView() method from the activity, is it possible..?

    Like

  16. Hi, nice article such as the one with the SimpleAdapter. Help me a lot. I´m a beginner, and I try to use the Simple Adapter with colors but, the colour it´s only filled when the user click on the Item of the List.

    Works fine but I have some problems. When the user click on another item, the previous selected item got to lost the colour that he has previously.

    I try to do this:

    ListView.setOnItemClickListener(new OnItemClickListener() {
      public void onItemClick(AdapterView parent, View view, int position, long id) {
        adapter.getView(position, view, parent).setBackgroundColor(0x300000FF);
    
        for (int i = 0; i < adapter.getCount(); i++){
          if (i != position)
            adapter.getView(i, view, parent).setBackgroundColor(#0000000);
        }
      }
    });
    

    without the loop teh item has the colour changed, but when I apply the loop nothing happens with any item.

    Do you have any hints for me?

    Thanks a lot.

    Like

    1. Try this

      ListView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View view, int position, long id) {
          // reset all rows to white
          for (int i = 0; i < adapter.getCount(); i++){
            adapter.getView(i, view, parent).setBackgroundColor(0xFFFFFFFF);
          }
      
          // set the bgcolor for the clicked item
          adapter.getView(position, view, parent).setBackgroundColor(0x300000FF);
        }
      });
      

      does it work?

      Like

      1. Not really, continue to fill all itens and did not reseted the colours….but it´s a start, I on my way to resolve it and post here.

        Tks a lot!

        Like

  17. Hello and thanks in advance. My question is simply how would I changed the background color (or text color) of the first 6 characters of every cell in my listview ?
    (they contain the date. Example “Jan 01: Blah blah blah data data… ” )
    Any guidance would be appreciated. thanks again.

    Like

      1. Thank you looks very helpful. I guess my only confusion is …if I populate my listview with a webservice array like so

        SoapObject oResponse = (SoapObject)soapEnvelope.getResponse();
        ArrayList oStringList = new ArrayList();
        for(int i = 0; i &lt; oResponse.getPropertyCount(); i++)
          oStringList.add(oResponse.getProperty(i).toString()); 
        lv.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, oStringList));
        

        will arrayAdapter take a textview ???

        Regardless, thanks for the help. you have helped me out.

        Like

  18. am gettng one problem in my customlistview i have 3 buttons and one text view while press one button am channging background of perticular position of the list and enabling textview now my problem is begins i.e, when am pressing second button in the same view (position) that changed background moves to last position of the list view ……….plz help me why it is happening ………..?

    Like

  19. Just took the code at top of this post and modified it to work with by extending SimpleCursorAdapter for my db based app. The clarity of the example made this very easy to do. thanks

    Like

  20. Thanks many, exactly what I was looking for. Thanks a lot for Odd, Even different row colors.
    Now I am looking for onClick item color change in list view to understand that this Item is clieked. Please help me with simple solution if possible.

    Like

    1. Quick question – is there anywhere that has a list of valid colour codes? I’ve tried using hex codes but they don’t seem to work. Thanks in advance

      Like

  21. Hello and thanks a lot. I have a problem. I want to set color for the only fist row of ListView. But when scrolling the list there are many color row. I know that because the position will be reset. Do you have any solutions?
    Here is my code

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    	View view = super.getView(position, convertView, parent);
    	if (position == 0)
    		view.setBackgroundColor(Color.BLUE);
    	return view;
    }
    

    ToanTK

    Like

  22. Hi, is it possible to change a textView color in functions of is content?
    I try this :

    private class SpecialAdapter extends SimpleAdapter {
    	    
      public SpecialAdapter(Context context, List&lt;HashMap&gt; items, int resource, String[] from, int[] to) {
        super(context, items, resource, from, to);
      }
    	 
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
        View view = super.getView(position, convertView, parent);
        TextView status =(TextView)findViewById(R.id.txtViewStatus);
    	      
        if(status.getText()=="Scheduled"){
          status.setTextColor(Color.GREEN);
        }
    	      
        return view;
      }
    }
    

    I have a null pointer exeption on the if so i think the textview isn’t tuck and i’ve to take the List<HashMap> items data but idon’t know how to do.

    Like

    1. finally got the sollution:

      create a TrajetAdapter.java :

      public class TrajetAdapter  extends SimpleAdapter {
      	
        private List<HashMap> test;
      
        public TrajetAdapter(Context context, List<HashMap> items, int resource, String[] from, int[] to) {
          super(context, items, resource, from, to);
        test=items;
        }
      	
      	
        public int getCount() {
          return test.size();
        }
      
      
        public Object getItem(int position) {
          return test.get(position);
        }
      
        public long getItemId(int position) {
          return position;
        }
      
        public View getView(int position, View convertView, ViewGroup parent) {
          View view = super.getView(position, convertView, parent);
          TextView status =(TextView)view.findViewById(R.id.txtViewStatus);
        
          if(test.get(position).containsValue("Scheduled")){
            status.setTextColor(Color.GREEN);
          } else if(test.get(position).containsValue("Landed")) {
            status.setTextColor(Color.GREEN);	    	
          } else if(test.get(position).containsValue("Active")) {
            status.setTextColor(Color.rgb(255,165,0));	    	
          } else if(test.get(position).containsValue("Cancelled")) {
            status.setTextColor(Color.RED);	    	
          } else {
            status.setTextColor(Color.BLACK);
          }
          return view;
        }
      }
      

      Like

  23. Hello,

    the problem I have is that I already have an adpter that I’m using :

    SimpleAdapter mSchedule = new SimpleAdapter(this, mylist, R.layout.row_all_sehem_every_mosad, new String[] { "sehem_nidrash", "sehem_present", "mosad" }, new int[] { R.id.sehem_nedded_r, R.id.sehem_present_r, R.id.mosad_r });
    

    so I can’t understand how I change this to the new adapter?

    thanks,
    Marina

    Like

    1. Actually it is working , thanks!
      but it’s not good enough yet,
      I’m trying to insert data into listview. my list view is made from 3 columns and I want to compare the data (grades) in the listview to a number. If the data in one column is bigger than the data in the second column, I want the color of the row to be green and if it’s smaller it will be colored in red.
      So I nedd to add a function,

      So basiclly I want the list view to change colors- every row in another color? by a specific law.

      Can you give me the exmple for this?
      the newAdapter is the same?

      thanks,
      Marina

      Thanks for the help,

      Like

      1. I think you have to work on the getView() function.

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
          View view = super.getView(position, convertView, parent);
          //int colorPos = position % colors.length;
        
          Item item = (Item) items.get(position);
          /* ADD YOUR LOGIC HERE TO DETERMINE THE colors[colorPos] */
        
          view.setBackgroundColor(colors[colorPos]);
          return view;
        }
        

        Here is a example where you can get the

        Like

  24. hi i am to ask that .i want to change the background color of specific row of listview but i will change the color of that row and other row and on scrolling it will change the order of colored rows….

    Like

  25. Hi,
    Can you please tell how to search the listview item with multiple words in editext component of listactivity using simple adapter…..

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.