I am trying to fetch data from my Parse database and display it into my RecyclerView. Upon entering the Fragment, the RecyclerView displays no data. It isn't until I Swipe Refresh the feed that the items are accurately displayed in the RecyclerView. How can I make the RecyclerView have the items already initialized upon entering the Fragment?
#Override
public void onViewCreated(#NonNull View view, #Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
placeName = view.findViewById(R.id.profileEstablishmentName);
placeAddress = view.findViewById(R.id.restroomAddressInfo);
placeRating = view.findViewById(R.id.ratingBar);
rvFeed = view.findViewById(R.id.rvRestaurant);
swipeContainer = view.findViewById(R.id.swipeContainer);
swipeContainer.setColorSchemeResources(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
#Override
public void onRefresh() { queryPosts(); }
});
allPosts = new ArrayList<>();
adapter = new PostsAdapter(getContext(), allPosts);
rvFeed.setAdapter(adapter);
rvFeed.setLayoutManager(new LinearLayoutManager(getContext()));
queryPosts();
setHasOptionsMenu(true);
}
Parse Query:
protected void queryPosts(){
ParseQuery<Post> query = ParseQuery.getQuery(Post.class);
query.include(Post.KEY_USER);
query.include(Post.KEY_PLACE_NAME);
//Constraint to only see posts of the selected Restaurant
query.whereEqualTo(Post.KEY_PLACE_NAME, placeName.getText().toString());
query.setLimit(20);
//Filters the order of the posts based on the time created key (newest on top)
query.addDescendingOrder(Post.KEY_CREATED_KEY);
query.findInBackground(new FindCallback<Post>() {
#Override
public void done(List<Post> posts, ParseException e) {
if (e != null) {
Log.e(TAG, "Issue with getting posts", e);
return;
}
for(Post post : posts){
Log.i(TAG, "Post: " + post.getPlaceName());
}
adapter.clear();
allPosts.addAll(posts);
adapter.notifyDataSetChanged();
swipeContainer.setRefreshing(false);
}
});
}
PostAdapter:
public class PostsAdapter extends RecyclerView.Adapter<PostsAdapter.ViewHolder>{
private Context context;
private List<Post> posts;
public PostsAdapter(Context context, List<Post> posts){
this.context = context;
this.posts = posts;
}
#NonNull
#Override
public ViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.item_post, parent, false);
return new ViewHolder(view);
}
#Override
public void onBindViewHolder(#NonNull ViewHolder holder, int position) {
Post post = posts.get(position);
holder.bind(post);
}
#Override
public int getItemCount() {
return posts.size();
}
public void clear() {
posts.clear();
notifyDataSetChanged();
}
// Add a list of items -- change to type used
public void addAll(List<Post> list) {
posts.addAll(list);
notifyDataSetChanged();
}
class ViewHolder extends RecyclerView.ViewHolder{
private TextView tvUsername;
private TextView tvDescription;
private TextView tvPlaceName;
private ImageView ivImage;
public ViewHolder(#NonNull View itemView) {
super(itemView);
tvUsername = itemView.findViewById(R.id.username);
tvPlaceName = itemView.findViewById(R.id.placeName);
tvDescription = itemView.findViewById(R.id.reviewDescription);
ivImage = itemView.findViewById(R.id.ivImage);
}
public void bind(Post post) {
//Bind the post data to the view elements
tvDescription.setText(post.getDescription());
tvUsername.setText("#" + post.getUser().getUsername());
tvPlaceName.setText(post.getPlaceName());
ParseFile image = post.getImage();
if (image != null) {
Glide.with(context).load(post.getImage().getUrl()).into(ivImage);
}
}
}
Related
Hello everyone I am trying to create fitness app where user can create their custom workout. I am trying to create that via Recycler View and SQLite database. So far I was able to create successful system of adding workout to database and delete the same one.
What I was unable to do is OnClickListener for item of Recycler View.
I was able to create OnClickListener for position,but what I really want is to save previously edited activity as onlclicklistener for particular item of recyler view.
This is what I've created so far and I want to create :
What I really need here is to save red plus icon instead of blue (picture 3 & 4) and load it
when I click on "first". I also want to make it reusable so I can add workout again.
This is code for my Adapter :
private Context mContext;
private Cursor cursor;
private ListItemClickListener listItemClickListener;
public WorkoutsAdapter (Context mContext,Cursor cursor,ListItemClickListener listItemClickListener)
{
this.mContext = mContext;
this.cursor = cursor;
this.listItemClickListener = listItemClickListener;
}
#NonNull
#Override
public WorkoutsAdapter.WorkoutsViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.recyclerview_item,parent,false);
return new WorkoutsViewHolder(view);
}
#Override
public void onBindViewHolder(#NonNull WorkoutsAdapter.WorkoutsViewHolder holder, int position) {
if(!cursor.moveToPosition(position))
{
return;
}
long id = cursor.getLong(cursor.getColumnIndex(WorkoutsContract.WorkoutsEntry._ID));
holder.itemView.setTag(id);
String name = cursor.getString(cursor.getColumnIndex(WorkoutsContract.WorkoutsEntry.WORKOUT_NAME));
holder.workout_name.setText(name);
}
#Override
public int getItemCount() {
return cursor.getCount();
}
public class WorkoutsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView workout_name;
public WorkoutsViewHolder(#NonNull View itemView) {
super(itemView);
workout_name = itemView.findViewById(R.id.word);
itemView.setOnClickListener(this);
}
#Override
public void onClick(View v) {
listItemClickListener.onClick(v,getAdapterPosition());
}
}
public void swapCursor (Cursor newCursor) {
if (cursor != null)
{
cursor.close();
}
cursor = newCursor;
if (newCursor != null)
{
this.notifyDataSetChanged();
}
}
This is my second fragment where view is stored and where I want to apply clicklistener to create saved activity :
public View onCreateView(#NonNull LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_2_layout, container, false);
recyclerView = v.findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
fab = (FloatingActionButton) v.findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(getActivity(),SecondActivity.class));
}
});
DbHelper dbHelper = new DbHelper(getActivity());
mydatabase = dbHelper.getWritableDatabase();
Cursor cursor = getAllTasks();
adapter = new WorkoutsAdapter(getActivity(),cursor,this);
recyclerView.setAdapter(adapter);
new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
#Override
public boolean onMove(#NonNull RecyclerView recyclerView, #NonNull RecyclerView.ViewHolder viewHolder, #NonNull RecyclerView.ViewHolder target) {
return false;
}
#Override
public void onSwiped(#NonNull RecyclerView.ViewHolder viewHolder, int direction) {
long id = (long) viewHolder.itemView.getTag();
removeTask(id);
adapter.swapCursor(getAllTasks());
}
}).attachToRecyclerView(recyclerView);
return v;
}
private void removeTask(long id) {
mydatabase.delete(WorkoutsContract.WorkoutsEntry.TABLE_NAME,
WorkoutsContract.WorkoutsEntry._ID + "=" +id,null);
Toast.makeText(getActivity(),"Wokrout Is Deleted Successfully",Toast.LENGTH_SHORT).show();
}
private Cursor getAllTasks ()
{
return mydatabase.query(WorkoutsContract.WorkoutsEntry.TABLE_NAME,
null,
null,
null,
null,
null,
WorkoutsContract.WorkoutsEntry.COLUMN_TIMESTAMP);
}
#Override
public void onStart() {
super.onStart();
adapter.swapCursor(getAllTasks());
}
#Override
public void onClick(View view, int position) {
long id = (long) view.getTag();
System.out.println(position);
I did the code below, used the adapter to show the list, and a button to add a comment to list item, it shows the logcat "ViewPostIme pointer 0 and ViewPostIme pointer 1", upon clicking the comment button.
Upon compilation it doesn't show any error, I tried to use many references via google but nothing works out.
My basic idea is to call the comment button with an associated list item to perform the comment activity.
Adapter class
public class PostsAdapter extends FirestoreRecyclerAdapter<PostsModel, PostsAdapter.PostsHolder> {
private OnItemClickListener listener;
private View.OnClickListener buttonListener;
private String id;
private static final String TAG = "DocSnippets";
public PostsAdapter(#NonNull FirestoreRecyclerOptions<PostsModel> options) {
super(options);
}
#Override
protected void onBindViewHolder(#NonNull PostsHolder holder, int position, #NonNull PostsModel model) {
//retrieve the fields here
holder.textViewDescription.setText(model.getPostContent());
holder.textViewPriority.setText(String.valueOf(model.getSpinnerC()));
holder.textViewPriority.setText(String.valueOf(model.getTimestamp()));
}
#NonNull
#Override
public PostsHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_list_layout,
parent, false);
return new PostsHolder(v);
}
public void deleteItem(int position) {
getSnapshots().getSnapshot(position).getReference().delete();
}
public void setOnClickListener(OnClickListener postKey) {
}
class PostsHolder extends RecyclerView.ViewHolder {
//first declare here the elements to be displayed in the cardview.
TextView textViewTitle;
TextView textViewDescription;
TextView textViewPriority;
Button commentsbutton;
public PostsHolder(final View itemView) {
super(itemView);
textViewTitle = itemView.findViewById(R.id.post_etPostTitle);
textViewDescription = itemView.findViewById(R.id.post_description);
textViewPriority = itemView.findViewById(R.id.post_time);
commentsbutton = itemView.findViewById(R.id.commenting_button);
commentsbutton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION && buttonListener != null) {
buttonListener.onClick(itemView);
}
}
});
}
}
public interface OnClickListener
{
void OnClickListener(DocumentSnapshot documentSnapshot, int position);
}
public void setOnClickListener(View.OnClickListener onClickListener) {
this.buttonListener = onClickListener;
}
public interface OnItemClickListener {
void onItemClick(DocumentSnapshot documentSnapshot, int position);
}
public void setOnItemClickListener(OnItemClickListener listener) {
this.listener = listener;
}
}
Fragment Class
public class HomeFragment extends Fragment {
RelativeLayout mParent;
//FloatingActionButton addButton;
private static final String TAG = "DocSnippets";
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private CollectionReference PostsRef = db.collection("posts");
private PostsAdapter adapter;
private FirestoreRecyclerOptions options;
private FirebaseAuth mAuth;
private String mUserId, id;
private Button commentsbutton;
RecyclerView recyclerView;
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
//just change the fragment_dashboard
//with the fragment you want to inflate
//like if the class is HomeFragment it should have R.layout.home_fragment
//if it is DashboardFragment it should have R.layout.fragment_dashboard
View view = inflater.inflate(R.layout.fragment_home, container, false);
final FragmentActivity c = getActivity();
LinearLayoutManager layoutManager = new LinearLayoutManager(c);
Query query = PostsRef.orderBy("timestamp", Query.Direction.DESCENDING);
FirestoreRecyclerOptions<PostsModel> options = new FirestoreRecyclerOptions.Builder<PostsModel>()
.setQuery(query, PostsModel.class)
.build();
adapter = new PostsAdapter(options);
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(c));
recyclerView.setAdapter(adapter);
commentsbutton = (Button) view.findViewById(R.id.commenting_button);
mParent =view.findViewById(R.id.relative_home);
mAuth = FirebaseAuth.getInstance();
mUserId = mAuth.getUid();
adapter.setOnItemClickListener(new PostsAdapter.OnItemClickListener() {
#Override
public void onItemClick(DocumentSnapshot documentSnapshot, int position) {
PostsModel note = documentSnapshot.toObject(PostsModel.class);
id = documentSnapshot.getId();
String path = documentSnapshot.getReference().getPath();
Log.d(TAG, "String post Id is: " + id);
}
});
adapter.setOnClickListener(new PostsAdapter.OnClickListener() {
#Override
public void OnClickListener(DocumentSnapshot documentSnapshot, int position) {
PostsModel note = documentSnapshot.toObject(PostsModel.class);
id = documentSnapshot.getId();
String path = documentSnapshot.getReference().getPath();
Log.d(TAG, "String post Id is: " + id);
Intent toCommentActivity = new Intent(getContext(), CommentActivity.class);
toCommentActivity.putExtra("PostKey", id);
getContext().startActivity(toCommentActivity);
}
});
return view;
}
private String getTime(long timestamp){
long ts = timestamp*1000;
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a");
String time = sdf.format(new Date(ts));
return time;
}
#Override
public void onStart() {
super.onStart();
adapter.startListening();
}
#Override
public void onStop() {
super.onStop();
adapter.stopListening();
}
}
I'm creating an Android app, the data that i'm sending through intent is being retrieved every time i click on the item.
I'm sending the retrieved data(which it's a subcollection that is being retrieved every time i click on item) through the intent,and all data receives in an arraylist, so the listener don't know if the same data existed in the arraylist,because the data are in the other activity.
when i click for the first time the data displayed normally in ItemMarkerActivity but when i go back and click again on the same item i see the data load again in the recycler view,and added to the previous same data, i'm using the technique of removing the data onStop but it didn't work perfectly,because i need to close all activities to see that the data removed, i tried to send the CollectionReference through intent but i couldn't do. so I need a way of removing the data immediately after closing the activity, and if anyone has another approach for solving this problem it would better.
Thanks in advance
adapter.setOnItemClickListener(new MarketAdapterRecyclerView.OnItemClickListener() {
#Override
public void onItemClick(DocumentSnapshot documentSnapshot, int position) {
CollectionReference path = documentSnapshot.getReference().collection("ShoppingItems");
listener = path.addSnapshotListener(new EventListener<QuerySnapshot>() {
#Override
public void onEvent(#Nullable QuerySnapshot queryDocumentSnapshots, #Nullable FirebaseFirestoreException e) {
if (e != null) {
return;
}
for (DocumentChange dc : queryDocumentSnapshots.getDocumentChanges()) {
if (dc.getType() == DocumentChange.Type.ADDED) {
item = dc.getDocument().toObject(Item.class);
itemList.add(item);
}
}
Intent intent = new Intent (shoppingActivity.this, ItemMarkerActivity.class);
Log.v(TAG,"###################################" + itemList.toString());
intent.putExtra("keyName", itemList);
startActivity(intent);
}
});
}
}
The Activity That Receives The data
The Manifest
public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.ViewHolder> implements Parcelable{
public ArrayList<Item> ItemList;
public Context mContext;
private onMallListener mOnMallListener;
private static final int NO_POSITION = -1;
public ItemAdapter(ArrayList<Item> ItemList, Context mContext, onMallListener mOnMallListener) {
this.ItemList = ItemList;
this.mContext = mContext;
this.mOnMallListener = mOnMallListener;
}
protected ItemAdapter(Parcel in) {
ItemList = in.createTypedArrayList(Item.CREATOR);
}
public static final Creator<ItemAdapter> CREATOR = new Creator<ItemAdapter>() {
#Override
public ItemAdapter createFromParcel(Parcel in) {
return new ItemAdapter(in);
}
#Override
public ItemAdapter[] newArray(int size) {
return new ItemAdapter[size];
}
};
#NonNull
#Override
public ViewHolder onCreateViewHolder(#NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_card_view_item, viewGroup, false);
ViewHolder viewHolder = new ViewHolder(view, mOnMallListener);
return viewHolder;
}
#Override
public void onBindViewHolder(#NonNull ViewHolder viewHolder, int i) {
Item item = ItemList.get(i);
viewHolder.itemType.setText(ItemList.get(i).getItemType());
Picasso.with(mContext)
.load(item.getImageUrl())
.fit()
.centerCrop().into(viewHolder.imageUrl);
}
#Override
public int getItemCount() {
return ItemList.size();
}
#Override
public int describeContents() {
return 0;
}
#Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeTypedList(ItemList);
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
View mView;
public TextView price;
public TextView description;
public TextView itemType;
public ImageView imageUrl;
onMallListener onMallListener;
public ViewHolder(#NonNull View itemView, onMallListener mOnMallListener) {
super(itemView);
mView = itemView;
itemType = (TextView) mView.findViewById(R.id.card_view_image_title);
imageUrl = (ImageView) mView.findViewById(R.id.card_view_image);
this.onMallListener = mOnMallListener;
mView.setOnClickListener(this);
}
#Override
public void onClick(View v) {
if(mOnMallListener != null){
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION){
mOnMallListener.onMallClick(position);
}
}
}
}
public interface onMallListener{
void onMallClick(int position);
}
}
Save data using Room database in first activity and retrieve it in second.
In any place of your code (and in any activity's callback) you can clean db and all lists/recyclers which listen this data.
https://developer.android.com/training/data-storage/room
Hope it'll help
I was trying to make a chat app for the android, so I used RecyclerView for it. I have a problem for the adapter, my chat room's displaying blank for the JSON response they get. Did I miss something on my code?
Here is my adapter class
public class PesanRecycleAdapter extends RecyclerView.Adapter<PesanRecycleAdapter.ViewHolder> {
private String username;
private Context context;
private int SELF = 786;
private ArrayList<Pesan> pesan;
public PesanRecycleAdapter(Context context, ArrayList<Pesan> pesan, String username){
this.username = username;
this.pesan = pesan;
this.context = context;
}
#Override
public int getItemViewType(int position) {
Pesan psn = pesan.get(position);
if (psn.getUsernameFrom() == username) {
return SELF;
}
return position;
}
#Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
if (viewType == SELF) {
itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.chat_thread_me, parent, false);
} else {
itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.chat_thread_other, parent, false);
}
return new ViewHolder(itemView);
}
#Override
public void onBindViewHolder(ViewHolder holder, int position) {
Pesan psn = pesan.get(position);
holder.textViewMessage.setText(psn.getPesan());
holder.textViewTime.setText(psn.getSentAt());
}
#Override
public int getItemCount() {
return pesan.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView textViewMessage;
public TextView textViewTime;
public ViewHolder(View itemView) {
super(itemView);
textViewMessage = (TextView) itemView.findViewById(R.id.textViewMessage);
textViewTime = (TextView) itemView.findViewById(R.id.textViewTime);
}
}
}
Any help or suggestion is welcome
And here where I used that adapter on activity
public void getpesan() {
try {
apiservice.get_pesan(username, "ahnafgg").enqueue(new Callback<ResponPesan>() {
#Override
public void onResponse(Call<ResponPesan> call, Response<ResponPesan> response) {
Log.d(TAG, "onResponse: response..."+response);
dummyData = response.body().getPesan();
createRecycleView();
}
#Override
public void onFailure(Call<ResponPesan> call, Throwable t) {
Log.d(TAG, "onFailure: response...");
Toast.makeText(RuangPesan.this,"Gagal ambil chat",Toast.LENGTH_SHORT).show();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void createRecycleView(){
adapter = new PesanRecycleAdapter(RuangPesan.this, pesan, username);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
Log.d(TAG, "********************************");
scrollToBottom();
}
Probably you forgot to set date in the model before initialising recycler view
Use the following way from your activity class:
initData(); //Do this first
RecyclerView recyclerView = findViewById(R.id.recyclerview);
Context context = MainActivity.this;
PesanRecycleAdapter pesanRecycleAdapter = new PesanRecycleAdapter(context, list,"Fahad");
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(pesanRecycleAdapter);
I think everything is okay here, maybe you forgot setting layoutManager for recyclerView or notify adapter after setting data
I am trying to scroll to the same position in my Recyclerview when a user rotates the device. I am saving the Position here:
#Override
public void onSaveInstanceState(Bundle savedInstanceState) {
int index = llm.findFirstCompletelyVisibleItemPosition();//llm is my layoutmanager
savedInstanceState.putInt("Pos", index);
super.onSaveInstanceState(savedInstanceState);
}
And restore it here:
#Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mPosRev = savedInstanceState.getInt("Pos");
Log.d(TAG, "onSaveInstanceState: "+mPosRev);
llm.scrollToPositionWithOffset(mPosRev,10);
}
I can see by the logs, that the Position is stored correctly, but not scrolled to. I already tried smoothScrollToPosition as well as scrollToPosition.
This is my Adapter
private final Review mLock = new Review();
private List<Review> mObjects;
public ReviewAdapter( List<Review> objects) {
mObjects = objects;
}
public void add(Review object) {
synchronized (mLock) {
mObjects.add(object);
}
notifyDataSetChanged();
}
public void add(ReviewDetail object) {
synchronized (mLock) {
try {
Log.d(TAG, "add: "+object.getContent());
mObjects.add(new Review(object));
} catch (JSONException e) {
e.printStackTrace();
}
}
notifyDataSetChanged();
}
public void clear() {
synchronized (mLock) {
mObjects.clear();
}
notifyDataSetChanged();
}
#Override
public ReviewViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType){
Context context=viewGroup.getContext();
int layoutIdForListItem=R.layout.item_movie_review;
LayoutInflater inflater=LayoutInflater.from(context);
View view=inflater.inflate(layoutIdForListItem, viewGroup, false);
ReviewViewHolder viewHolder= new ReviewViewHolder(view);
return viewHolder;
}
#Override
public void onBindViewHolder(ReviewViewHolder holder, int position) {
holder.bind(position);
}
#Override
public int getItemCount() {
if (null == mObjects) return 0;
return mObjects.size();
}
class ReviewViewHolder extends RecyclerView.ViewHolder {
TextView Author;
TextView Txt;
public ReviewViewHolder(View itemView) {
super(itemView);
Author = (TextView) itemView.findViewById(R.id.author);
Txt = (TextView) itemView.findViewById(R.id.txt);
}
void bind(int listIndex) {
Author.setText(mObjects.get(listIndex).getAuthor());
Txt.setText(mObjects.get(listIndex).getContent());
}
}
}
And in here I initalize my Recyclerview:
recList = (RecyclerView) findViewById(R.id.cardList);
recList.setHasFixedSize(true);
llm = new LinearLayoutManager(this);
llm.setOrientation(LinearLayoutManager.VERTICAL);
recList.setLayoutManager(llm);
mReviewAdapter = new ReviewAdapter(new ArrayList<Review>());
recList.setAdapter(mReviewAdapter);
Any ideas on what could cause this behavior?