[Solved] Wondering why my app crashes


Looking at your code it seems that you made a typo here:

TextView DialogText=(TextView) findViewById(R.id.imageViewDialog);

It should be

TextView DialogText=(TextView) findViewById(R.id.textViewDialog);

or whatever the name of the id for this TextView is.

Apart from that, you need to learn to read the messages from the LogCat as they are often very informative. Cleary it says:

Caused by: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.TextView 

which indicates the reason and

at com.nando.gridview.Dialog.onCreate(Dialog.java:21)

indicates where it occurs in your code.

It might be a pain to understand how to read the stacktrace at the beginning but when you’ll get that, it will save a lot of time as you will be able to identify why and where the app crashes.

0

solved Wondering why my app crashes