0

I have just an ImageButton and TextView. I just want to write some text in TextView when i clicked the ImageButton. Here is my code.

final TextView txt = (TextView) findViewById(R.id.textView1);


        ImageButton btn = (ImageButton) findViewById(R.id.imageButton1);
        btn.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                txt.setText("abc");
            }
        });

In this case, this code is working as i want.
But when i want to use it within "tabhost" , it is not working.

Can anyone help me ?

Emre Koç
  • 1,343
  • 1
  • 25
  • 44

1 Answers1

0

Try using ImageButton.OnClickListener instead of View.OnClickListener

MobileMon
  • 8,341
  • 5
  • 56
  • 75