Picasso Library Not Working In RecyclerView in android - java

So im having this issue in my adapter to were when i go to set the Picasso method to convert my image url it will not allow me to pass the context no matter how i do it. i Have tried this and The class name .this neither seem to work. Not sure what or why this is happening. Here is the adapter class that im having issues with.
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ContentViewHolder> {
public content[] mDataset;
public MyAdapter(content[] data) {
mDataset = data;
}
#Override
public ContentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.test, parent, false);
ContentViewHolder viewHolder = new ContentViewHolder(view);
return viewHolder;
}
#Override
public void onBindViewHolder(ContentViewHolder holder, int position) {
holder.bindContent(mDataset[position]);
}
#Override
public int getItemCount() {
return mDataset.length;
}
public class ContentViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView mUrl;
public TextView mTitle;
public TextView mDate;
public TextView mAuthor;
public ImageView mThumbnail;
public ContentViewHolder(View itemView) {
super(itemView);
mUrl= (TextView) itemView.findViewById(R.id.url);
mTitle = (TextView) itemView.findViewById(R.id.title);
mDate = (TextView) itemView.findViewById(R.id.date);
mAuthor = (TextView) itemView.findViewById(R.id.author);
mThumbnail =(ImageView)itemView.findViewById(R.id.thumbnail);
}
public void bindContent(content bloginfo) {
mUrl.setText(bloginfo.getUrl());
mTitle.setText(bloginfo.getTitle());
mDate.setText(bloginfo.getDate());
mAuthor.setText(bloginfo.getAuthor());
Picasso.with(context).load(bloginfo.getThumbnail()).into(mThumbnail);
}
#Override
public void onClick(View view) {
}
}
}

Ok so i got this to work here is the working adapter code below. Thank you all for your help.
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ContentViewHolder> {
public content[] mDataset;
private Activity activityContext;
public MyAdapter(Activity context,content[] data) {
mDataset = data;
activityContext = context;
}
#Override
public ContentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.test, parent, false);
ContentViewHolder viewHolder = new ContentViewHolder(view);
return viewHolder;
}
#Override
public void onBindViewHolder(ContentViewHolder holder, int position) {
holder.bindContent(mDataset[position]);
}
#Override
public int getItemCount() {
return mDataset.length;
}
public class ContentViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView mUrl;
public TextView mTitle;
public TextView mDate;
public TextView mAuthor;
public ImageView mThumbnail;
public ContentViewHolder(View itemView) {
super(itemView);
mUrl= (TextView) itemView.findViewById(R.id.url);
mTitle = (TextView) itemView.findViewById(R.id.title);
mDate = (TextView) itemView.findViewById(R.id.date);
mAuthor = (TextView) itemView.findViewById(R.id.author);
mThumbnail =(ImageView)itemView.findViewById(R.id.thumbnail);
}
public void bindContent(content bloginfo) {
mUrl.setText(bloginfo.getUrl());
mTitle.setText(bloginfo.getTitle());
mDate.setText(bloginfo.getDate());
mAuthor.setText(bloginfo.getAuthor());
Picasso.with(activityContext).load(bloginfo.getThumbnail()).into(mThumbnail);
}
#Override
public void onClick(View view) {
}
}
}

This
Picasso.with(MyAdapter.this)
should be
Picasso.with(context)
Use Activity Context. This can be passed to the constructor of adapter class from activity.
http://developer.android.com/reference/android/content/Context.html
http://square.github.io/picasso/
Samples available on github
https://github.com/square/picasso/blob/master/picasso-sample/src/main/java/com/example/picasso/PicassoSampleAdapter.java

In your adapter you can make:
private Activity activityContext;
then in Adapter contructor:
public MyAdapter(Activity context, content[] data) {
mDataset = data;
activityContext = context;
}
Finally call:
Picasso.with(activityContext).load(bloginfo.getThumbnail()).into(mThumbnail);
If you create your Adapter in your Activity you need to create it using:
new myAdapter(this, YOURDATA), if you create it in Fragment, you need to use new myAdapter(getActivity(), YOURDATA).

Picasso.with(mThumbnail.getContext()).load(bloginfo.getThumbnail()).into(mThumbnail);

Related

How to send data from RecyclerView to edit text in the same activity using adapter? (Android)

