android-listview

How to update an item from ArrayList on ArrayAdapter in Android

大兔子大兔子 提交于 2019-12-22 17:22:21
问题 I am new at developing Android.I have a ListView and custom ArrayAdapter which holds an arraylist.I want to update arraylist specific item by position.How can I handle please help me thanks in advance. 回答1: Assuming your adapter is storing a List of Foo objects. Foo item = mAdapter.getItem(position); item.setValue("blah"); //Or whatever you need to update mAdapter.notifyDataSetChanged(); 来源: https://stackoverflow.com/questions/27344840/how-to-update-an-item-from-arraylist-on-arrayadapter-in

class extends ListActivity “whose id attribute is 'android.R.id.list'”

ⅰ亾dé卋堺 提交于 2019-12-22 15:00:18
问题 I'm trying to extend my main Activity to "ListActivity" (previously extends to: Activity) to use onListItemClick, but the logcat, send me "Your content must-have a ListView whose id attribute is 'android.r.id.list'". (i'm using SQLite for populate the ListView). mi xml is: <ListView android:id="@+id/list" // to "@id/android:list" or other styles (but nothing works) android:layout_width="fill_parent" android:layout_height="fill_parent"/> // or closing with </ListView> this is the complete xml

Limit a listview to 25 items

妖精的绣舞 提交于 2019-12-22 12:45:13
问题 I am displaying a listview programmiclly using the following codes: Below is how the listview is displayed programmatically: messagesList = (ListView) findViewById(R.id.listMessages); messageAdapter = new MessageAdapter(this); I would want to limit the list to 25 items, and where it is not infinite. Below is the layout. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout

Set Limit on ListView multiple section mode

走远了吗. 提交于 2019-12-22 12:18:10
问题 I have an ArrayList of Strings defined called names defined and I add to my ListView object as follows: I create an Array Adapter and set multiple choice mode in both the Array Adapter and ListView object. This works great, I can scroll and pick multiple objects. But the problem is I want to force the user into being able to pick only 4 items from the ListView. How can I set a restriction? adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice,names);

Android: Select first item by default in ListView in Master Detail template

纵饮孤独 提交于 2019-12-22 11:21:21
问题 I program a RSS reader with Master Detail flow with a list view on the left, and a detail view on the right. When the screen is created the right side is empty and no item on the left is selected. How can I load the first item by default? I found this post which is similar to my problem: Select the first item by default in a Master Detail flow The code in my ListFragment looks like this: @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated

Exception Dispatching Input Event and Null Pointer Exception on SwipeRefreshLayout Pull down

走远了吗. 提交于 2019-12-22 10:56:14
问题 I have a swipe to refresh layout (part of android.support.v4 revision 19.1), and when I swipe down on the layout I can get to the point where the top part is full, but swiping down any further will cause the app to crash, and the logcat points to no specific line in my code. Since SwipeRefreshLayout is only a couple of months old, their is not a lot of information on the internet to help me figure out what the problem is. Before I was having trouble adding the support v4 revision 19.1 to my

Horizontal ListView [duplicate]

流过昼夜 提交于 2019-12-22 10:45:09
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How can I make a horizontal ListView in Android? I have used Vertical ListView Many Times but for certain requirements I want to implement the Horizontal ListView, Also list Items will come dynamically.Please help me to get the horizontal Listview. 回答1: The Android API seems to be lacking a Horizontal ListView widget. So In other tutorials, developer are implemented it using Gallery or HorizontalScrolllView .

How to create a context menu on a ListView item in Android? [closed]

放肆的年华 提交于 2019-12-22 10:05:21
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . As i mentioned in photo , i dont know what is this widget? and how to create it and use it in our project? 回答1: What you want is called Quick Actions. I'm sure these projects will be helpful for you: NewQuickAction3D: NewQuickAction3D is a small android library to create QuickAction dialog with Gallery3D app

Resource Not found exception in android

落爺英雄遲暮 提交于 2019-12-22 10:02:28
问题 i am trying to create a listview in my android application. But i am getting Resource Not found Exception while running the project. activity_main.xml : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <include android:id="@+id/title_bar" layout="@layout/title_bar" /> <ListView android:id="@+id/FeedList" android

Reload or notify Fragment's data in ViewPager

China☆狼群 提交于 2019-12-22 10:00:11
问题 I have [main]Fragment with two ViewPagers in it. Each ViewPager contains several Fragments in it. ViewPager 's Fragments obtain data into their ListViews from [main]Fragment . I need to update data in all ListViews , which comes from [main]Fragment . I've tried to remove current [main]Fragment and add new one (reload it), but when I am calling .remove([main]Fragment) or .detach([main]Fragment) methods in .supportFragmentManager() [main]Fragment is not destroying or detaching, it just hiding