android-listview

List View Custom adapter item(button) text repeating on scrolling

我只是一个虾纸丫 提交于 2020-01-03 05:14:43
问题 I am facing problem with listview in android. I've a custom adapter with 3 textviews and a button whose text changes as per response from server. Actually I've a feature of search friend in my app,so the list appears with each user and its status on button text. Like if already friend then button text is Friend and button is disabled.Else Add Friend, and button enabled. After clicking Add Friend text of button changes to Request Sent. But the problem is that when i click on a button text of

android - showing listView in PreferenceActivity

折月煮酒 提交于 2020-01-03 05:04:50
问题 i wish to show a listView on a PreferenceActivity similar to what the android OS wifi-settings has for the list of networks (example here , on the bottom area of the image) . however , such a thing isn't availabe , so i've created a new class that extends Preference , and what i returned in the onCreateView is just a ListView instance . it worked , but the listView has a constant size of about a single item no matter what i do to its layoutParams and no matter what i do to the adapter . even

Filter Android ListView

帅比萌擦擦* 提交于 2020-01-03 05:02:38
问题 I have a list view with items and sub items in each row. I have an EditText field that I want to use to filter the list as text is typed. I want to be able to search the items and sub items. Can someone point me in the right direction on how I can do this? import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text

Where is scrollbar in listView?

会有一股神秘感。 提交于 2020-01-03 04:54:09
问题 In the .xml file, a layout written shows as follow, pls check up, <RelativeLayout xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=

SetTextColor of TextView programmatically

允我心安 提交于 2020-01-03 04:34:05
问题 I have a ListView with a TextView in each row. I have a default color.xml with is set in the row.xml I have different colors for different states <selector xmlns:android="http://schemas.android.com/apk/res/android" > <!-- pressed --> <item android:color="#ffffff" android:state_pressed="true"/> <!-- focused --> <item android:state_selected="true" android:color="#8b8989"/> <!-- default --> <item android:color="#ffffff"/> </selector> This works like a charm. But when Im trying to change the

How to detect a moment when ListView item becomes ActiveView (going off-screen)

限于喜欢 提交于 2020-01-03 03:25:08
问题 According to concept of recycling items mechanism in ListView. I want to know, actually, how i can detect a moment when a View going off-screen . I explain why. In most cases ListView have a custom Adapter(? extends ArrayAdapter / ? extends BaseAdapter, etc.). getView(...) method allows to manipulate visibility and content of views (text,bitmaps,drawables,etc.) And in some cases i need to launch a separate Thread which doing background work, and after that update UI. Actually - using

Listview and row selector not working

为君一笑 提交于 2020-01-03 03:14:08
问题 I'm puzzled with this. I am searching for over 2 hours and cannot understand what is happening. I have a Listview that I want the items (rows) to be selectable. To achieve this, I have a selector that I set as a background to my row layout. The ListView is defined this way in the fragment.xml layout file: <ListView android:id="@+id/lst_friends" android:layout_width="match_parent" android:dividerHeight="1dp" android:divider="#ff0000" android:layout_height="0dp" android:layout_weight="1.0" />

Get data from ListView when clicking ListView's child

ε祈祈猫儿з 提交于 2020-01-03 03:13:13
问题 I have a ListView with one button per row. If I needed to get the data when the row gets clicked, then it would be pretty easy to do the following inside the onItemClickListener: @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { CustomType type = (CustomType) arg0.getItemAtPosition(arg2); //get data related to position arg2 item } }); Actually, the thing is that I need to get the data(i.e: CustomType object) when the button of the ListView's row get's

Custom BaseAdapter ListView onItemClickListener in DrawerLayout Not Called

三世轮回 提交于 2020-01-03 02:49:10
问题 I have a Custom Base Adapter I am using with my ListView in a DrawerLayout. The ListView inflates ok, but I cannot call the onItemClickListener. Here is the onCreate portion of the MainAcitivty, where I set the adapter and the onItemClickListener protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); isPhone = getResources().getString(R.string.screen_type).toString().equals("phone"); mTitle = getResources().getString(R

Update Listview after post new data from dialogfragment

Deadly 提交于 2020-01-03 00:00:38
问题 I am trying to update my listview directly after I submit new data from DialogFragment . But when I call notifyDataSetChanged() it give me an NullPointerException and my app is close. So this is the scenario what I want And this is my code This activity that I use to get data from the server public class LayoutActivity extends Fragment { private ListView listview; private ListItemAdapter theAdapter; String URL = "http://localhost/api/question/get_newest_except/0/0/15"; ProgressDialog pDialog;