i am creating small app with login and signup option and also with profile fragment so that user can update their profile later. i design my user profile layout but don't know how to code with java so when user open profile fragment he changed his detail . i am using firebasefirestore
please help me
public class ProfileFragment extends Fragment {
FirebaseAuth auth;
FirebaseFirestore database;
UserDetail userDetail;
public ProfileFragment() {
// Required empty public constructor
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
FragmentProfileBinding binding;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
binding = FragmentProfileBinding.inflate( inflater, container,false );
database = FirebaseFirestore.getInstance();
database.collection( "Users" )
.document( FirebaseAuth.getInstance().getUid() )
.get().addOnSuccessListener( new OnSuccessListener<DocumentSnapshot>() {
#Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
userDetail = documentSnapshot.toObject( UserDetail.class );
}
} );
binding.updateButton.setOnClickListener( new View.OnClickListener() {
#Override
public void onClick(View v) {
String name, cityName, mobileNumber, whatsappNumber, email, password;
name = binding.nameBox.getText().toString();
cityName = binding.cityNameBox.getText().toString();
mobileNumber = binding.mobileNumberBox.getText().toString();
whatsappNumber = binding.whatsappNumberBox.getText().toString();
email = binding.emailBox.getText().toString();
password = binding.passwordBox.getText().toString();
final UserDetail userDetail = new UserDetail(name, email, password, cityName, mobileNumber, whatsappNumber);
}
} );
return binding.getRoot();
}
}
Override this method in your fragment :
#Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
this.isHidden = hidden;
if (isHidden) {
//todo do something
} else {
//todo do something
}
}
Related
I am new to android development and I am confused about how to add admob banner to a fragment activity(I think its calling fragment).
the issues is that, Where should I write the java code for this admob banner.
if anyone can explain to me how correctly add banner in fragment android studio
into this code:
Here is the java code as well as
public WalletFragment() { // Required empty public constructor
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
FragmentWalletBinding binding;
FirebaseFirestore database;
User user;
private AdView mAdView;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
;
binding = FragmentWalletBinding.inflate(inflater, container, false);
database = FirebaseFirestore.getInstance();
database.collection("users")
.document(FirebaseAuth.getInstance().getUid())
.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
#Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
user = documentSnapshot.toObject(User.class);
binding.currentCoins.setText(String.valueOf(user.getCoins()));
//binding.currentCoins.setText(user.getCoins() + "");
}
});
binding.sendRequest.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if(user.getCoins() > 200000) {
String uid = FirebaseAuth.getInstance().getUid();
String payPal = binding.emailBox.getText().toString();
WithdrawRequest request = new WithdrawRequest(uid, payPal, user.getName());
database
.collection("withdraws")
.document(uid)
.set(request).addOnSuccessListener(new OnSuccessListener<Void>() {
#Override
public void onSuccess(Void aVoid) {
Toast.makeText(getContext(), "Request sent successfully.", Toast.LENGTH_SHORT).show();
}
});
} else {
Toast.makeText(getContext(), "You need more coins to get withdraw.", Toast.LENGTH_SHORT).show();
}
}
});
return binding.getRoot();
}
}```
The problem I have been facing with the development is that there is a recyclerview inside my fragment which gets disappeared after I switch between two fragments on a particular activity. On the first time when the fragment loads everything works fine but afterwards I don't understand what goes wrong. I had tried to refer to various ways that people had posted over github like notifyDatasetChanged, etc. But nothing seems to work. I would appreciate if someone could help me out with this issue.
So here are my classes.
The ProfileFragment.java :
public class ProfileFragment extends Fragment {
FirebaseAuth firebaseAuth;
FirebaseUser user;
FirebaseDatabase firebaseDatabase;
DatabaseReference databaseReference;
StorageReference storageReference;
RecyclerView itemRecycler;
List<ModelProfile> modelProfiles;
AdapterProfile adapterProfile;
String storagePath= "Users_Profile_Cover_Image/-";
ImageView avatarIv,dp;
CardView card,cardArrow;
TextView nameTv, emailTv, phoneTv;
Button logout,update;
ExtendedFloatingActionButton fab;
ProgressDialog pd;
//..
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final View view= inflater.inflate(R.layout.fragment_profile, container, false);
firebaseAuth = FirebaseAuth.getInstance();
user= firebaseAuth.getCurrentUser();
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference("Users");
storageReference= getInstance().getReference();
loadItems();
return view;
}
private void loadItems() {
//Problem could be here
GridLayoutManager layoutManager= new GridLayoutManager(getContext(),3);
itemRecycler.setHasFixedSize(true);
itemRecycler.setLayoutManager(layoutManager);
itemRecycler.setVisibility(View.VISIBLE);
CollectionReference ref =FirebaseFirestore.getInstance().collection("All_Posts");
com.google.firebase.firestore.Query query = ref.whereEqualTo("uid",uid);
FirestoreRecyclerOptions<ModelProfile> options = new FirestoreRecyclerOptions.Builder<ModelProfile>()
.setQuery(query,ModelProfile.class).build();
adapterProfile = new AdapterProfile(options,getActivity());
itemRecycler.setAdapter(adapterProfile);
adapterProfile.startListening();
query.addSnapshotListener(new EventListener<QuerySnapshot>() {
#Override
public void onEvent(#Nullable QuerySnapshot value,
#Nullable FirebaseFirestoreException e) {
if (e != null) {
return;
}
assert value != null;
Log.i("Size",String.valueOf(value.getDocuments().size()));
if (value.getDocuments().size() > 0) { // List is populated
card.setVisibility(View.GONE);
cardArrow.setVisibility(View.GONE);
} else { // List is empty
card.setVisibility(View.VISIBLE);
cardArrow.setVisibility(View.VISIBLE);
}
}
});
}
//
// #Override
// public void onStart() {
// super.onStart();
// adapterProfile.startListening();
// }
//
//
//
// #Override
// public void onStop() {
// super.onStop();
// adapterProfile.stopListening();
// }
#Override
public void onResume() {
super.onResume();
adapterProfile.startListening();
}
}
Adapter:-
public class AdapterProfile extends FirestoreRecyclerAdapter<ModelProfile,AdapterProfile.MyHolder> {
Context context;
public String im;
public AdapterProfile(#NonNull FirestoreRecyclerOptions<ModelProfile> options, Activity Context) {
super(options);
context = Context;
}
#Override
protected void onBindViewHolder(#NonNull MyHolder holder, int position, #NonNull ModelProfile model) {
String uid = model.getUid();
String uEmail =model.getuEmail();
}
#NonNull
#Override
public MyHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
//..
}
class MyHolder extends RecyclerView.ViewHolder{
//..
}
Activity on which Fragment switching takes place
public class LandingActivity extends AppCompatActivity {
FirebaseAuth firebaseAuth;
DatabaseReference userDbRef;
FirebaseUser user;
String uid,dp;
ChipNavigationBar chipNavigationBar;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_landing);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new InventoryFragment()).commit();
bottomMenu();
}
private void bottomMenu() {
chipNavigationBar.setOnItemSelectedListener(new ChipNavigationBar.OnItemSelectedListener() {
//problem could be here as well.........
#Override
public void onItemSelected(int i) {
Fragment fragment=null;
switch(i) {
case R.id.bottom_nav_2:
fragment = new CltFragment();
break;
case R.id.bottom_nav_3:
fragment = new MaceFragment();
break;
case R.id.bottom_nav_profile:
fragment = new ProfileFragment();
break;
}
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,fragment).commit();
}
});
}
private void checkUserStatus()
{
FirebaseUser user= firebaseAuth.getCurrentUser();
if(user !=null)
{
uid=user.getUid();
}
else
{
startActivity(new Intent(LandingActivity.this,MainActivity.class));
finish();
}
}
#Override
public void onResume() {
//Problem could be here
super.onResume();
Intent intent = getIntent();
String frag = "";
if(intent.hasExtra("frag")) {
frag = intent.getExtras().getString("frag");
}
else
{
//..
}
switch(frag)
{
//..
case "ProfileFragment":
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ProfileFragment()).commit();
chipNavigationBar.setItemSelected(R.id.bottom_nav_profile,true);
break;
}
}
}
Thanks for having looked at my Problem!
Try using this
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,new InventoryFragment()).commit();
Instead of this
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new InventoryFragment()).commit();
I have created an Android chat application which incorporates Firebase and created a fragment with a current users messages. The error occurs when a user sends a message to more than one person and the following image link shows how the first user is displayed whereas the most recent one who I have sent a message to is invisible. Does anyone know why this would be? I will include a few of my classes below.
My firebase is displayed as the following with messages containing first the user IDs, recipient IDs and then the unique message ID followed by the actual message and who sent it.
Thanks for your help.
https://i.stack.imgur.com/TrFUg.png
Here on the link below you will see two tabs, the first is not displaying and the second is. Both messages are to different recipients.
https://i.stack.imgur.com/M5LXa.png
Fragment Class
public class ChatFragment extends Fragment {
private RecyclerView convList;
private FirebaseAuth auth;
private DatabaseReference userDatabase, messageDatabase;
private View view;
public ChatFragment() {
// Required empty public constructor
}
// Chat Fragment initialised
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_chat, container, false);
convList = (RecyclerView) view.findViewById(R.id.conv_list);
convList.setHasFixedSize(true);
convList.setLayoutManager(new LinearLayoutManager(getContext()));
auth = FirebaseAuth.getInstance();
String currentUser;
currentUser = auth.getCurrentUser().getUid();
messageDatabase = FirebaseDatabase.getInstance().getReference().child("Messages").child(currentUser);
messageDatabase.keepSynced(true);
userDatabase = FirebaseDatabase.getInstance().getReference().child("Users");
userDatabase.keepSynced(true);
return view;
}
// Use FirebaseRecyclerAdapter to populate each user of which messages have been sent between, the latest message sent between each user displayed, ordering the list by most recent message and the user's online status
#Override
public void onStart() {
super.onStart();
Query conversationQuery = messageDatabase.orderByChild("time");
FirebaseRecyclerAdapter<UserConversation, ConvViewHolder> friendsRecyclerViewAdapter = new FirebaseRecyclerAdapter<UserConversation, ConvViewHolder>(
UserConversation.class,
R.layout.activity_user_list,
ConvViewHolder.class,
conversationQuery
) {
#Override
protected void populateViewHolder(final ConvViewHolder friendsViewHolder, final UserConversation friends, int i) {
final String user_id = getRef(i).getKey();
Query lastMessageQuery = messageDatabase.child(user_id).limitToLast(1);
// Retrieving data stored in Firebase for each message and its information
lastMessageQuery.addChildEventListener(new ChildEventListener() {
#Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
String data = dataSnapshot.child("message").getValue().toString();
ConvViewHolder.setMessage(data);
String time = dataSnapshot.child("time").getValue().toString();
ConvViewHolder.setTime(time);
}
#Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
#Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
#Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
userDatabase.child(user_id).addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
final String userName = dataSnapshot.child("name").getValue().toString();
String userThumb = dataSnapshot.child("thumb_image").getValue().toString();
String online = dataSnapshot.child("online").getValue().toString();
friendsViewHolder.setName(userName);
friendsViewHolder.setUserImage(userThumb, getContext());
friendsViewHolder.setUserOnline(online);
friendsViewHolder.mView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), Messenger.class);
intent.putExtra("user_id", user_id);
intent.putExtra("user_name", userName);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Log.i("Activity Not Found", "Error");
}
}
});
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
};
convList.setAdapter(friendsRecyclerViewAdapter);
}
public static class ConvViewHolder extends RecyclerView.ViewHolder {
static View mView;
public ConvViewHolder(View itemView) {
super(itemView);
mView = itemView;
}
public static void setMessage(String message){
TextView userStatusView = (TextView) mView.findViewById(R.id.user_single_status);
userStatusView.setText(message);
}
public void setName(String name) {
TextView userNameView = (TextView) mView.findViewById(R.id.user_single_name);
userNameView.setText(name);
}
public void setUserImage(String thumb_image, Context ctx) {
CircleImageView userImageView = (CircleImageView) mView.findViewById(R.id.user_single_image);
Picasso.with(ctx).load(thumb_image).placeholder(R.drawable.default_avatar).into(userImageView);
}
public static void setTime (String time){
TextView test = (TextView) mView.findViewById(R.id.time_sent);
test.setText(DateFormat.format("dd-MM-yyyy (HH:mm:ss)", Long.parseLong(time)));
}
public void setUserOnline(String online) {
ImageView userOnlineView = (ImageView) mView.findViewById(R.id.user_single_online_icon);
if(online.equals("true")){
userOnlineView.setVisibility(View.VISIBLE);
} else {
userOnlineView.setVisibility(View.INVISIBLE);
}
}
}
}
I am trying to retrieve users followers from Firebase and populate them onto a RecyclerView for anyone to be able to see just like twitter and Instagram, when i run the app it returns an error.
My code:
public class ViewFollowersFragment extends Fragment {
private static final String TAG = "ViewFollowersFragment";
private CircleImageView myprofileimage;
private TextView username;
private ImageView arrow;
private ListView vfollowerslistview;
private DatabaseReference viewFollowersref,viewUserRef;
private FirebaseAuth mAuth;
private FirebaseListAdapter viewfollowersadapter;
private List<User> mUserList;
private User mUser;
String userid;
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_view_followers, container, false);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
vfollowerslistview = (ListView) view.findViewById(R.id.viewfollowerslistview);
arrow = (ImageView) view.findViewById(R.id.fragfollowersbackarrow);
arrow.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
getActivity().getSupportFragmentManager().popBackStack();
getActivity().finish();
}
});
mUserList = new ArrayList<>();
mAuth = FirebaseAuth.getInstance();
userid = mAuth.getUid();
viewFollowersref = FirebaseDatabase.getInstance().getReference().child("User_Account_Settings");
viewUserRef = FirebaseDatabase.getInstance().getReference();
setFollowers();
return view;
}
private void setFollowers () {
Query query = FirebaseDatabase.getInstance().getReference()
.child("Followers")
.child(mUser.getUser_id());
FirebaseListOptions<UserAccountSettings> options = new FirebaseListOptions.Builder<UserAccountSettings>()
.setLayout(R.layout.layout_user_listitem)
.setLifecycleOwner(getActivity())
.setQuery(query,UserAccountSettings.class)
.build();
viewfollowersadapter = new FirebaseListAdapter(options) {
#Override
protected void populateView(View v, Object model, final int position) {
String newfol = getRef(position).getKey();
final TextView username = v.findViewById(R.id.username);
final CircleImageView profile_image = v.findViewById(R.id.profile_image);
viewFollowersref.child(newfol).addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if (dataSnapshot.hasChild("username")) {
String myusername = dataSnapshot.child("username").getValue().toString();
username.setText(myusername);
}
if (dataSnapshot.hasChild("profileimage")) {
String myimage = dataSnapshot.child("profileimage").getValue().toString();
if (myimage.isEmpty()) {
profile_image.setImageResource(R.drawable.pro_pic);
} else {
Picasso.with(getActivity()).load(myimage).placeholder(R.drawable.pro_pic).into(profile_image);
}
}
}
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
username.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent profileIntent = new Intent(getActivity(), ProfileActivity.class);
profileIntent.putExtra("calling_activity", "Search_Activity");
profileIntent.putExtra("intent_user", mUserList.get(position));
startActivity(profileIntent);
}
});
profile_image.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent profileIntent = new Intent(getActivity(), ProfileActivity.class);
profileIntent.putExtra("calling_activity", "Search_Activity");
profileIntent.putExtra("intent_user", mUserList.get(position));
startActivity(profileIntent);
}
});
Query userQuery = viewUserRef
.child("Users")
.orderByChild("user_id");
userQuery.addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot singleSnapshot : dataSnapshot.getChildren()) {
Log.d(TAG, "onDataChange: found user: " +
singleSnapshot.getValue(User.class).getUsername());
mUserList.add(singleSnapshot.getValue(User.class));
}
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
};
vfollowerslistview.setAdapter(viewfollowersadapter);
}
}
I cant seem to fit the entirw code in.
According to your comment, you are getting the following error:
Caused by: java.langCaused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.example.hope.myapplication.Models.User.getUser_id()' on a null object reference
Because your mUser object on which you are calling getUser_id() method has the value of null. This is happening because you haven't initialized the User object in your code at all. To solve this, please change the following line of code:
Query query = FirebaseDatabase.getInstance().getReference()
.child("Followers")
.child(mUser.getUser_id());
to
Query query = FirebaseDatabase.getInstance().getReference()
.child("Followers")
.child(mAuth.getCurrentUser().getUid());
In which mAuth.getCurrentUser() return a FirebaseUser object, so you can get the correct uid.
I have created an Android chat application which incorporates Firebase and created a fragment with a current users messages. The error occurs when a user sends a message to more than one person and the following image link shows how the first user is displayed whereas the most recent one who I have sent a message to is invisible. Does anyone know why this would be? I will include a few of my classes below.
My firebase is displayed as the following with messages containing first the user IDs, recipient IDs and then the unique message ID followed by the actual message and who sent it.
Thanks for your help.
https://i.stack.imgur.com/TrFUg.png
https://i.stack.imgur.com/M5LXa.png
Fragment Class
public class ChatFragment extends Fragment {
private RecyclerView convList;
private FirebaseAuth auth;
private DatabaseReference userDatabase, messageDatabase;
private View view;
public ChatFragment() {
// Required empty public constructor
}
// Chat Fragment initialised
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_chat, container, false);
convList = (RecyclerView) view.findViewById(R.id.conv_list);
convList.setHasFixedSize(true);
convList.setLayoutManager(new LinearLayoutManager(getContext()));
auth = FirebaseAuth.getInstance();
String currentUser;
currentUser = auth.getCurrentUser().getUid();
messageDatabase = FirebaseDatabase.getInstance().getReference().child("Messages").child(currentUser);
messageDatabase.keepSynced(true);
userDatabase = FirebaseDatabase.getInstance().getReference().child("Users");
userDatabase.keepSynced(true);
return view;
}
// Use FirebaseRecyclerAdapter to populate each user of which messages have been sent between, the latest message sent between each user displayed, ordering the list by most recent message and the user's online status
#Override
public void onStart() {
super.onStart();
Query conversationQuery = messageDatabase.orderByChild("time");
FirebaseRecyclerAdapter<UserConversation, ConvViewHolder> friendsRecyclerViewAdapter = new FirebaseRecyclerAdapter<UserConversation, ConvViewHolder>(
UserConversation.class,
R.layout.activity_user_list,
ConvViewHolder.class,
conversationQuery
) {
#Override
protected void populateViewHolder(final ConvViewHolder friendsViewHolder, final UserConversation friends, int i) {
final String user_id = getRef(i).getKey();
Query lastMessageQuery = messageDatabase.child(user_id).limitToLast(1);
// Retrieving data stored in Firebase for each message and its information
lastMessageQuery.addChildEventListener(new ChildEventListener() {
#Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
String data = dataSnapshot.child("message").getValue().toString();
ConvViewHolder.setMessage(data);
String time = dataSnapshot.child("time").getValue().toString();
ConvViewHolder.setTime(time);
}
#Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
#Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
#Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
userDatabase.child(user_id).addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
final String userName = dataSnapshot.child("name").getValue().toString();
String userThumb = dataSnapshot.child("thumb_image").getValue().toString();
String online = dataSnapshot.child("online").getValue().toString();
friendsViewHolder.setName(userName);
friendsViewHolder.setUserImage(userThumb, getContext());
friendsViewHolder.setUserOnline(online);
friendsViewHolder.mView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), Messenger.class);
intent.putExtra("user_id", user_id);
intent.putExtra("user_name", userName);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Log.i("Activity Not Found", "Error");
}
}
});
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
};
convList.setAdapter(friendsRecyclerViewAdapter);
}
public static class ConvViewHolder extends RecyclerView.ViewHolder {
static View mView;
public ConvViewHolder(View itemView) {
super(itemView);
mView = itemView;
}
public static void setMessage(String message){
TextView userStatusView = (TextView) mView.findViewById(R.id.user_single_status);
userStatusView.setText(message);
}
public void setName(String name) {
TextView userNameView = (TextView) mView.findViewById(R.id.user_single_name);
userNameView.setText(name);
}
public void setUserImage(String thumb_image, Context ctx) {
CircleImageView userImageView = (CircleImageView) mView.findViewById(R.id.user_single_image);
Picasso.with(ctx).load(thumb_image).placeholder(R.drawable.default_avatar).into(userImageView);
}
public static void setTime (String time){
TextView test = (TextView) mView.findViewById(R.id.time_sent);
test.setText(DateFormat.format("dd-MM-yyyy (HH:mm:ss)", Long.parseLong(time)));
}
public void setUserOnline(String online) {
ImageView userOnlineView = (ImageView) mView.findViewById(R.id.user_single_online_icon);
if(online.equals("true")){
userOnlineView.setVisibility(View.VISIBLE);
} else {
userOnlineView.setVisibility(View.INVISIBLE);
}
}
}
}