I'm trying to set Font Awesome Arrows as the 'previous' and 'next' instead of my page titles. How do I accomplish this? I know how to manually add in the words, now How can I change that to the referenced arrows defined in my strings.xml?
Typeface font = Typeface.createFromAsset( getAssets(), "fonts/fontawesome-webfont.ttf" );
@Override
public String getPageTitle(int position) {
if (position == current_position - 1) {
String title = "Previous";
return title;
} else if (position == current_position + 1) {
String title = "Next";
return title;
}
return title;
}
For future readers, this is what worked based on the answer provided:
final Typeface font = Typeface.createFromAsset(getAssets(), "fonts/fontawesome-webfont.ttf" );
@Override
public CharSequence getPageTitle(int position) {
String title = "";
if (position == current_position - 1) {
title = "\uf137";
SpannableStringBuilder styled = new SpannableStringBuilder(title);
styled.setSpan(new CustomTypefaceSpan("", font), 0, title.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
//Previous
return styled;
} else if (position == current_position + 1) {
//Next
title = "\uf138";
SpannableStringBuilder styled = new SpannableStringBuilder(title);
styled.setSpan(new CustomTypefaceSpan("",font), 0, title.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
return styled;
}