0

i am working on a app that has listview as the first activity. problem is that it is a question and answer app. whatever be the click(in the listview) the launching interface will be same the only difference will be questions And Answers(String from string array). problem is how to use a single intent that will help me differentiate between what was clicked in the listview so i could fetch the appropriate Q and A

Thanks in advance

dreamer1989
  • 1,075
  • 3
  • 12
  • 29
  • maybe something like that: http://stackoverflow.com/questions/3848148/sending-information-with-intent-putextra – zapl Aug 12 '12 at 00:54
  • @zapl thanks, looking forward to it – dreamer1989 Aug 12 '12 at 01:04
  • @dreamer1989 however you need to start a new activity, in this case a list activity similar to first one, but view is slightly different? Then the list adapter going to be differ, you can pass the currently selected list item with the intent. – code-jaff Aug 12 '12 at 03:34
  • @thujeevan sir, is there a tutorial on the same. as i am not able to get your point – dreamer1989 Aug 12 '12 at 20:45

1 Answers1

2

take this

v =(ListView) this.findViewById(R.id.cenima);
v.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position,long id) 
    {
    Log.i("position ", ""+position);
        //do samthing
    }
});
Rostyslav Dzinko
  • 39,424
  • 5
  • 49
  • 62
Ryodo
  • 445
  • 5
  • 17
  • thanks,but it is not what i am looking for as i am able to generate click and start new activity. problem is i want to use a single activity whatever is clicked on listview. – dreamer1989 Aug 12 '12 at 01:11