-8

im newbie to android development. i have 3 TextViews and a button in a ListView Control. my doubt is while clicking on this button i want to get selected list items TextView text, may i know how to get it?

Jey2331129
  • 13
  • 5

1 Answers1

0

First you take the text of the textView in a String and then (I guess you have to send it to other activity if im r8 then do as i do it in the following code)

String xyz = textView.getText().toString();

 button = (Button) findViewById(R.id.button);

    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
                        Intent intent = new Intent(YOUR_PRESENT_ACTIVITY.this, YOUR_NEXT_ACTIVITY.class);
intent.putExtra("key", xyz);
startActivity(intent);
}
});

then in your YOUR_NEXT_ACTIVITY

Intent in = getIntent();
String str = in.getStringExtra(("key")); 
Saad
  • 309
  • 2
  • 9
  • 21
  • saad, thanks for your respoonse. but, i dont know where i have to put this code and what is getIntent etc.? can u please post indetail? – Jey2331129 May 10 '13 at 14:09
  • i resolved it . set android:focusable="false" android:clickable="true" to textview and set android:focusable="false" android:clickable="false" to button. – Jey2331129 May 11 '13 at 08:52
  • sry i was on a holiday, thats why couldn't reply... You have to write this code in your oncreate method... – Saad May 13 '13 at 04:33