android-recyclerview

Pass String from Adapter to Fragment using interface

二次信任 提交于 2020-01-14 04:43:12
问题 This is question is based on this answer. I'm trying to pass a string from my RecyclerView.Adapter to my fragment. In my adapter I added the following: onItemClickListner onItemClickListner; public void setOnItemClickListner(VideoAdapter.onItemClickListner onItemClickListner) { this.onItemClickListner = onItemClickListner; } public interface onItemClickListner{ void onClick(String str);//pass your object types. } I pass the following string once the amount of items in my adapter is less then

Horizontal recyclerview inside vertical recyclerview scrolling perfomance

穿精又带淫゛_ 提交于 2020-01-14 04:23:10
问题 I have almost this: https://github.com/RyanHurst/TvProgramRecyclerView. Horizontal recyclerviews as an item of a vertical recyclerview. Every horizontal recyclerview scroll is syncronized (only visible items). Horizotal scrolling is very smooth, but vertical scrolling is really bad. When scrolls in the position 0 on horizontal scroll, it runs very well, but the most you scroll to the right the most laggy it becomes. I tried not to setting the recycler adapter in onBinViewHolder and using a

FirebaseIndexRecyclerAdapter onDataChanged is called but getItemCount() always return 0

别等时光非礼了梦想. 提交于 2020-01-13 19:49:21
问题 I'm using FirebaseIndexRecyclerAdapter which gets a keyRef and dataRef and is very helpful with getting all dataRef's children which their keys exists as children in keyRef. The data is being displayed correctly but if i'm overriding onDataChanged for hiding a progress bar and/or displaying an empty state depends on the itemsCount (Something which i've already done with FirebaseRecyclerAdapter and works as expected) but getItemCount always return 0(!) private class MYAdapter extends

Create RecyclerView item layout based on content of data

烂漫一生 提交于 2020-01-13 19:42:51
问题 I'm creating a recycler view of data objects, each of these object will vary, eg. Obj 1 - String Heading - String Desc - Image Obj 2 - String Desc Obj 3 - Image - String Link Obj 4 - String Desc - Video etc So I need to create my item layout dynamically to suit each data object. I don't want to create an item layout with all the possible views and components and show and hide as I feel it's bad practice. So my issue is I need to access an object from the list using the position in the

kotlin.UninitializedPropertyAccessException: lateinit property roomClickedInterface has not been initialized

丶灬走出姿态 提交于 2020-01-13 19:42:12
问题 I am trying to follow Pusher Chatkit's tutorial for "BUILDING A GROUP CHAT APP USING KOTLIN AND PUSHER CHATKIT" however I am running into an issue with the Recycler View adapter. FYI, I am still learning Kotlin. I've been reading up on lateinit vars but I can't find anything that addresses this case. The error occurs in the recycler view adapter. This is the error I get: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.android_myneighborsbookshelf, PID: 26692 kotlin

Create RecyclerView item layout based on content of data

和自甴很熟 提交于 2020-01-13 19:41:08
问题 I'm creating a recycler view of data objects, each of these object will vary, eg. Obj 1 - String Heading - String Desc - Image Obj 2 - String Desc Obj 3 - Image - String Link Obj 4 - String Desc - Video etc So I need to create my item layout dynamically to suit each data object. I don't want to create an item layout with all the possible views and components and show and hide as I feel it's bad practice. So my issue is I need to access an object from the list using the position in the

RecyclerView onScrolled not called when use scrollToPosition

强颜欢笑 提交于 2020-01-13 13:31:48
问题 I have RecyclerView.OnScrollListener like this findViewById(R.id.button_scroll_to_position).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mLinearLayoutManager.scrollToPositionWithOffset(2,0); } }); mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); Log.i("TAG", "scroll " + dy); } }); ArrayList<String> list = new

RecyclerView drawing offscreen, can't scroll bottom item into view

狂风中的少年 提交于 2020-01-13 10:15:10
问题 Using Design Support Library 22.2.1, with the following View hierarchy: <DrawerLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Toolbar android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" /> <TabLayout android:layout_width

Testing RecyclerView if it has data with Espresso

依然范特西╮ 提交于 2020-01-13 09:54:27
问题 I need to write a test to click, let's say on the first item in my RecyclerView. At some cases the RecyclerView will be empty and therefore if I click on the position with 0 index it will fail. How do I write a test like this? To check first if the recyclerView not empty and then click on the specific position? 回答1: There are a little bit different scenarios in question and in the comment. Let's implement the next test scenario: If recycler view does not contain anything, do nothing. If

Testing RecyclerView if it has data with Espresso

萝らか妹 提交于 2020-01-13 09:54:09
问题 I need to write a test to click, let's say on the first item in my RecyclerView. At some cases the RecyclerView will be empty and therefore if I click on the position with 0 index it will fail. How do I write a test like this? To check first if the recyclerView not empty and then click on the specific position? 回答1: There are a little bit different scenarios in question and in the comment. Let's implement the next test scenario: If recycler view does not contain anything, do nothing. If