0
imageView1 : onclick


Intent slave1_permission = new Intent(getApplicationContext(),
                        AddPermissions.class);
                startActivity(slave1_permission);

imageView2. onclick         


Intent slave2_permission = new Intent(getApplicationContext(),
                        AddPermissions.class);
                startActivity(slave2_permission);

imageView3.OnClick          


Intent slave3_permission = new Intent(getApplicationContext(),
                        AddPermissions.class);
                startActivity(slave3_permission);   
Ian
  • 30,182
  • 19
  • 69
  • 107
Ajay
  • 95
  • 3
  • 3
    Possible duplicate of [How do I pass data between activities on Android?](http://stackoverflow.com/questions/2091465/how-do-i-pass-data-between-activities-on-android) – Mike M. Mar 27 '16 at 03:45

1 Answers1

1

This is really simple. All you need is to send the id of the ImageView in the extras while starting the activity. Something like this.

public void onClick(View view){
    Intent intent = new Intent(getApplicationContext(), AddPermissions.class);
    intent.putExtra("activityStartedBy", "First_Image_View");
    //Or any other unique specifier
    startActivity(intent);
}

and in the activity onCreate(Bundle bundle) you can easily extract this variable to know who called this activity

@Override
public  void onCreate(Bundle savedInstanceState) {
    Bundle bundle = getIntent().getExtras();
    String startedBy = (String) bundle.get("activityStartedBy");
        switch(startedBy){
        //TODO: Do whatever you need to do
        }
}

Let me know, if you need help.

Dave Ranjan
  • 2,966
  • 24
  • 55