android-recyclerview

How to implement StackLayoutManager in android Vertical RecyclerView

一笑奈何 提交于 2019-12-24 07:50:45
问题 I want to implement stack of cards from bottom to top swipe each overlap previous card stack.Someone implement this using RecyclerView with custom Layout manager.I don't have enough code. How to do this using Recyclerview. 回答1: Try this way: public class StackLayoutManager extends LinearLayoutManager { public StackLayoutManager(Context context) { super(context); setStackFromEnd(true); } @Override public RecyclerView.LayoutParams generateDefaultLayoutParams() { return new RecyclerView

Only first CardView of RecyclerView is being Colored

妖精的绣舞 提交于 2019-12-24 07:38:39
问题 I have created an app in Android Studio, using CardViews in RecyclerView in connection with Firebase Realtime database, in which user can check his attendance such that if the user came on a holiday(R,G, Saturday or Sunday) that CardView is colored. But in my code only the first CardView is getting colored. I have checked through Log statements that it's traversing through both R and G's if-else statements. My code is: public class frag2ofAttendanceNew extends Fragment { String

Recylerview not automatically loading data from firebase Android Studio

不羁的心 提交于 2019-12-24 07:38:15
问题 I have tried everything but my data from firebase is not getting loaded automatically when I open the app and I have to click a edittext to load the data. I have tried adapter.Update(data); recycler.invalidate(); notifyDataSetChanged(); adapter.notifyDataSetChanged(); Please can someone help me out. EDITED: I am saving to firebase like this: public FirebaseHelper(DatabaseReference db) { this.db = db; } //WRITE IF NOT NULL public Boolean save(Spacecraft spacecraft) { if(spacecraft==null) {

How to resolve addInArray exception and removeFromArray exception in recyclerView Android?

孤街醉人 提交于 2019-12-24 07:35:59
问题 Whenever I try to load data in custom recycler view as a grid layout then view gets disappear suddenly but sometimes its load the data perfectly. I have used recycler view under nested scroll view under swipe refresh layout. I have tried everything given on this link "RecyclerView addInArray error when adding" but nothing helps. protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.near_me_list_layout); recyclerView

How do I pass values from RecyclerView to AnotherActivity with POJO class?

巧了我就是萌 提交于 2019-12-24 07:29:40
问题 I have a POJO class. It holds some Strings and I want to pass values from RecyclerView to an Activity . I tried something and failed. How do I do that? Model public class DetailModel { String title; public DetailModel() { } public DetailModel(String title) { this.title = title; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } Adapter, onClick holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick

RecyclerViewActions returns NoMatchingViewException in Espresso Android Testing

假如想象 提交于 2019-12-24 07:24:11
问题 I'm using this line of code to perform a click on RecyclerView 's list at position 0. onView(withId(R.id.rv)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); But it's not working and returns NoMatchingViewException . But, when I perform a click operation on TextView (which is inside the RecyclerView layout), it's working and testing is passing, as shown in the line of code below, onView(allOf(result(withId(R.id.tv), 0), isDisplayed())).perform(click()); Am I using the

Recyclerview in fragmnet using volley json data?

六眼飞鱼酱① 提交于 2019-12-24 06:44:16
问题 please any one explain RecyclerView in fragment using volley to get json data. Already i refered below link coding Google recyclerview in fragment this is my first project in android, so i cannot understand that coding. Please any one help me. My fragmnet Coding: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View drawer = inflater.inflate(R.layout.fragment_progress, container, false); orderLists = new ArrayList<>(); getProgressData();

Recyclerview in fragmnet using volley json data?

亡梦爱人 提交于 2019-12-24 06:44:02
问题 please any one explain RecyclerView in fragment using volley to get json data. Already i refered below link coding Google recyclerview in fragment this is my first project in android, so i cannot understand that coding. Please any one help me. My fragmnet Coding: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View drawer = inflater.inflate(R.layout.fragment_progress, container, false); orderLists = new ArrayList<>(); getProgressData();

How to drag and drop an image from a Recycler view and place it outside of it into another layout

喜你入骨 提交于 2019-12-24 06:43:01
问题 I have a horizontal Recylcer view which holds a list of items. Each item has a text view and image view to represent the item (e.g an image of a square and the text "Square" above the image). The recylcer view is inside of it's own relative layout positioned at the top of the screen. What I need to do is drag an image from the recycler view and drop it outside of it into another layout that is below this one. However, the image that is dragged from the recycler view must not be removed, but

Can not perform this action after onSaveInstanceState on RecyclerView item click

℡╲_俬逩灬. 提交于 2019-12-24 06:13:52
问题 I have java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState after turning my device (changing configuration) and clicking on item in RecyclerView. Clicking on RecyclerView item have to start a new fragment. Here is on item click method in MainActivity: public class MainActivity extends AppCompatActivity implements MyFragment.OnFragmentInteractionListener, ListAdapter.OnRecyclerViewItemClickListener{ // ... some code ... @Override public void