Closed MohamedMedhat2018 closed 6 years ago
The exception says: [..]ConstraintLayout cannot be cast to [..]CircleImageView
so it seems findViewById(R.id.setup_image)
returns a ConstraintLayout
- that's not an issue with this library. Please double-check your IDs and maybe clean the project.
what do you mean by check your IDs and maybe clean the project?
Make sure that (a) @+id/setup_image
is only used once, at the correct place and (b) you are inflating the correct layout. Use "Clean Project" from the "Build" menu in Android Studio.
thank you so much you save the rest of my day Have a nice day bro
I have an Error it's occur when i try to call the image by its ID -XML code :
<de.hdodenhof.circleimageview.CircleImageView android:id="@+id/setup_image"
-Java file `import de.hdodenhof.circleimageview.CircleImageView;public class SetupActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_setup);
----------Error:
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.mohamed.photo_blog, PID: 8120 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mohamed.photo_blog/com.example.mohamed.photo_blog.SetupActivity}: java.lang.ClassCastException: android.support.constraint.ConstraintLayout cannot be cast to de.hdodenhof.circleimageview.CircleImageView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2799) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864) at android.app.ActivityThread.access$900(ActivityThread.java:181) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6126) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) Caused by: java.lang.ClassCastException: android.support.constraint.ConstraintLayout cannot be cast to de.hdodenhof.circleimageview.CircleImageView at com.example.mohamed.photo_blog.SetupActivity.onCreate(SetupActivity.java:33)
Appreciate the help.