I have a problem in my code, I want to send the data I clicked from the RecyclerView to edit text in the same activity
My adapter:
public class RecyclerViewAdapter1 extends RecyclerView.Adapter<RecyclerViewAdapter1.ViewHolder> {
private Context context;
private List<Result> results;
public RecyclerViewAdapter1(Context context, List<Result> results) {
this.context = context;
this.results = results;
}
#Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.arraylist1, parent,false);
ViewHolder holder = new ViewHolder(v);
return holder;
}
#Override
public void onBindViewHolder(ViewHolder holder, int position) {
Result result = results.get(position);
holder.textViewid.setText(result.getRef_desa_id());
holder.textViewNm_desa.setText(result.getNama_desa());
}
#Override
public int getItemCount() {
return results.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
#BindView(R.id.txtid)
TextView textViewid;
#BindView(R.id.txtnm_desa)
TextView textViewNm_desa;
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
#Override
public void onClick(View v) {
String id = textViewid.getText().toString();
Intent i = new Intent(context, DaftarDukaActivity2.class);
((Activity)context).finish();
i.putExtra("id", id);
context.startActivity(i);
}
}
}
In the code above, my coding has succeeded in displaying data to another Edit text activity. I want to ask, how to send data from the RecyclerView I clicked to EditText in the same activity?
Do you want editText.setText() from reacyclerview adapter? You can do like this:
public class RecyclerViewAdapter1 extends RecyclerView.Adapter<RecyclerViewAdapter1.ViewHolder> {
private Context context;
private List<Result> results;
private EditText editText;
public RecyclerViewAdapter1(Context context, List<Result> results,EditText editText) {
this.context = context;
this.results = results;
this.editText=editText;
}
#Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.arraylist1, parent,false);
ViewHolder holder = new ViewHolder(v);
return holder;
}
#Override
public void onBindViewHolder(ViewHolder holder, int position) {
Result result = results.get(position);
holder.textViewid.setText(result.getRef_desa_id());
holder.textViewNm_desa.setText(result.getNama_desa());
}
#Override
public int getItemCount() {
return results.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
#BindView(R.id.txtid)
TextView textViewid;
#BindView(R.id.txtnm_desa)
TextView textViewNm_desa;
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
#Override
public void onClick(View v) {
String id = textViewid.getText().toString();
editText.setText(id);
}
}
}
Usage
public class MainActivity extends AppCompatActivity{
private Context context=this;
private List<Result> results;
private EditText editText;
private RecyclerView rec;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText=findViewById(R.id.my_edit_text_id_in_xml);
rec=findViewById(R.id.my_recycler_view_id);
// add items to your result List
rec.setAdapter(new RecyclerViewAdapter1(context,results,editText));
rec.setLayoutManager(new LinearLayoutManager(context));
}
}

Facing error in onBindView() method in recyclerView

I am just practicing the RecyclerView. when I run the App my App crashed I check the log but i cant understand the problem can some help me im waiting for someone responce?
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
private model[] localDataSet;
private TextView name,number;
public static class ViewHolder extends RecyclerView.ViewHolder {
private final TextView textView;
public ViewHolder(View view) {
super(view);
textView = (TextView) view.findViewById(R.id.name);
}
public TextView getTextView() {
return textView;
}
}
public CustomAdapter(model[] dataSet) {
localDataSet = dataSet;
}
#Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
// Create a new view, which defines the UI of the list item
View view = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.contacx, viewGroup, false);
view.findViewById(R.id.name);
view.findViewById(R.id.number);
return new ViewHolder(view);
}
// Replace the contents of a view (invoked by the layout manager)
#Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
name.setText(localDataSet[position].getName());
number.setText(localDataSet[position].getPhone());
}
#Override
public int getItemCount() {
return localDataSet.length;
}
}
You need to change the following things in your code:
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
private model[] localDataSet;
//remove this from here.
//private TextView name,number;
public static class ViewHolder extends RecyclerView.ViewHolder {
//This should be from the layout you have passed in ViewHolder method. in your case from R.layout.contacx. This layout should have two textview with ids:- name and phone respectively.
private final TextView name, phone;
public ViewHolder(View view) {
super(view);
name = view.findViewById(R.id.name);
phone = view.findViewById(R.id.phone);
}
}
public CustomAdapter(model[] dataSet) {
localDataSet = dataSet;
}
#Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
// Create a new view, which defines the UI of the list item
View view = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.contacx, viewGroup, false);
//remvoe this from here.
//view.findViewById(R.id.name);
//view.findViewById(R.id.number);
return new ViewHolder(view);
}
// Replace the contents of a view (invoked by the layout manager)
#Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
//here you should call those view to bind your data like:
viewHolder.name.setText(localDataSet[position].getName());
viewHolder.phone.setText(String.valueOf(localDataSet[position].getPhone()));
}
#Override
public int getItemCount() {
return localDataSet.length;
}
}
Use ViewHolder for data bind. More safe
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
private model[] localDataSet;
public static class ViewHolder extends RecyclerView.ViewHolder {
private final TextView name, number;
public ViewHolder(View view) {
super(view);
name = view.findViewById(R.id.name);
number = view.findViewById(R.id.phone);
}
public void bindData(model data) {
name.setText(data.getName());
number.setText(String.valueOf(data.getPhone()));
}
}
public CustomAdapter(model[] dataSet) {
localDataSet = dataSet;
}
#Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
/* No Need
View view = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.contacx, viewGroup, false);
view.findViewById(R.id.name);
view.findViewById(R.id.number);
*/
return new ViewHolder(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.contacx, viewGroup, false););
}
#Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
/*
name.setText(localDataSet[position].getName());
number.setText(localDataSet[position].getPhone());
*/
viewHolder.bindData(localDataSet[position]);
}
#Override
public int getItemCount() {
return localDataSet.length;
}
}

