Question

I'm trying to use Jake Wharton's TitlePageIndicator and having this issue.

In the getTitle() method in TitlePageIndicator.java, getPageTitle is red-underlined with an error message saying "The method getPageTitle(int) is undefined for the type PagerAdapter."

private CharSequence getTitle(int i) {
     CharSequence title = mPagerAdapter.getPageTitle(i);
     if (title == null) {
         title = EMPTY_TITLE;
     }
     return title.toString();
 }

However, the PagerAdapter.class in android-support-v4.jar attached in this project does have getPageTitle method defined in it. (See below)

public CharSequence getPageTitle(int position) {
    return null;
}

Please help me fix this issue. Thanks in advance.

EDIT: Strangely, the underline (and error) disappeared when I opened the source of PageAdapter.java from the support library. The problem may return later, but I'm ok for now.

Thanks!

Was it helpful?

Solution

Your issue was probably scope. When it says undefined for type -insert type here-, you can assume whatever type it is is not recognized within the scope of whatever project you are working. Since opening the source worked, then it must have moved or imported it. Its hard to tell since all you gave is that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top