Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void chatUserPic(String id) {
- DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
- Query query = reference.child( "Users" ).child( id );
- query.addListenerForSingleValueEvent( new ValueEventListener() {
- @Override
- public void onDataChange(DataSnapshot dataSnapshot) {
- if (dataSnapshot.exists()) {
- final String URL_PROFILE = dataSnapshot.child( "thumb_image" ).getValue().toString();
- Picasso.with( getApplication() )
- .load( URL_PROFILE )
- .networkPolicy( NetworkPolicy.OFFLINE )
- .placeholder( R.drawable.no_profile )
- .into( mProfileImage, new Callback() {
- @Override
- public void onSuccess() {
- }
- @Override
- public void onError() {
- Picasso.with( getApplication() )
- .load( URL_PROFILE )
- .placeholder( R.drawable.no_profile )
- .into( mProfileImage );
- }
- } );
- } else {
- String URL_PROFILE = "no_profile";
- Log.i( "PAUL", URL_PROFILE );
- }
- }
- @Override
- public void onCancelled(DatabaseError databaseError) {
- }
- } );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement