@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
} // If it returns false the child divider won't appear
If you want to hide the group indicator for empty groups:
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + phoneNumber)); // "phoneNumber" is a string
context.startActivity(intent);
Email
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto", email, null)); // "email" is the recipients email address
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");
context.startActivity(Intent.createChooser(emailIntent, context.getString(R.string.send_email)));
Browser
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webURL));
context.startActivity(browserIntent);
In this case it is just a URL that can be clicked, it can be anything and do anything:
final String webURL = facilityInformation.getWeb();
TextView web = (TextView) convertView.findViewById(R.id.website);
Spannable span = Spannable.Factory.getInstance().newSpannable(webURL);
span.setSpan(new ClickableSpan() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webURL));
context.startActivity(browserIntent);
}
}, 0, webURL.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
web.setMovementMethod(LinkMovementMethod.getInstance());
web.setText(span);
return convertView;
Note:
- 0 and webURL.length() define the piece of the text that can be clicked.
- To set the link color you just add the following as an attribute to the TextView: "android:textColorLink="<color>""
If you use a toolbar as an action bar:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
...
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.my_home_us_up_indicator_drawable);
If you use regular action bar:
Bundle bundle = new Bundle();
bundle.putString(VideoTourFragment.URL, <string_URL>);
VideoTourFragment fragment = new VideoTourFragment();
fragment.setArguments(bundle);