Search Results

Search found 1331 results on 54 pages for 'listview'.

Page 13/54 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Android: Dynamically change Image in Listview

    - by Vivek
    Hi All, I have a listview defined by the following xml. I need to toggle the image in the list during runtime when the user clicks on any row. How can I achieve this? Any help is highly appreciated. Thanks //list_item.xml <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/play" android:id="@+id/img" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" android:id="@+id/txt" /> </LinearLayout>

    Read the article

  • Scroll bar not maintaining its position in ListView (ASP.net)

    - by AJ
    Hi I have a listview inside a DIV which shows the scroll bars. At one time, let's say, 10 rows can be seen. I scroll down and click Edit on 25 row. To my surprise, the scroll goes to the first row (although if I go back to 25th row, the row is in edit mode) My issue, how I can make sure that the scroll bar maintains its position to 25th row after clicking on Edit button? Please advise. Thanks AJ .StopScroll1{ Z-INDEX: 20; POSITION: relative;left:-1px; TOP: expression(document.getElementById("divGrid1").scrollTop); }        ..... .....

    Read the article

  • Android - Adding Subitem to a listview

    - by Oli
    I currently have a listview which contains a couple of strings. These are called from a string array in strings.xml <string name="app_name">Taxi Me</string> <string-array name="taxi_array"> <item>Barrys Taxi</item> <item>Boom Taxi</item> </string-array> What i was trying to do is create subitems for these so that i can show fields such as address and contact details etc. I made a customlistview a while back but cant work out how i can do it using the strings.xml file? Are there any particular tags i need to use so they show up in the list view? Any help would be greatly appreciated. Thanks

    Read the article

  • Odd visual issue with ListView item layout with two pressable pieces

    - by jnylen
    I wanted to make a ListView where the items have two pressable pieces, like the layouts that show up in a couple of places in the stock Android phone/contacts application: I have the layout working fine, including handling events from each piece separately, except for a visual issue when the smaller piece is pressed. In my application the smaller piece only gets a small ellipse for the background when it is pressed, like this: Note that is actually not my application - that is NubDial, but my application has the same problem. Since NubDial uses the exact same XML layout as the phone app, I'm not sure how relevant the list item layouts are, but here they are anyway: Contacts list: contacts_list_item.xml NubDial: contacts_list_item.xml Does anybody know what might be happening there?

    Read the article

  • Listview icons show up blurry (C#)

    - by Balk
    I'm attempting to display a "LargeIcon" view in a listview control, however the images I specify are blurry. This is what I have so far: The .png files are 48x48 and that's what I have it set to display at in the ImageList properties. There's one thing that I've noticed (which is probably the cause) but I don't know how to change it. Inside the "Images Collection Editor" where you choose what images you want for the ImageList control, it looks like it's setting the wrong size for each image. As you can see the "PhysicalDimension" and the "Size" is set to 16x16 and not abled to be manipulated. Does anyone have any ideas? Many thanks!

    Read the article

  • How to get ListView to grow to the size of content

    - by Jared
    So I have a fairly complex activity the parent being a linearlayout with a table with some basic info and buttons. Then a couple listviews that the user can add items to. So these listviews grow more and more as the user uses the app. The problem I'm running into is the Linearlayout is bigger then the resolution of the screen and so it needs to scroll. So the scrolling doesn't work on the Listviews. I've tried playing with changing the layout_height of the listview and its child element with no success. Is there a way to make these couple listviews expand out to the amount of children? Or am I going about this all wrong? If so what other controls can I use? I'm open to any ideas. I really just don't know how to go about this. Thanks

    Read the article

  • ListView created programmatically - emptyView doesn't show

    - by Yorick
    I've created custom ListView programmatically, and set view to show when ListAdapter is empty but nothing shows on the screen in that case, what can be wrong? public PlayerList(Context context, Activity activity) { super(context); mParent = activity; setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ... } }; List<PlayerInfo> players; players = getPlayerList(); // here size of players == 0 setAdapter(new PlayersAdapter(this.getContext(), R.id.player_name, players)); LayoutInflater vi = (LayoutInflater)mParent.getSystemService(Context.LAYOUT_INFLATER_SERVICE); emptyView = vi.inflate(R.layout.empty_view, null); // emptyView is View, and member of PlayerList this.setEmptyView(emptyView); }

    Read the article

  • Iterating ListView items in Android

    - by pocoa
    I want to iterate a list of items into a ListView. This code below is not enough to iterate all the items into the list because of the weird behaviour of getChildCount() function which only returns the visible item count. for (int i = 0; i < list.getChildCount(); i++) { item = (View)list.getChildAt(i); product = (Product)item.getTag(); // make some visual changes if product.id == someProductId } My screen displays 7 results and when there are more than 7 items into the list, it's not possible to access to the 8th item or so.. Only visible items.. Should I use ListIterator instead? Thanks.

    Read the article

  • How to display List<> using ListView?

    - by eriX
    When I use ListView to display a array of my object, I can use the following code: MyObject[] myObject; ... ArrayAdapter<MyObject> itemList = new ArrayAdapter<MyObject>(this, R.layout.list, myObject); setListAdapter(itemList); In case that the input is a list: List<MyObject> myobject; How can I assign it to ListAdapter? Please advise, Thx!

    Read the article

  • [Android] Returning to a ListView with a text filter

    - by sosiouxme
    I enabled text filtering on my ListView in the expected way; adding android:textFilterEnabled=”true” in resource definition and (as I'm using a SimpleCursorAdapter) setting a FilterQueryProvider that provides a filtered cursor like so: public Cursor runQuery(CharSequence constraint) { Cursor cur = mDba.fetchTrackers(mCurrentGroupId, constraint.toString()); startManagingCursor(cur); return cur; } My question is this: once the user selects a list item, goes off to another activity, and returns to this one, how can I control the state of the filter previously applied? What I'm seeing right now is that when I return to the activity, the cursor being used is the unfiltered one set on the filter at creation, but the filter text they typed is still shown (and typing keys causes the filter to be applied). What I'd like to do is either clear the filter, or keep the filtered cursor that the activity was left with.

    Read the article

  • ListView Item Detail Screen: New or Same Activity?

    - by stormin986
    I have a listview where each item correlates to an instance of an item in an array. When the user selects an item, it will bring up a 'Details' page that reads and displays other data members of the list item. Would this be better implemented with the Details page as its own activity, or a new view within the same activity? Pros and cons of each? A new activity makes my job a little easier in terms of handling the 'back' button, but then I have the challenge of how do I pass the rest of the data structure to the new activity since I can't bundle it up (unless I serialize it).

    Read the article

  • How to explicitly select the row in ListView in WPF?

    - by Ashish Ashu
    I have a ListView in which one of the column contains combo box. I have binded the selectedItem of a Listview, so that I get the current object (selected row ) in the listview. When I do any operation in a combo box like selection change then the listview row ( in which that combo box belongs) is not selected be default and hence my selectedItem gives null or previous row selected object. Please Help!!

    Read the article

  • Bottom button bar overlaps the last element of Listview!!

    - by elto
    I have a listview which is part of an Activity. I want user to have a choice for batch deleting the items in the listview, so when he chooses the corresponding option from the menu, every list item gets a checkbox next to it. When user clicks any checkbox, a button bar is to slide up from bottom (as in gmail app) and clicking delete button deletes the selected items, however clicking cancel button on the bar would uncheck all the checked items. This is my page layout.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/transparent" > <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:id="@+id/list_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" > <ListView android:id="@+id/mylist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:drawSelectorOnTop="false" android:layout_weight="1" /> <TextView android:id="@+id/empty_list_message" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#FFFFFF" android:layout_gravity="center_vertical|center_horizontal" android:text="@string/msg_for_emptyschd" android:layout_margin="14dip" android:layout_weight="1" /> </LinearLayout> <RelativeLayout android:id="@+id/bottom_action_bar" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/schedule_bottom_actionbar_border" android:layout_marginBottom="2dip" android:layout_gravity="bottom" android:visibility="gone" > <Button android:id="@+id/delete_selecteditems_button" android:text="Deleted Selected" android:layout_width="140dip" android:layout_height="40dip" android:layout_alignParentLeft="true" android:layout_marginLeft="3dip" android:layout_marginTop="3dip" /> <Button android:id="@+id/cancel_button" android:text="Cancel" android:layout_width="140dip" android:layout_height="40dip" android:layout_alignParentRight="true" android:layout_marginRight="3dip" android:layout_marginTop="3dip" /> </RelativeLayout> </FrameLayout> </LinearLayout> so far, I have got everything working except that when the bottom bar becomes visible upon checkbox selection, it overlaps the last element of the list. All other list items can be scrolled up, but you cant scroll up the very last item of the list, therefore user can not select that item if he intends to. Here is the screenshot of the overlap. I have tried using the listview footer option, but that appends the bar to the end of the list instead of keeping it fixed at the bottom of the screen. Is there a way I could "raise" the listview enough so that the overlap wont happen?? BTW, I have already tried adding the bottom-margin to the listview itself, or the LinearLayout wrapping the listview right before making the button-bar visible, but it introduces other bugs like clicking one checkbox checks some another checkbox in listview.

    Read the article

  • Android ListView item highlight programmatically

    - by dhomes
    Hi all, I know it's been asked around but I haven't found quite the answer yet (new to Android so sorry about the ignorance) my app's launch Activity has an EditText (called searchbox) , a ListView (designations) and a Spinner (types) I use the EditText as a searchbox, I have to pass the string through a custom editing to make searching more flexible. After that I match that against the closest approximation I find in 'designations' and do designations.setSelection(j); As expected, this sets the desired item to the top of designations. But I can find a way to highlight it via code. NOW, i do know that if the device is in touch mode the highlighting of a selected item won't occur. So the last 4 lines of my searchbox's onTextChanged event are: designations.setFocusable(true); designations.setFocusableInTouchMode(true); if (match==true) designations.setSelection(j); if (st.length()==0) designations.setSelection(0); to no avail. now, i don't have any code on searchbox's afterTextChanged(Editable s); so could anyone give me a clue on this? regards ~dh

    Read the article

  • Pass object to dynamically loaded ListView ItemTemplate

    - by mickyjtwin
    I have been following the following post on using multiple ItemTemplates in a ListView control. While following this example does produce output, I am trying ot figure out how to psas an object through to the ItemTemplate's user control, which I do not seem to be able to do/figure out. protected void lvwComments_OnItemCreated(object sender, ListViewItemEventArgs e) { ListViewDataItem currentItem = (e.Item as ListViewDataItem); Comment comment = (Comment)currentItem.DataItem; if (comment == null) return; string controlPath = string.Empty; switch (comment.Type) { case CommentType.User: controlPath = "~/layouts/controls/General Comment.ascx"; break; case CommentType.Official: controlPath = "~/layouts/controls/Official Comment.ascx"; break; } lvwComments.ItemTemplate = LoadTemplate(Controlpath); } The User Control is as follows: public partial class OfficialComment : UserControl { protected void Page_Load(object sender, EventArgs e) { } } In the example, the values are being output in the ascx page: <%# Eval("ItemName") %> however I need to access the ListItem in this control to do other logic. I cannot figure out how I to send through my Comment item. The sender object and EventArgs do not contain the info.

    Read the article

  • How do I place widgets above and below a listview with Relative Layout

    - by Jay Askren
    I have a list view and want to put stuff both above(on the y axis) and below(y axis) it including images, text views, and a row of buttons. Below is a simplified version of what I am creating. Unfortunately the list covers(i.e. above on the z axis) the header so the header text is not visible instead of being underneath (on the y axis) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/footer" android:text="footer" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentBottom="true" /> <ListView android:id="@+id/list_view" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_above="@id/footer" android:background="#ff9999ff"/> <TextView android:id="@+id/header" android:text="header" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignParentTop="true" android:layout_above="@id/list_view" android:baselineAlignBottom="false" /> </RelativeLayout> Here is the corresponding Activity class: public class SampleListActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_activity); } }

    Read the article

  • Wrong item checked when filtering ListView in android

    - by aspartame
    I have a ListView with multiple choice entries where some are checked from the beginning using setItemChecked(position, true); I combine this with the filtering option setTextFilterEnabled(true) so it's easy to find a specific entry in the list. The problem is that when I filter the list the entries switch position in the list view. Take for example three entries: 'A', 'B' and 'C' where 'C' is checked beforehand (i.e. the entry at position 3 in the list). When I type a 'C' on the keyboard, only the 'C' entry is displayed (as intended). Now 'C' is not checked anymore, since the entry has moved from the checked position 3 to the unchecked position 1 in the list. This behavior leads to some not very welcome effects in the app. Is there a way to "move the selection with the filtering", i.e. bind the checked state to the entry and not to its initial position in the list? Or do I need to find a new approach? Thanks, Linus

    Read the article

  • Android Loading listview items from service results in hang

    - by Isaac Waller
    Hello, In my Android application, I have a ListActivity. This ListActivity uses a SimpleAdapter that I fill with items from my service. So, in my code, I do: MySuperCoolService.Binder serviceBinder = null; private ServiceConnection serviceConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { Log.d(TAG, "Service connection: connected!"); serviceBinder = (MySuperCoolService.Binder)service; } public void onServiceDisconnected(ComponentName className) { Log.d(TAG, "Service connection: disconnected"); serviceBinder = null; } }; bindService(new Intent(this, MySuperCoolService.class), serviceConnection, BIND_AUTO_CREATE); while(serviceBinder==null) { Thread.Sleep(1000); } // now retrieve from service using binder and set list adapter This whole operation takes hardly any time (less than a second), so I want it to run in the UI thread. See my onCreate: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); fillDataUsingCodeAbove(); } The reason I want this to run in the UI thread is that if you have a list item selected, or you have scrolled to a certain position in the ListView, and you rotate the device or take out the keyboard or something (to trigger a configuration change) when my activity is restarted, Android will try to restore the state right after onCreate. But, if I run it in a separate thread, it will not. Also there is a cool fadein animation too :) The problem I am having with running it in the UI thread is that when I try to bind to the service, that service bind request gets put onto the message queue. But then when I go into my loop, I stop the message queue from looping. So my program hangs, because it's waiting for the service to get bound, and the service won't get bound until the loop ends. I have thought of putting Looper.loop() inside my loop, but that just hangs it at Looper.loop() (I don't know why.) Sorry for such a long question, Isaac Waller

    Read the article

  • Android: Change the source of ImageView present in ListView

    - by Vivek
    Hi All, I have a ListView specified by list_item.xml Now I need to change the Image in my list inside onListItemClick. How to achieve this? //list_item.xml <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/play" android:id="@+id/img" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" android:id="@+id/txt" /> </LinearLayout> I have a Custom Adapter to populate my list. Code below is the adapter. public class MyCustomAdapter extends ArrayAdapter<String> { public MyCustomAdapter(Context context, int textViewResourceId, String[] objects) { super(context, textViewResourceId, objects); // TODO Auto-generated constructor stub } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub LayoutInflater inflater=getLayoutInflater(); View row=inflater.inflate(R.layout.list_item, parent, false); TextView label=(TextView)row.findViewById(R.id.txt); label.setText(Sounds[position]); ImageView icon=(ImageView)row.findViewById(R.id.img); icon.setMaxHeight(32); icon.setMaxWidth(32); icon.setPadding(2, 1, 5, 1); icon.setImageResource(R.drawable.play); return row; } } And in onCreate I do the following @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { setListAdapter(new MyCustomAdapter(this, R.layout.list_item, Sounds)); //Sounds --> String array } catch(Exception e) { e.printStackTrace(); } } Now when any row is selected, I need to change the image associated with the selected view. Your help is appreciated. Thanks.

    Read the article

  • Creating ListView with check boxes...Android

    - by deewangan
    Hello, I am trying to create a listview that has check box beside each item. (i am following a code from the book android), but i can't get it to work, every time i run it, it crashes. since i am very new to this android staff, i have no clue what to do to get it to work, any help is appreciated.the code is below. *i have created two layout files in names of list and list_item. the code for the main activity: public class ListDemoActivity extends ListActivity { /** Called when the activity is first created. */ String[] listItems = {"exploring", "android","list", "activities"}; private SimpleCursorAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lists); //setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1, listItems)); //setContentView(R.layout.lists); Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null); startManagingCursor(c); String[] cols = new String[]{People.NAME}; int[] names = new int[]{R.id.row_tv}; adapter = new SimpleCursorAdapter(this,R.layout.list_item,c,cols,names); this.setListAdapter(adapter); } } the lists file content: <?xml version="1.0" encoding="utf-8"?> and the list_item file content: <?xml version="1.0" encoding="utf-8"?>

    Read the article

  • How to implement an ListView containing images with style

    - by Alexandergre
    So I have been working with an app where I need to show the thumbnails as clean and use the space in a good way. Style A is my work until now. What I want to accomplish is something like style B. no titles and use the space in a good way. I need help with this. there was no tutorial on the net. Is ListView able to do such a thing? or shall I make picturesboxes and put them in a scrollview? the code: private void button1_Click(object sender, EventArgs e) { ImageList myImageList = new ImageList(); myImageList.ImageSize = new Size(48, 48); DirectoryInfo dir = new DirectoryInfo(@"C:\img"); foreach (FileInfo file in dir.GetFiles()) { try { myImageList.Images.Add(Image.FromFile(file.FullName)); } catch { Console.WriteLine("This is not an image file"); } } myListView.LargeImageList = myImageList; myListView.Items.Add("a", 0); myListView.Items.Add("b", 1); myListView.Items.Add("c", 2);

    Read the article

  • CheckBox won't toggle in Android ListView with focusable="false"

    - by user3563124
    I'm creating a ListView with a custom Adapter for displaying my entries. Each row contains a checkbox, and my adapter contains the following code: CheckBox cb = (CheckBox) v.findViewById(R.id.item_sold); cb.setChecked(p.isSold); setupCheckboxListener(cb, v, position); ... private void setupCheckboxListener(CheckBox check, final View v, final int position) { check.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox cb = (CheckBox) v; if (cb.isChecked()) { System.out.println("Should become false!"); cb.setChecked(false); } else { System.out.println("Should become true!"); cb.setChecked(true); } } }); My row XML file includes the following: <CheckBox android:id="@+id/item_sold" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.10" android:layout_gravity="center" android:gravity="center" android:focusable="false" android:clickable="false"/> But anytime I press one of the checkboxes, check.isChecked() returns true, even if the box is unchecked. I even checked to make sure that the checkboxes were distinct and weren't picking up just the last value/etc. Setting up the listeners inline instead of in a method doesn't seem to help, either. It's literally just the isChecked() condition that isn't working appropriately - it seems to always give me the inverse value. Setting an onClick on the row is not acceptable in this case because I need to allow row selection for something else. What could be causing this issue?

    Read the article

  • Style first 2 TextViews in Android ListView differently

    - by Kurtis Nusbaum
    I have a ListView and I want the first two entries in it to be displayed differently than the rest. Nothing fancy, I want them all to just be text views. But the first two entries need to have different sizes and weights than the rest. I tried modifying the ArrayAdapter class like so: private class BusStopAdapter<T> extends ArrayAdapter<T>{ public BusStopAdapter( Context context, int textViewResourceId, List<T> objects) { super(context, textViewResourceId, objects); } public View getView(int position, View convertView, ViewGroup parent) { TextView toReturn = (TextView)super.getView(position, convertView, parent); if(position == 0){ toReturn.setTextSize(12); toReturn.setText("Previous Bus: " + toReturn.getText()); toReturn.setPadding(0,0,0,0); } else if(position == 1){ toReturn.setTextSize(20); toReturn.setPadding( toReturn.getPaddingLeft(), 0, toReturn.getPaddingRight(), 0 ); toReturn.setText("Next Bus: " + toReturn.getText()); toReturn.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP); } return toReturn; } } But this inadvertantly causes some of the other textviews to take on these special attributes. I think it's because cause textviews get "recycled" in the AbsListAdapter class.

    Read the article

  • WPF - Extend ListView with checkable AND selectable ListViewItems

    - by Marks
    Hi there. I already read many examples on extending ListViews with checkboxes bound with IsSelected. But I want something more. I want a seperation between the checked and selected state, so i get a ListBox that has a single selected item, but can have multiple checked items. Unfortunately ListViewItem does not have a property for checked and I dont see a possibility to get the ListView to work with a custom CheckableListViewItem. Of course i could use a List of objects with a checked property as ItemSource, but I dont think thats a good way to go. Checked or not is a matter of the list or item-container, not of the object listed in it. Beside that I dont want all my classes like user, role, group to have counterparts like checkableUser, checkableRole and checkableGroup. The behaviour i want can be easyly accomblished for the UI with a <DataTemplate x:Key="CheckBoxCell"> <StackPanel Orientation="Horizontal"> <CheckBox /> </StackPanel> </DataTemplate> and a <GridViewColumn CellTemplate="{StaticResource CheckBoxCell}" Width="30"/> But without a binding on the checkbox i cant check if it is checked or not. Is there any way to accomplish something like that? The perfect solution for me would be to have listView1.SelectedItem, listView1.CheckedItems and maybe a listView1.UncheckedItems and of course listView1.CheckItem and listView1.UncheckItem. Thanks for any help.

    Read the article

  • ListView causing OutOfMemory Error

    - by Michael
    So I am not really given a reason to the right of this error message. I am not exactly sure why this is happening but my guess though is that it has to do with the fact that there are around ~50 good quality drawables. Upon scrolling really fast, the app crashes. I feel as if I am mitigating most common issues with ListView and crashing such as using View Holders as well as only initiating the inflater once. Process: com.example.michael.myandroidappactivity, PID: 20103 java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) Here is the code public class ImageAdapter extends BaseAdapter { private Context context; private ArrayList<Integer> imageIds; private static LayoutInflater inflater; public ImageAdapter(Context _context, ArrayList<Integer> _imageIds) { context = _context; imageIds = _imageIds; } @Override public int getCount() { return imageIds.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } static class ViewHolder{ ImageView img; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; View rowView = null; if(rowView==null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.listview_layout, parent, false); holder = new ViewHolder(); holder.img = (ImageView) rowView.findViewById(R.id.flag); rowView.setTag(holder); } else { holder = (ViewHolder) rowView.getTag(); } holder.img.setImageResource(imageIds.get(position)); return rowView; } }

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >