android-recyclerview

Android - Long Click on RecyclerView item and ContextMenu

眉间皱痕 提交于 2020-01-03 13:01:25
问题 Problem: Cannot display a context menu showing a "delete" option" when longclicking on an item within a recyclerview Result expected: see image below I'm almost there, but I'm missing something to make the contextMenu displayed on a longClick. Here is what I put in the viewHolder. I don't know what I should add and where to display the context menu in the onLongClick event. I skipped some lines of code and kept the ones relevant to my question. Thanks a lot for your assistance, My interface

Unable to write an algorithm for filtering out items in a RecyclerView based on a long saved with each item

流过昼夜 提交于 2020-01-03 08:53:23
问题 I have several items in a RecyclerView and each item has a long value saved with it. I'm using FastAdapter as the adapter for my RecyclerView . Suppose there are 7 items in the RecyclerView with the long values: 11122 , 12321 , -98811 , 8870 , -88009 , 3398 , and -22113 . So, what I want to do is, I want to filter the items based on the above given long values using this logic: if (l <= 1000) { // show items with long value <=1000 } else if (l > 1000) { // show items with long value >1000 } I

Unable to write an algorithm for filtering out items in a RecyclerView based on a long saved with each item

て烟熏妆下的殇ゞ 提交于 2020-01-03 08:52:51
问题 I have several items in a RecyclerView and each item has a long value saved with it. I'm using FastAdapter as the adapter for my RecyclerView . Suppose there are 7 items in the RecyclerView with the long values: 11122 , 12321 , -98811 , 8870 , -88009 , 3398 , and -22113 . So, what I want to do is, I want to filter the items based on the above given long values using this logic: if (l <= 1000) { // show items with long value <=1000 } else if (l > 1000) { // show items with long value >1000 } I

Recyclerview with a different last item as “add” item

僤鯓⒐⒋嵵緔 提交于 2020-01-03 08:51:07
问题 I am trying to create a layout with a list of items, where the last item is a button to add a new item of the "standard" type. It should be something like Google Keep lists, with a permanent "add" item at the end of the list. Google Keep list example I have tried two ways to achieve it. The first one is very simple, but I find a problem. The second one is not that simple, and the performance is worse. In addition, I think with the second way I am using RecyclerView in a way that is not

Multiple selected items RecyclerView in Activity.java

戏子无情 提交于 2020-01-03 08:32:38
问题 I have a RecyclerView with data from local JSON in CardView . I need to implement on selected items when one or some item clicked(change background the item selected or highlight) (like edit in Line App ) but without Button or longpress . But I don't want to use StateListDrawable or (using XML) because I have some JSON data which need to process later. I need a state in my Activity like a boolean value or something to save every item which I clicked but I don't have any solution again. I have

How can I make work ViewPager with RecyclerView inside NestedScrollView

寵の児 提交于 2020-01-03 08:32:13
问题 I am using NestedScrollView with ViewPager. NestedScrollView has a LinearLayout inside with some TextViews, TabLayout and ViewPager at the end. TextViews occupy most of the space and for ViewPager left a little space. ViewPager using two fragments, in one of them there is a few TextViews and ImageViews and in another fragment there is a RecyclerView. When I set ViewPager's height to WRAP_CONTENT it takes only space that left and I can't scroll to see the rest of the first fragment, and the

Get the contacts list from phone and display it using RecyclerView and implement SearchView functionality to search

泪湿孤枕 提交于 2020-01-03 06:46:09
问题 In this I am able to get the details of my contacts. But not using RecyclerView. It is using ListView. It is using SimpleCursorAdapter. I don't know how to use SimpleCursorAdapter in RecyclerView. I know how to use RecyclerView with constants String to display. But in this I want to retrieve data using Contacts DB. Please Help me I am new to android. I don't know how to implement this. Thanks in advance public class MainActivity extends AppCompatActivity { SimpleCursorAdapter mAdapter;

RecyclerView lagging inside ScrollView

拟墨画扇 提交于 2020-01-03 06:36:13
问题 I have multiple RecyclerView inside a ScrollView and RecyclerView load data from the server. RecyclerView working very slow when I scroll down it lagging. How can I solve it? <Scrollview> <LinearLayout> <Recyclerview> <Recyclerview> </LinearLayout> </Scrollview> 回答1: Usually, when a RecyclerView has scrolling performance issues, it's because a) You're doing too much work in onBindView, which is called every time a new item comes on screen. b) The views you're displaying reference objects

how to pass Position wise object data one activity to another using recyclerview and databse in android

北战南征 提交于 2020-01-03 03:52:05
问题 I have create the recycerview and this recycerview display the Person image ,person name and + button when i have press + button change the button image like true.and after recycerview bottom one button this button click all data show the next activity.. My Adapter public class BuildCustomAdapter extends RecyclerView.Adapter<BuildCustomAdapter.MyViewHolder> implements Filterable { private List<People> peopleList; private List<People> peopleListCopy; private ItemFilter mFilter = new ItemFilter

Scrollable MapView inside of a RecyclerView: dispatchTouchEvent vs onTouchEvent

倖福魔咒の 提交于 2020-01-03 03:36:12
问题 I'm trying to have a scrolling MapView inside of a RecyclerView, therefore I'm setting requestDisallowInterceptTouchEvent() before and after the TouchEvent. The odd thing is: this does work if I set it in the dispatchTouchEvent() method, but it doesn't work if I do the same in the onTouchEvent() method. Can somebody explain why I cannot set this in onTouchEvent() ? Working: public class WorkingScrollableListItemMapView extends MapView { // constructors @Override public boolean