Yes I have. I already retrieve the data when the date is the same on the
today's date. But when the date is weekly no data retrieve
On Saturday, December 3, 2016 at 1:06:54 AM UTC+8, Chie Paliza wrote:
>
> Im creating budgeting app. And I want to see the expenses of the user
> weekly but I have a problem, Im getting first the date and compare it in
> the dates in that week but no data
> shown in my recyclerview. This is my code:
>
> recyclerView.requestLayout();
> Log.e("myFirebaseData", "'" + month);
> adapter.cleanup();
>
>
> adapter = new FirebaseRecyclerAdapter<ExpenseData, myViewHolder>(
> ExpenseData.class, R.layout.listitem, myViewHolder.class,
> mRef.orderByChild("date")) {
>
>
> @Override
> protected void populateViewHolder(final myViewHolder viewHolder,
> ExpenseData model, final int position) {
>
>
> java.util.Calendar c = Calendar.getInstance();
> DateFormat format = new SimpleDateFormat("MMMM
> dd, yyyy", Locale.ENGLISH);
> c.setFirstDayOfWeek(Calendar.SUNDAY);
> c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
>
>
> String[] days = new String[7];
> for (int i = 0; i < 7; i++) {
> Log.e("dateTag", format.format(c.getTime()));
> days[i] = format.format(c.getTime());
> c.add(Calendar.DAY_OF_MONTH, 1);
>
> String checkDate = model.getDate();
> if (checkDate.contentEquals(days[i])) {
>
>
>
> viewHolder.DateText.setText(model.getDate());
>
> viewHolder.ExpenseTitleText.setText(model.getExpensetitle());
>
> viewHolder.AmountText.setText(String.valueOf(String.format("%.2f",
> model.getAmount())));
> }
> }
> }
>
> };
>
>
> recyclerView.setAdapter(adapter);
>
>
> }
>
>
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/e5399c00-0ef7-4d7e-b816-eee662e7c67e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.