Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Java
public int[] object = new int[] { R.drawable.line1,R.drawable.line2}; 
//line1,2 is image line1.png and line2.png


covert to imageview and click for show and hide image

Java
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);
                }
            });
Posted

1 solution

Just try this...
imgView.setImageResource(object[i]);  // i is index
 
Share this answer
 
Comments
Eerven 23-Jun-14 10:25am    
thx for response I will try this, thx again :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900