0

I am making an android app in which i have an activity X that displays a list and a button. Activity X calls a listview to display that list. Each list item has a number(textview) and a checkbox. I used a setonclicklistener on the checkbox, so whenever the checkbox is checked i am storing the number associated with it in a string. Now i want that whenever i click the button the msg activity should start and the numbers to be sent are the ones that are checked. I am using the following code to start the msg activity in my X activity.

Intent msgIntent = new Intent(Intent.ACTION_VIEW, Uri
                        .fromParts("sms", msgnumbers, null));
                msgIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(msgIntent);

Now "msgsnumbers" variable is present in my listview. How do I pass it to this activity X??
I found the same question here but with no appropriate solution.
-Thanks in advance

Community
  • 1
  • 1
Antrromet
  • 15,294
  • 10
  • 60
  • 75
  • Just to be clear...I am not clicking the item of the ListView directly. Inside the ListView my each item comprises of 2 things: TextView and a CheckBox. I am clicking the CheckBox. – Antrromet Dec 13 '11 at 10:31

2 Answers2

1
Intent in = new Intent(Quote.this, Purchase Ysn.class);
in.putExtra("price", salesprc);
public static String price = "price";
if (getIntent().getExtras().containsKey(price)) {
    purces_nbcpy = getIntent().getExtras().getDouble(price);
}
Tim Post
  • 33,371
  • 15
  • 110
  • 174
jigspatel
  • 400
  • 3
  • 14
0

onItemClickListener for ListView has a param position that tells you what position has been clicked.

so if you are using an ArrayList (for eg) to provide values for listItems in adapter you can use this inside onItemClickListener

MyBeanObject object=arraList.get(position);
//use getters of object to retrieve values and pass it as intent
//where arrayList may be your list of objects MyBeanObject 
Its not blank
  • 3,055
  • 22
  • 37
  • I am not clicking the item of the ListView. Inside the ListView my each item comprises of 2 things: TextView and a CheckBox. I am clicking the CheckBox. – Antrromet Dec 13 '11 at 10:21