Android中的可转换列表视图

时间:2013-06-04 11:58:59

标签: android android-listview

我正在尝试在列表视图中获取可索引列表。我提到this。但是在使用代码时,我在StringMatcher类中使用韩语字符时遇到错误。谁能解释一下这门课的用法?英语字符也需要这个类吗?

提前致谢。

1 个答案:

答案 0 :(得分:5)

要使其发挥作用,还有一些变化。为了编译项目并摆脱韩国文本更新 StringMatcher类

package com.woozzu.android.util;

public class StringMatcher {
    public static boolean match(String value, String keyword) {
        if (value == null || keyword == null)
            return false;
        if (keyword.length() > value.length())
            return false;

        int i = 0, j = 0;
        do {
            int vi = value.charAt(i);
            int kj = keyword.charAt(j);
            if (isKorean(vi) && isInitialSound(kj)) {
            } else {
                if (vi == kj) {
                    i++;
                    j++;
                } else if (j > 0)
                    break;
                else
                    i++;
            }
        } while (i < value.length() && j < keyword.length());

        return (j == keyword.length())? true : false;
    }

    private static boolean isKorean(int i) {
        return false;
    }

    private static boolean isInitialSound(int i) {
        return false;
    }
}