android-listview

Filter in listview did not filter from the full list, but from already filtered list

徘徊边缘 提交于 2021-02-11 17:19:30
问题 I have an listview with filter. When I input some words in an edittext that I used as a filter for example "david", it works well, items in the list are filtered and it will show all item that contains "david". But when I delete some words, for example "dav", the list is still filtered, but it filtered from the last filtered by "david". Let's say I had 40 items, filtered by "david", it becomes 24 items. Then I filtered it again with "dav", it filtered from the "24 items" one, not the "40

My List is being sorted by the alphabetical order after sorting by date while I'm adding the 4-5 items in my List

廉价感情. 提交于 2021-02-11 15:14:33
问题 My List is being sorted by the alphabetical order after sorting by date while I am adding extra 4-5 items in my List with different names. I want to sort my List by date and time only. here I have shared my code please help me to do so. thanks in advance. // Filters All patient to keep only single latest record of each patient id private List<PatientData> filterPatients(List<PatientData> allPatientData) throws ParseException { HashMap<String ,Pair<PatientData,Date>> filtered = new HashMap<>()

My List is being sorted by the alphabetical order after sorting by date while I'm adding the 4-5 items in my List

我的梦境 提交于 2021-02-11 15:14:23
问题 My List is being sorted by the alphabetical order after sorting by date while I am adding extra 4-5 items in my List with different names. I want to sort my List by date and time only. here I have shared my code please help me to do so. thanks in advance. // Filters All patient to keep only single latest record of each patient id private List<PatientData> filterPatients(List<PatientData> allPatientData) throws ParseException { HashMap<String ,Pair<PatientData,Date>> filtered = new HashMap<>()

How to reach the last items of a scroll view?

一个人想着一个人 提交于 2021-02-08 10:06:27
问题 I'm trying to display a list in a fixed size scrollview, at first it was the first items who weren't showing and I fixed it but now it's the last ones that aren't reachable. Here is my xml code: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout

listview getChildAt() Return null

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-07 06:56:20
问题 I have been working on an android project and stuck in a problem. I googled it but found no answer. In my project, there is a fragment named viewsurahfragment and it contains a listview whose id is lv_showquran . I want to highlight the view of the listview at specified index. I am using listview.getchildat() but it return null value. Here is the code for viewsurahfragment. Irrelevant functions are emited. public class ViewSurahFragment extends Fragment { private ListView listView; private

listview getChildAt() Return null

好久不见. 提交于 2021-02-07 06:56:19
问题 I have been working on an android project and stuck in a problem. I googled it but found no answer. In my project, there is a fragment named viewsurahfragment and it contains a listview whose id is lv_showquran . I want to highlight the view of the listview at specified index. I am using listview.getchildat() but it return null value. Here is the code for viewsurahfragment. Irrelevant functions are emited. public class ViewSurahFragment extends Fragment { private ListView listView; private

Append listview with the same variable but different value each time

狂风中的少年 提交于 2021-01-29 14:52:13
问题 I have variable a in a loop, it gives a different string each time I want to add that string in ListView , without overwriting it, i searched for append ListView , but didn't find anything, i always got the last item which is the last a value in the ListView I think I need to use HashMap or foreach, but i don't know how in the image, each line is string a variable, so the variable will change every time 158 word here's my code ArrayList<String> list = new ArrayList<String>(); ArrayAdapter

CheckBox in a row of ListView

不问归期 提交于 2021-01-28 21:54:51
问题 How do I override a CheckBox's default onClick() behaviour? Use case I want the checkBox to reflect some boolean status of the object being rendered in the row view. When the user clicks on the row (including the checkBox), some process will run which may alter the objects state (the boolean variable). Now how do I prevent the CheckBox's default onClick behaviour from kicking in? In other words I want CheckBox.onClick() to call theCustomAdapter.onItemClick() . How do I achieve this? On a

Check if android listview is scrolled down to the last item

▼魔方 西西 提交于 2021-01-28 00:30:24
问题 I have a listview in which there are several items. I want to check whether the list is scrolled down to the last item, in which case I want to run another method.How to do that? 回答1: at first set isLoading = false; in the constructore or onCreate method mListView.setOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int

ListView findViewById returning null

允我心安 提交于 2021-01-27 14:20:55
问题 I'm not using a ListActivity because I want to extend FragmentActivity. Instead I'm trying to use: ListView lv = (ListView) findViewById(R.id.mainListView); Unfortunately lv is null. In my xml I have: <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainListView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > </ListView> I've also tried using different android id's for the list view such as the one you