android-recyclerview

Can't restore scroll position after rotation (RecyclerView)

♀尐吖头ヾ 提交于 2020-01-24 22:12:46
问题 Can't restore the scroll posiotn of RecyclerView after rotation and after I close the app and open it again. In the first case I could use android:configChanges in Manifest, but it doesn't help after I reopen the app. Here is my code. After trying restore the state I see an empty screen without my list. public class MainActivity extends AppCompatActivity implements IMainContract.View { private final String BUNDLE_RECYCLER_LAYOUT = MainActivity.class.getSimpleName() + ".save.state.list";

Getting IndexOutOfBoundsException only when resume Activity

徘徊边缘 提交于 2020-01-24 21:50:19
问题 My problem is that my App crashes when the MainActivity gets resumed. The error is an IndexOutOfBoundsException , unfortunately without a specific line. And the error says Index: 0, Size: 0 . As I know this means that my ArrayList is null and I call it before I initialize it. But I searched since days after that case. I didn't find anything. So first here is the Error: 08-28 13:10:24.232 18741-18741/com.test.test.test E/AndroidRuntime: FATAL EXCEPTION: main Process: com.test.test.test, PID:

Overlap view after delete item in RecyclerView

泪湿孤枕 提交于 2020-01-24 20:58:32
问题 Removing item in RecyclerView cause view overlap like this video Link fragment_feed.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" /> In Adapter

RecyclerView dependencies in android(androidx)?

我的梦境 提交于 2020-01-24 20:18:28
问题 I used implementation 'com.google.android.material:material:1.0.0' for RecycleView. In layout when I'm typing "recycle" it gives suggestion as androidx.appcompat.app.AlertController$RecycleListView which is not what I want. Even though I'm typing this androidx.recyclerview.widget.RecyclerView it works but it doesn't let used attributes like id, height, width, etc. inside. It was working fine one month ago like it was giving proper suggestion now it completely not showing for RecycleView. Does

how to update a specific item (cardview) in recyclerview OnActivityResult

荒凉一梦 提交于 2020-01-24 19:40:25
问题 I have a Fragment inside MainActivty, and inside this Fragment RecyclerView of Articles with cardView (inside this card i have like button and like counter) and when the user click on the cardView will open DetailsActivity that and I want when onBackPressed to update just this item depends on the data changed (like button and like counter) in DetailsActivity how to update just this Item ? sorry for bad English! 回答1: First update the data of that specific position item of adapter. After that

how to update a specific item (cardview) in recyclerview OnActivityResult

两盒软妹~` 提交于 2020-01-24 19:40:06
问题 I have a Fragment inside MainActivty, and inside this Fragment RecyclerView of Articles with cardView (inside this card i have like button and like counter) and when the user click on the cardView will open DetailsActivity that and I want when onBackPressed to update just this item depends on the data changed (like button and like counter) in DetailsActivity how to update just this Item ? sorry for bad English! 回答1: First update the data of that specific position item of adapter. After that

Kotiln: pass data from adapter to activity

微笑、不失礼 提交于 2020-01-24 10:32:20
问题 I try to pass my data from the adapter to my other activity with a putExtra but when I click on an item in my list to move to my second activity , no data is retrieved and the default text I put in is not displayed. another way to do? or What do I miss about it? Here my code : My onBindViewHolder : override fun onBindViewHolder(holder: AlbumsListViewHolder, position: Int) { val AlbumsData = albumsData!![position] holder.albumsName.text = AlbumsData.title Glide.with(holder.itemView) .load

Searching a LiveData of PagedList in RecyclerView by Observing ViewModel

人盡茶涼 提交于 2020-01-24 03:40:06
问题 With android Paging library it is really easy to load data from Database in chunks and ViewModel provides automatic UI update and data survival. All these frameworks modules help us create a great app in android platform. A typical android app has to show a list of items and allows user to search that list. And this what I want to achieve with my app. So I have done an implementation by reading many documentations, tutorials and even stackoverflow answers. But I am not so sure whether I am

RecyclerView onScrolled not being fired at all

依然范特西╮ 提交于 2020-01-24 01:09:08
问题 I am planning to create a paginated scroll-to-bottom RecyclerView. But the onScrolled callback isn't being fired at all: mBooksRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); Log.i("Dale", "scrolled"); } }); mBooksRecyclerView.setNestedScrollingEnabled(false); if (Utils.hasContent(books)) { mBooksRecyclerView.setVisibility(View.VISIBLE);

Passing variable(position) from onBindViewHolder to ViewHolder class

蓝咒 提交于 2020-01-24 00:56:26
问题 I am trying to pass a String ( userID ) from the onBindViewHolder to my ViewHolder class. The reason behind this is that I need the position to allocate the correct postID. This postID is used in the ViewHolder as a reference to set up a Firebase valueEventListener . However, when running the app I get a NullPointerException on the postID. Is this due to synchronization? Is the valueEventListener called before postID is set? public void onBindViewHolder(RecyclerView.ViewHolder holder, int