Android Open Source - bnote Date Simple Cursor Adapter






From Project

Back to project page bnote.

License

The source code is released under:

MIT License

If you think the Android project bnote 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 com.rd.bnote;
/*from  w ww  . j  av a2s .c om*/
import java.text.SimpleDateFormat;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.Cursor;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;

@SuppressLint("SimpleDateFormat")
public class DateSimpleCursorAdapter extends SimpleCursorAdapter {

  @SuppressWarnings("deprecation")
  public DateSimpleCursorAdapter(Context context, int layout, Cursor c,
      String[] from, int[] to) {
    super(context, layout, c, from, to);
  }
  @Override
    public void setViewText(TextView v, String text) {
        if (v.getId() == R.id.note_list_item_date) {
            text = GetDate(Long.parseLong(text), "MM?dd?");
        }
        v.setText(text);
    }
  public static String GetDate(Long milliSeconds, String dateFormat) {
      SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
      return formatter.format(milliSeconds);
  }
}




Java Source Code List

com.rd.bnote.DBHelper.java
com.rd.bnote.DBManager.java
com.rd.bnote.DateSimpleCursorAdapter.java
com.rd.bnote.EditActivity.java
com.rd.bnote.JSONParser.java
com.rd.bnote.ListActivity.java
com.rd.bnote.Note.java
com.rd.bnote.SearchableActivity.java