Hi just wondering how I can make a listener or sorts. I wanna make it so when one of the childs are click it opens a YouTube video INSIDE the App, not as a Web actitivity....anyways the iportant part is not the youtube part, i just want to know how i can make each child open a different youtube link of its own.
To be clear, my question is: HOW can i make each child do something different, for example open a youtube link or EVEN open a new intent.
this is what i got so far.
public class Adobe extends Activity{
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<String>> listDataChild;
String name;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.adobe);
// get the list view
expListView = (ExpandableListView) findViewById(R.id.lvExp);
prepareListData();
listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
// setting list adapter, show the list
expListView.setAdapter(listAdapter);
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// This is just testing to see what i come up with
name = v.getTag().toString();
switch (childPosition) {
case 0:
Toast.makeText(getBaseContext(), "Intro", Toast.LENGTH_LONG ).show();
break;
default:
Toast.makeText(getBaseContext(), "" + childPosition, Toast.LENGTH_SHORT ).show();
break;
}
return false;
}
});
}
PS. the child as set as Buttons instead of Textview in the XML file, but if i can do with Textview then ill will.
PSSS. the list is already made in another function, just didnt included here so it wasnt too long.