If you think the Android project LyricHere listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package cn.zhaiyifan.lyrichere.adapters;
/*www.java2s.com*/import android.content.Context;
import android.database.Cursor;
import android.widget.FilterQueryProvider;
import android.widget.SimpleCursorAdapter;
import cn.zhaiyifan.lyrichere.utils.DbUtils;
import cn.zhaiyifan.lyrichere.utils.Util;
/**
* Created by yifan on 6/19/14.
*/publicclass LyricCursorAdapter extends SimpleCursorAdapter {
privatestaticfinal String TAG = LyricCursorAdapter.class.getSimpleName();
public LyricCursorAdapter(final Context context, int layout, Cursor c, String[] from, int[] to, int flags) {
super(context, layout, c, from, to, flags);
setFilterQueryProvider(new FilterQueryProvider() {
@Override
public Cursor runQuery(CharSequence constraint) {
Util.log(TAG, "runQuery: " + constraint);
return DbUtils.searchByKeyword(context.getContentResolver(), constraint.toString());
}
});
}
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
Util.log(TAG, "runQueryOnBackgroundThread: " + constraint);
return super.runQueryOnBackgroundThread(constraint);
}
}