3

Here is my Code:

ImageButton ibtnCherry;
ImageButton ibtnSelected;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.setup);

    ibtnCherry = (ImageButton)findViewById(R.id.ibtnCherry);

    ibtnCherry.setOnClickListener(this);
}

onClick:

@Override
public void onClick(View view) {
    ibtnSelected = ??????????;
    Intent sdintent = new Intent(Intent.ACTION_PICK);
    sdintent.setType("image/*");
    sdintent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(sdintent, GlobaleVariablen.SD_REQUEST);
}

My Problem is, that I need something like "ibtnSelected = ibtnCherry" in the row with the questionmarks, but dynamically, so when another button (e.g. ibtnTmp) fires the same onClick event, ibtnTmp is saved in ibtnSelected.

Is there any chance to get the element in the onClick event that fires it?

4

1 回答 1

2

只要使用ibtnSelected = view;就足够了。:-)

于 2012-11-02T08:48:31.893 回答