public int[] object = new int[] { R.drawable.line1,R.drawable.line2}; //line1,2 is image line1.png and line2.png
Button button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(new OnClickListener() { public void onClick(View v) { imgView .setVisibility(View.VISIBLE); } }); Button button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(new OnClickListener() { public void onClick(View v) { imgView .setVisibility(View.INVISIBLE); } });
imgView.setImageResource(object[i]); // i is index
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)