I am beginner to android. I want to display a image description(Using AlertDialog) when a user click the image. But the AlertDialog box always shows the first saved message when I click the other image also? It doesn't reset when I click other images. Anyone please help me?

**MainActivity.java**

```
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    Spinner spinner;
    ImageView imageView,imgpt1,imgpt2,imgpt3,imgpt4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        spinner=(Spinner)findViewById(R.id.spinner);
        imageView=(ImageView)findViewById(R.id.imageViewspinner);
        imgpt1=(ImageView)findViewById(R.id.imagepart1);
        imgpt2=(ImageView)findViewById(R.id.imagepart2);
        imgpt3=(ImageView)findViewById(R.id.imagepart3);
        imgpt4=(ImageView)findViewById(R.id.imagepart4);

        imgpt1.setOnClickListener(this);
        imgpt2.setOnClickListener(this);
        imgpt3.setOnClickListener(this);
        imgpt4.setOnClickListener(this);
        List<String> categories=new ArrayList<String>();
        categories.add("Front View");
        categories.add("Side View");
        categories.add("Back View");
        categories.add("Top View");

        ArrayAdapter<String> stringArrayAdapter=new ArrayAdapter<String>(this,R.layout.support_simple_spinner_dropdown_item,categories);
        stringArrayAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        spinner.setAdapter(stringArrayAdapter);
        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                if(position==0)
                {
                    imageView.setImageResource(R.drawable.carfrontview);
                    imgpt1.setImageResource(R.drawable.frontbumpers);
                    imgpt1.setTag("frontbumpers");
                    imgpt2.setImageResource(R.drawable.frontfenders);
                    imgpt2.setTag("frontfenders");
                    imgpt3.setImageResource(R.drawable.frontgrilles);
                    imgpt2.setTag("frontgrilles");
                    imgpt4.setImageResource(R.drawable.frontheadlight);
                    imgpt2.setTag("frontheadlight");
                }
                else if(position==1)
                {
                    imageView.setImageResource(R.drawable.carsideview);
                    imgpt1.setImageResource(R.drawable.sidebumpers);
                    imgpt2.setImageResource(R.drawable.sidedoor);
                    imgpt3.setImageResource(R.drawable.sidefuelcovers);
                    imgpt4.setImageResource(R.drawable.sidemirror);

                }
                else if(position==2)
                {
                    imageView.setImageResource(R.drawable.carbackview);
                    imgpt1.setImageResource(R.drawable.backrearbumpers);
                    imgpt2.setImageResource(R.drawable.backrearmirror);
                    imgpt3.setImageResource(R.drawable.backrearwindow);
                    imgpt4.setImageResource(R.drawable.backtaillights);
                }
                else if(position==3)
                {
                    imageView.setImageResource(R.drawable.cartopview);
                    imgpt1.setImageResource(R.drawable.topbattery);
                    imgpt2.setImageResource(R.drawable.topfuelinjection);
                    imgpt3.setImageResource(R.drawable.topoildipstick);
                    imgpt4.setImageResource(R.drawable.topradiator);
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }

    @Override
    public void onClick(View v) {
        String message="";
        if(imgpt1.getTag()=="frontbumpers")
        {
            message="This is Bumper";
        }
        else if(imgpt1.getTag()=="frontfenders")
        {
            message="This is Fenders";
        }
        else if(imgpt1.getTag()=="frontheadlight")
        {
            message="This is headlight";
        }
        else if(imgpt1.getTag()=="frontgrilles")
        {
            message="This is grilles";
        }

        AlertDialog.Builder builder=new AlertDialog.Builder(MainActivity.this);
        builder.setTitle("Car Parts");
        builder.setMessage(message);
        builder.setNeutralButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        }).create().show();

    }
}

```