How do i setOnClickListener on RecyclerView on Android Studio

i want to put setOnClickListener on the recyclerview that i follow on a tutorial, the problem is, i don't know where to put it, i got mixed with all other features of the app, i believe the code must be put somewhere here :
this is my ExampleAdapter :
public class ExampleAdapter extends RecyclerView.Adapter<ExampleAdapter.ExampleViewHolder>{
private ArrayList<ExampleItem> mExampleList;
public static class ExampleViewHolder extends RecyclerView.ViewHolder {
public ImageView mImageView;
public TextView mTextView1;
public TextView mTextView2;
public ExampleViewHolder(View itemView) {
super(itemView);
mImageView = itemView.findViewById(R.id.imageView);
mTextView1 = itemView.findViewById(R.id.textView);
mTextView2 = itemView.findViewById(R.id.textView2);
}
}
public ExampleAdapter(ArrayList<ExampleItem> exampleList) {
mExampleList = exampleList;
}
#Override
public ExampleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.example_item,
parent, false);
ExampleViewHolder evh = new ExampleViewHolder(v);
return evh;
}
#Override
public void onBindViewHolder(ExampleViewHolder holder, int position) {
ExampleItem currentItem = mExampleList.get(position);
holder.mImageView.setImageResource(currentItem.getImageResource());
holder.mTextView1.setText(currentItem.getText1());
holder.mTextView2.setText(currentItem.getText2());
}
#Override
public int getItemCount() {
return mExampleList.size();
}
public void filterList(ArrayList<ExampleItem> filteredList) {
mExampleList = filteredList;
notifyDataSetChanged();
}
}
really appreciate you guys, if you could help me.
Use this in your activity in which you have recyclerview
rv= (RecyclerView) findViewById(R.id.rv);
rv.setLayoutManager(new LinearLayoutManager(this));
rv.addOnItemTouchListener(
new RecyclerItemClickListener(this, rv ,new RecyclerItemClickListener.OnItemClickListener() {
#Override public void onItemClick(View view, int position) {
// do whatever
}
#Override public void onLongItemClick(View view, int position) {
// do whatever
}
})
);
Just edit extends RecyclerView.ViewHolder implements View.OnClickListener
and implement OnClick method ,edit as public ExampleViewHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
#Override
public void onClick(View v) {
}

Recycle view inside cardview aren't visible

