in my android app i am using expandable list view to display some text.These text contains web URLs so i want to set clickable to these URLs to go to the requested web page.i have added following xml line to my group layout to display links on my expandable list view.
android:autoLink="web"
It displays URLs with blue color but expandable list is not expanding and when i click on the link it will give following exception.How can i fix this??
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
after clicks on the parent child view displays its contents.
so i want to do is to set url clickable which display in parent.while expand and collapse the expandable list.
i did this but it also not working.
expList.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
Linkify.addLinks(groupNameContent, Linkify.WEB_URLS);
Log.e("setOnGroupClickListener", "tested");
return true;
}
});
parent is simply a text view when a user clicks on the parent it expand and display the child which contains additional details of parent: parent xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="11dp"
android:textStyle="normal"
/>
I will give you a different scenario which will accomplish the same target. That meas when you click on the ExpandableListView parent item, it will show the children. Then by clicking the same parent item will collapse the parent and ask the user whether he/she wants to go to any link which is in the parent text. Following images will show you what I am going to do here.

Expandable list view (Figure 1)
Expandable list view after click on a parent item

Give the options for user to choose to go to a link or back to normal interface

OnGroupClickListenerbut I am usingOnGroupCollapseListener.do it using
getGroup(groupPosition)