I'm having problem while parsing Image in Fragment form Firestore with CircleImageView
See original GitHub issueMy Logcat Error is :
java.lang.ClassCastException: android.support.v7.widget.AppCompatImageView cannot be cast to de.hdodenhof.circleimageview.CircleImageView
at com.emahrb.firebasepushnotification.ProfileFragment.onCreateView(ProfileFragment.java:57)
and (ProfileFragment.java:57) line is :
circleImageView_face = view.findViewById(R.id.circleImageView_face);
It is may xml file :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ProfileFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="15dp"
android:background="@drawable/fragment_background">
<!-- TODO: Update blank fragment layout -->
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="42dp"
android:text="Your Profile"
android:textSize="25sp" />
<Button
android:id="@+id/logOutButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="24dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/border_button"
android:text="Log Out" />
<ImageView
android:id="@+id/circleImageView_face"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="109dp"
android:src="@drawable/ic_man" />
<TextView
android:id="@+id/textView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="227dp"
android:layout_toStartOf="@+id/textView"
android:text="User Name :"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/textView6"
android:layout_centerHorizontal="true"
android:text="Name"
android:textSize="18sp" />
</RelativeLayout>
</FrameLayout>
It is my ProfileFragment :
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.AppCompatImageView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.squareup.picasso.Picasso;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* A simple {@link Fragment} subclass.
*/
public class ProfileFragment extends Fragment {
private TextView tvUserName;
private CircleImageView circleImageView_face;
//private CircleImageView mProfileImage;
private Button mLogOutButton;
private FirebaseAuth mAuth;
private FirebaseFirestore mFirestore;
private String userID;
public ProfileFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_profile, container, false);
mAuth = FirebaseAuth.getInstance();
mFirestore = FirebaseFirestore.getInstance();
userID = mAuth.getCurrentUser().getUid();
mLogOutButton = view.findViewById(R.id.logOutButton);
circleImageView_face = view.findViewById(R.id.circleImageView_face);
//mProfileImage = view.findViewById(R.id.profile_image);
tvUserName = view.findViewById(R.id.tv_user_name);
mFirestore.collection("Users").document(userID).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
String user_name = documentSnapshot.getString("Name");
String user_pic = documentSnapshot.getString("Profile Pic");
tvUserName.setText(user_name);
Picasso.get().load(user_pic).placeholder(R.drawable.ic_man).into(circleImageView_face);
//RequestOptions placeHolderOption = new RequestOptions();
//placeHolderOption.placeholder(R.drawable.ic_man);
//Glide.with(container.getContext()).setDefaultRequestOptions(placeHolderOption).load(user_pic).into(mProfileImage);
}
});
mLogOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mAuth.signOut();
Intent logOut = new Intent(container.getContext(), LoginActivity.class);
startActivity(logOut);
}
});
return view;
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Recently Active 'android-glide' Questions - Page 19 - Stack Overflow
I am having a problem showing RecyclerView with StaggeredGridLayoutManager whose item contain an imageview and the image is loaded in imageview using glide....
Read more >Displaying Images with the Picasso Library
Displaying images is easiest using a third party library such as Picasso from Square which will download and cache remote images and abstract...
Read more >(PDF) Contact tracing using Firebase and Bluetooth Low Energy
PDF | This file describes a project for tracking Corona virus affected humans and alerting its users if they were given contacted with...
Read more >ios-image-util | launch image png files | Icon library
ios-image-util is a Java library typically used in User Interface, ... Why am I getting errors while adding launcher icon in flutter project?...
Read more >Continue: Error Cleartext Not Permitted Android Studio - Scribd
But when we try to run our application on the emulator, we saw this errorjava.io. ... bootstrap 4 carousel picture problem bootstrap 4...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
what fixed this issue my bro ?
whats the fix bro?