I tried to insert recycleview inside cardview, but it not create it. I think it's problem with adapter, because this type of card created, but not fill recycle view.Now its look like this
There's my recycleview adapter code
public class SubItemsAdapter extends RecyclerView.Adapter<SubItemsAdapter.SubtasksViewHolder>{
private List<Subtask> subtasks;
public SubItemsAdapter(List<Subtask> subtasks){
this.subtasks = subtasks;
}
public class SubtasksViewHolder extends RecyclerView.ViewHolder{
TextView titleTextView;
CheckBox doneCheckBox;
public SubtasksViewHolder(View itemView) {
super(itemView);
titleTextView = (TextView)itemView.findViewById(R.id.subtaskTitle);
doneCheckBox = (CheckBox)itemView.findViewById(R.id.subtaskCheckbox);
}
}
#Override
public SubtasksViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.subtasks_listitem,parent,false);
return new SubtasksViewHolder(v);
}
#Override
public void onBindViewHolder(SubtasksViewHolder holder, int position) {
holder.titleTextView.setText(subtasks.get(position).getText());
holder.doneCheckBox.setChecked(subtasks.get(position).getDone());
}
#Override
public int getItemCount() {
return subtasks.size();
}} `
And my cardview code:
public class TasklistAdapter extends RecyclerView.Adapter<TasklistAdapter.ViewHolder> {
ArrayList<TodoItem> todoItems;
int[] dataTypes;
private static final int SIMPLETODOITEM = 0;
private static final int EXTENDTODOITEM = 1;
Context context;
public TasklistAdapter(ArrayList<TodoItem> todoItems, int[] dataTypes, Context context)
{
this.todoItems = todoItems;
this.dataTypes = dataTypes;
this.context = context;
}
public class SimpleViewHolder extends ViewHolder{
TextView titleTextView;
TextView desciptionTextView;
CheckBox doneCheckBox;
public SimpleViewHolder(View v) {
super(v);
titleTextView = (TextView)v.findViewById(R.id.simpleitem_title_textbox);
desciptionTextView =(TextView)v.findViewById(R.id.simpleitem_description_textbox);
doneCheckBox = (CheckBox)v.findViewById(R.id.simpleitem_checkbox);
}
}
public class ExtendViewHolder extends ViewHolder{
TextView titleTextView;
TextView descTextView;
RecyclerView subtasksListView;
SubItemsAdapter adapter;
RecyclerView.LayoutManager manager;
public ExtendViewHolder(View v) {
super(v);
titleTextView = (TextView)v.findViewById(R.id.extended_card_title);
descTextView = (TextView)v.findViewById(R.id.extended_card_description);
subtasksListView = (RecyclerView)v.findViewById(R.id.subtasks_listview);
manager = new LinearLayoutManager(v.getContext());
}
}
#Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v;
switch (viewType)
{
case EXTENDTODOITEM:
v = LayoutInflater.from(parent.getContext()).inflate(R.layout.extendedtodoitem_card, parent, false);
return new ExtendViewHolder(v);
default:
v = LayoutInflater.from(parent.getContext()).inflate(R.layout.simpletodoitem_card,parent,false);
return new SimpleViewHolder(v);
}
}
#Override
public void onBindViewHolder(ViewHolder holder, int position) {
switch (holder.getItemViewType()){
case EXTENDTODOITEM:
ExtendViewHolder extViewHold = (ExtendViewHolder)holder;
extViewHold.adapter = new SubItemsAdapter(todoItems.get(position).getSubtasks());
extViewHold.titleTextView.setText(todoItems.get(position).getText());
extViewHold.descTextView.setText(todoItems.get(position).getDescription());
extViewHold.subtasksListView.setLayoutManager(extViewHold.manager);
extViewHold.subtasksListView.setAdapter(extViewHold.adapter);
break;
default:
SimpleViewHolder simViewHold = (SimpleViewHolder)holder;
simViewHold.desciptionTextView.setText(todoItems.get(position).getDescription());
simViewHold.titleTextView.setText(todoItems.get(position).getText());
break;
}
}
#Override
public int getItemCount() {
return todoItems.size();
}
#Override
public int getItemViewType(int position) {
return dataTypes[position];
}
public static class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(View v) {
super(v);
}
}
}`
in your TasklistAdapter, static class ViewHolder extending RecyclerView.ViewHolder seems useless! and you are trying to inflate and bind data with two heterogeneous layouts with their own viewholder sub-classes! My solution would be to change this :
public class TasklistAdapter extends RecyclerView.Adapter<TasklistAdapter.ViewHolder>
to
public class TasklistAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>

Using ParseRecyclerQueryAdapter

