0

SimpleCursorAdapter をカスタマイズして値をデコードし、テキストビューに設定しようとしましたが、機能しません

私のカスタムsimplecursadapterクラス:

public class simpledecode extends SimpleCursorAdapter{

private NotesDbAdapter mDbHelper;
public simpledecode(Context context, int layout, Cursor c, String[] from,
        int[] to) {
    super(context, layout, c, from, to);
}
@Override
public void setViewText(TextView v, String text) {
    // TODO Auto-generated method stub
    super.setViewText(v, text);
    v.setText(mDbHelper.base64toString(text));
}

私のデコード方法:

public String base64toString(String text) 
{
    byte[] data1 = Base64.decode(text, Base64.DEFAULT);
    String text1 = null;
    try {
        return text1 = new String(data1, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        return null;
    }
}
4

1 に答える 1