android-recyclerview

Android - How To retrieve EditText value from RecyclerView in MainActivity

橙三吉。 提交于 2019-12-06 05:31:32
问题 How can I retrieve the value from all EditTexts created by the RecyclerView in MainActivity? In my RecyclerView Adapter I'm extending my inner class: public class MyPersonalAdapter extends RecyclerView.Adapter<MyPersonalAdapter.MyPersonalViewHolder> I'm getting a reference to the EditText in that inner class: class MyPersonalViewHolder extends RecyclerView.ViewHolder { TextView numberTextView; EditText nameEditText; public MyPersonalViewHolder(View itemView) { super(itemView); numberTextView

Get recyclerview listener in another class

[亡魂溺海] 提交于 2019-12-06 05:25:56
I have a main activity that displays an ImageView and below that a RecyclerView . In the adapter for the RecyclerView I implemented onClickListner on the view holder and it is working fine. However I need the click to set the image in the main activity when the button is clicked but I cannot see anyway to implement a listner in the main activity to get the results from the adapter to the main activity. I tried the using the onClick as below but that gives a null pointer exception . class AddVideoTitleViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView

Android: Changing visibility of a view in recyclerView

佐手、 提交于 2019-12-06 05:07:54
问题 I have implemented a recyclerView in my project. I have a Button in my recyclerView row . The code for my each row of recyclerView is like this: savedmessage_custom_row.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="4dp" android:background="#ffffff" android:orientation="vertical"> <TextView android:id="@+id/message" android:layout

Android scrolling function in cardView + RecyclerView layout

半世苍凉 提交于 2019-12-06 05:03:41
In my application I have first the cardview and then RecyclerView. Using my existing code I am able to scroll the whole page. But I want that I can also scroll only the card view items. Currently when I try to scroll cardview the complete layout is scrolled. My current code:- <android.support.design.widget.AppBarLayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id

View Recycling not happens with Multiple Recyclerview inside NestedScrollView

若如初见. 提交于 2019-12-06 04:55:42
I am stuck with a issue in managing Multiple Recyclerview recycling inside a NestedScrollView . Let me tell what I am trying to do - I have two frame layouts i.e. frame1 and frame2. I have two fragments containing recyclerview , First fragment's recyclerview showing items horizontally while second fragment's recyclerview showing list Vertically. Now I have put both FrameLayout inside a NestedScroolView , frame1 recyclerview is recycling all the view's properly but frame2 recylerview is not recycling the view , dont know why ? it first load all items then shows on screen. Some Code :

Set gravity programmatically for item in RecycerView Android

元气小坏坏 提交于 2019-12-06 04:42:29
问题 I am using RecyclerView Android to make a chat line with left/right message box. I want to set gravity to item of RecyclerView. In normally way, I cast itemView to LinearLayout and then set ParamLayout gravity for it. But if RecyclerView, it seems not right to cast to LinearLayout. It will return RecyclerView.LayoutParams. Because of: LayoutParams subclass for children of RecyclerView. Custom layout managers are encouraged to create their own subclass of this LayoutParams class to store any

How to update Recyclerview data from another activity

荒凉一梦 提交于 2019-12-06 04:42:23
I have two activities MainActivity and Addlogactivity i am updating a data in Addlogactivity which should be displayed in mainactivity recyclerview the data is not updating in database MianActivityClass : public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor>{ RecyclerView recyclerView; Intent addDisplay; Mainrow_Adapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); recyclerView = (RecyclerView)findViewById(R.id.listView); addDisplay = new Intent

Update text within card view list?

江枫思渺然 提交于 2019-12-06 04:21:32
So I have a recyclerview list of card views.I am trying to update the text time text in each view when the user clicks the card, and then reset it back when time has past. I set up an internal method in recyclerviewadapter but when I call updateTimes (calling from fragment), it does not reset the text back. Can someone instruct me on what I'm doing wrong? import java.util.ArrayList; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.net.Uri; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content

Best way to notify RecyclerView Adapter from Viewholder?

痴心易碎 提交于 2019-12-06 04:20:02
问题 I have a RecyclerView with multiple item view types so they are broken into separate ViewHolder classes. Before, when all the ViewHolders were in the same class as the RecyclerView Adapter, I could update the adapter directly when an item was clicked or deleted. However, I separated the ViewHolders into different classes to better organize the code. Now, I cannot directly update my RecyclerView Adapter. Which of the following solutions is the best way to communicate from my ViewHolder to my

Save scroll state in nested RecyclerView

笑着哭i 提交于 2019-12-06 04:16:14
问题 I have a problem in my application. I have main list (recycler view). This list keeps 20 horizontal recycler views. It looks really similar like Netflix app. I need to keep state of every "carousel" in main list. If I move first item to right, next to left, scroll down (first and second items are recycled), rotate the screen, scroll up, I need to have restored position of first and second element. I know that I should use linearLayout.saveOnInstanceState and onRestoreState but my problem is