Android Studio – Cannot resolve symbol “mainImageView’ and ”description”, while I already declared. But why the title is okay?

I don’t know how to solve this please help

Error

activity_store_directory_details.xml

Answer

UPDATED ANSWER: As the question is updated, the updated solution is to use the same id what you’ve given in your XML file in your Activity file like the below code:

mainImageView = findViewById(R.id.imgSTOREDETAILS);
title = findViewById(R.id.txtSTORETITLEDETAILS);
description = findViewById(R.id.txtSTOREDESCRIPTIONDETAILS);

PREVIOUS ANSWER:

You need to ensure that your view ids are declared properly in your activity_store_directory_details.xml file. Please refer the below code for understanding purpose.

<ImageView
    android:id="@+id/mainImageview"
    .../>

<TextView
    android:id="@+id/title"
    .../>

<TextView
    android:id="@+id/description"
    .../>