android-recyclerview

Pass the Current ItemId from RecyclerAdapter to Different class

微笑、不失礼 提交于 2020-06-17 09:42:58
问题 I want to pass the current ItemID position of Adapter to another class.But the problem is whenever I toggle the position from the next class It always starts from zero position. I've used the getItemId to get the position of card but the problem is whenever I use The position in IngameWrkfunction to get the data ,it always fetch the data from the initial point not from the current page. RecyclerAdapterClass package com.example.apptuzzle; import android.content.Context; import android.content

RecyclerView flows over the screen

断了今生、忘了曾经 提交于 2020-06-17 09:37:48
问题 I have a fragment that replaces FrameLayout. In this fragment, if I had only RecyclerView, I could set its height to match_parent and everything could work well. However, if I have multiple elements that need to be over the top of RecyclerView, the RecyclerView cannot be fit into the screen. Code for the first scenario: <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools=

Cannot resolve Symbol id

拟墨画扇 提交于 2020-06-17 09:11:49
问题 I have a recylcerView calles "Notes", I'm trying to add an new recylerview called "Assignments" wich will be created inside the notes recylerview item. When I click on a recylerview item (notes) it send me to ClassworkActivity in wich the assignments' recyclerview will be added to it. So I want to add the assignment recyclerview as a child of the notes recyclerview. Here's what I tried : final AssignmentAdapter assignmentAdapter=new AssignmentAdapter(assignlist,this); recyclerView.setAdapter

Cannot resolve Symbol id

蹲街弑〆低调 提交于 2020-06-17 09:10:30
问题 I have a recylcerView calles "Notes", I'm trying to add an new recylerview called "Assignments" wich will be created inside the notes recylerview item. When I click on a recylerview item (notes) it send me to ClassworkActivity in wich the assignments' recyclerview will be added to it. So I want to add the assignment recyclerview as a child of the notes recyclerview. Here's what I tried : final AssignmentAdapter assignmentAdapter=new AssignmentAdapter(assignlist,this); recyclerView.setAdapter

Kotlin using Gson to deserialize local json file

落爺英雄遲暮 提交于 2020-06-17 00:08:57
问题 I want to deserialize a local json file using Gson to create a recyclerview. However I get an IllegalStateException on below line. val homeFeed = gson.fromJson(json, HomeFeed::class.java) My json file is saved under an assets folder and believe the program reads the data fine but somehow cannot convert it into my HomeFeed model object. Error below: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $

Kotlin using Gson to deserialize local json file

雨燕双飞 提交于 2020-06-17 00:07:48
问题 I want to deserialize a local json file using Gson to create a recyclerview. However I get an IllegalStateException on below line. val homeFeed = gson.fromJson(json, HomeFeed::class.java) My json file is saved under an assets folder and believe the program reads the data fine but somehow cannot convert it into my HomeFeed model object. Error below: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $

An incorrect clicked item in the new activity from RecycleView

大城市里の小女人 提交于 2020-06-16 17:26:03
问题 I have got a problem in my code: I cannot see a properly clicked item in the new activity "CrimePagerActivity" from RecycleView . I can see another item from the list in this activity ( ViewPager ). I have found the issue here, in this row of code: Intent intent = CrimePagerActivity.newIntent(getActivity(), mCrime.getId()); I get an incorrect item from mCrime.getId() . Unfortunately, I do not know how to fix it. Maybe someone can help me? My code and some of my layouts are below. Crime.java

Android Kotlin: java.lang.IllegalStateException

怎甘沉沦 提交于 2020-06-16 03:54:26
问题 This is an extension to Kotlin using Gson to deserialize local json file that I posted earlier. I want NewsFragment.kt to instantiate an adapter but am unable to access to the recyclerview id worldnews. I get "java.lang.IllegalStateException: worldnews must not be null" when the program tries to execute the code below: activity?.runOnUiThread { worldnews.adapter = MainAdapter(homeFeed) } NewsFragment.kt: class NewsFragment : Fragment() { var arr = arrayListOf<String>() override fun onCreate

Delete Item from RecyclerView and Realm DB

陌路散爱 提交于 2020-06-12 18:06:52
问题 Image I have an EditText which adds items to this RecyclerView and to the Realm DB. That works fine. The problem is that I don't know how to remove those items from both the RecyclerView and from the Realm DB. Should this be done on the Fragment or on the adapter? And how? Thanks! There is an image on top showing a screenshot of the app. Here is the Fragment where the RecyclerView is: public class FragmentMyList extends Fragment{ private RecyclerView recyclerView; private EditText editTxt;

Delete Item from RecyclerView and Realm DB

坚强是说给别人听的谎言 提交于 2020-06-12 18:04:57
问题 Image I have an EditText which adds items to this RecyclerView and to the Realm DB. That works fine. The problem is that I don't know how to remove those items from both the RecyclerView and from the Realm DB. Should this be done on the Fragment or on the adapter? And how? Thanks! There is an image on top showing a screenshot of the app. Here is the Fragment where the RecyclerView is: public class FragmentMyList extends Fragment{ private RecyclerView recyclerView; private EditText editTxt;