Please I would like someone to help point me in the right direction with using the ParseRecyclerQueryAdapter. I'm trying to retrieve articles with my current adapter class that implements the standard RecyclerView. my implementation of pagination is not working properly soIi would like a demonstration from anyone that has used the ParseRecyclerQueryAdapter to achieve the following. By translating it from me so I get the implementation.
public class ArticleRVAdapter extends RecyclerView.Adapter {
List<Article> articleData = Collections.emptyList();
private LayoutInflater inflater;
private Context context;
public ArticleRVAdapter(Context context, List<Article> data){
inflater=LayoutInflater.from(context);
this.articleData= data;
this.context = context;
}
#Override
public ArticleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.article_item, parent, false);
ArticleViewHolder viewHolder = new ArticleViewHolder(view);
return viewHolder;
}
#Override
public int getItemCount() {
return articleData.size();
}
public class ArticleViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
CardView cardView;
TextView title;
TextView body;
Date dateCreated;
TextView author;
ImageView headImage;
String objectId;
public ArticleViewHolder(final View itemView) {
super(itemView);
itemView.setClickable(true);
itemView.setLongClickable(true);
itemView.setOnClickListener(this);
cardView = (CardView) itemView.findViewById(R.id.card_article);
title = (TextView) itemView.findViewById(R.id.text_title);
body = (TextView) itemView.findViewById(R.id.text_article_body);
//dateCreated = itemView.findViewById(R.id.text_article_body);
author = (TextView) itemView.findViewById(R.id.text_author);
headImage = (ImageView) itemView.findViewById(R.id.imageView_thumb);
}
#Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), ArticleInformationActivity.class);
intent.putExtra("article_id", articleData.get(getLayoutPosition()).getObjectId());
intent.putExtra("article_title", articleData.get(getLayoutPosition()).getArticleTitle());
intent.putExtra("article_body", articleData.get(getLayoutPosition()).getArticleBody());
intent.putExtra("article_author", articleData.get(getLayoutPosition()).getArticleAuthor());
intent.putExtra("article_date", articleData.get(getLayoutPosition()).getDateCreated());
v.getContext().startActivity(intent);
}
}
After a lot of testing, I got the solution in my project:
Fragment (or Activity):
private RecyclerView mRecyclerView;
private MyQueryAdapter myQueryAdapter;
private SwipeRefreshLayout swipeRefreshLayout;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.list_fragment, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.rv);
myQueryAdapter = new MyQueryAdapter(true);
mRecyclerView.setAdapter(myQueryAdapter);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
myQueryAdapter.addOnQueryLoadListener(new ParseRecyclerQueryAdapter.OnQueryLoadListener<MY_MODEL>() {
#Override
public void onLoaded(List<MY_MODEL> objects, Exception e) {
if (swipeRefreshLayout.isRefreshing()) {
swipeRefreshLayout.setRefreshing(false);
}
}
#Override
public void onLoading() {
if (!swipeRefreshLayout.isRefreshing()) {
swipeRefreshLayout.setRefreshing(true);
}
}
});
swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
#Override
public void onRefresh() {
myQueryAdapter.loadObjects();
}
});
return view;
}
#Override
public void onActivityCreated(#Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
#Override
public void onResume() {
super.onResume();
myQueryAdapter.loadObjects();
}
Adapter
public class MyQueryAdapter extends ParseRecyclerQueryAdapter<MY_MODEL, MyQueryAdapter.MyViewHolder>{
public MyQueryAdapter(boolean hasStableIds) {
super(MY_MODEL.class, hasStableIds);
}
public MarcacionesAdapter(ParseQueryAdapter.QueryFactory<Marcaciones> factory, boolean hasStableIds) {
super(factory, hasStableIds);
}
#Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview, parent, false);
MyViewHolder myViewHolder = new MyViewHolder(v);
return myViewHolder;
}
#Override
public void onBindViewHolder(MyViewHolder holder, int position) {
MY_MODEL model = getItem(position);
holder.name.setText(model.getName());
holder.year.setText(model.getYear());
}
public static class MyViewHolder extends RecyclerView.ViewHolder {
CardView cv;
TextView name;
TextView year;
MyViewHolder(View itemView) {
super(itemView);
cv = (CardView)itemView.findViewById(R.id.card_view);
name = (TextView)itemView.findViewById(R.id.name);
year = (TextView)itemView.findViewById(R.id.year);
}
}
}
If you want to configure a custom query, you can do it in this way:
factory =
new ParseQueryAdapter.QueryFactory<MY_MODEL>() {
public ParseQuery< MY_MODEL > create() {
ParseQuery<MY_MODEL> query = MY_MODEL.getQuery();
query.include("user");
//Filter by date
query.whereGreaterThan("createdAt", midnight);
query.whereLessThan("createdAt", now);
query.orderByDescending("createdAt");
return query;
}
};
adapter = new MyQueryAdapter(factory, true);

Categories

Resources