Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8434613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:42:17+00:00 2026-06-10T06:42:17+00:00

I have a Text Memo Android app which takes in text and adds it

  • 0

I have a Text Memo Android app which takes in text and adds it to the database. I have previously added few stuff into the database and when I open the Memo Activity, the list of these previous entered data is shown in rows. But when I Create a new Memo and hit save, nothing happens. It neither shows an error nor “force close” dialogue.

This is my MemoActivity.java:

public class MemoActivity extends ListActivity {
private Button newMemoButton;
Typeface kannadaFont;
private MemoDbAdapter memoDbAdapter;
private Cursor cursor;



@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.memo);
    kannadaFont = Typeface.createFromAsset(getAssets(), "fonts/Lohit-Kannada.ttf");

    memoDbAdapter = new MemoDbAdapter(this);
    memoDbAdapter.open();
    fillData();

    // Use our own list adapter
    setListAdapter(new MemoListAdapter(this));

    newMemoButton = (Button) findViewById(R.id.buttonNewMemo);
    newMemoButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View arg0) {
            Intent intent = new Intent(getBaseContext(), TextEditorActivity.class);
            // Intent intent = new Intent(MemoActivity.this, TextEditorActivity.class);
            startActivity(intent);
        }
    });
}

@Override
protected void onDestroy() {
    super.onDestroy();
    if (memoDbAdapter != null) {
        memoDbAdapter.close();
    }
}

private void fillData() {
    cursor = memoDbAdapter.fetchAllMemos();
    startManagingCursor(cursor);
    String[] from = new String[] { MemoDbAdapter.KEY_CREATED_DATE, MemoDbAdapter.KEY_CREATED_TIME,
            MemoDbAdapter.KEY_NOTE };
    int[] to = new int[] { R.id.createdDate, R.id.createdTime, R.id.content };
    // Now create an array adapter and set it to display using our row
    SimpleCursorAdapter notes = new MemoListAdapter2(this, R.layout.memo_entry, cursor, from, to);
    setListAdapter(notes);
}

private class MemoListAdapter2 extends SimpleCursorAdapter {
    public MemoListAdapter2(Context context, int layout, Cursor c, String[] from, int[] to) {
        super(context, layout, c, from, to);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        String createdDate = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_CREATED_DATE));
        String createdTime = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_CREATED_TIME));
        String memoNote = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_NOTE));
        String memoId = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_ROWID));
        int position = new Integer(memoId);

        MemoView mv = new MemoView(context, LayoutInflater.from(context), createdDate, createdTime,
                memoNote, false);
        mv.setOnClickListener(new OnItemClickListener(position));
        mv.editButton.setOnClickListener(new OnEditMemoClickListener(position));
        mv.deleteButton.setOnClickListener(new OnDeleteMemoClickListener(position));
        return mv;
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        String createdDate = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_CREATED_DATE));
        String createdTime = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_CREATED_TIME));
        String memoNote = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_NOTE));
        String memoId = cursor.getString(cursor.getColumnIndex(MemoDbAdapter.KEY_ROWID));
        int position = new Integer(memoId);

        MemoView mv = (MemoView) view;
        mv.setCreatedDate(createdDate);
        mv.setCreatedTime(createdTime);
        mv.setContent(memoNote);
        mv.setExpanded(false);
        mv.setOnClickListener(new OnItemClickListener(position));
        mv.editButton.setOnClickListener(new OnEditMemoClickListener(position));
        mv.deleteButton.setOnClickListener(new OnDeleteMemoClickListener(position));
    }

    public void toggle(int position) {
        // mExpanded[position] = !mExpanded[position];
        notifyDataSetChanged();
    }
}

private class MemoListAdapter extends BaseAdapter {
    private Context mContext;
    private LayoutInflater mInflater;

    public MemoListAdapter(Context context) {
        mContext = context;
        mInflater = LayoutInflater.from(context);
    }

    public int getCount() {
        return mContents.length;
    }

    /**
     * Since the data comes from an array, just returning the index is sufficient to get at the data. If
     * we were using a more complex data structure, we would return whatever object represents one row in
     * the list.
     * 
     * @see android.widget.ListAdapter#getItem(int)
     */
    public Object getItem(int position) {
        return position;
    }

    /**
     * Use the array index as a unique id.
     * 
     * @see android.widget.ListAdapter#getItemId(int)
     */
    public long getItemId(int position) {
        return position;
    }

    /**
     * Make a MemoView to hold each row.
     * 
     * @see android.widget.ListAdapter#getView(int, android.view.View, android.view.ViewGroup)
     */
    public View getView(int position, View convertView, ViewGroup parent) {
        MemoView mv;
        if (convertView == null) {
            mv = new MemoView(mContext, mInflater, mDates[position], mTimes[position],
                    mContents[position], mExpanded[position]);
        } else {
            mv = (MemoView) convertView;
            mv.setCreatedDate(mDates[position]);
            mv.setCreatedTime(mTimes[position]);
            mv.setContent(mContents[position]);
            mv.setExpanded(mExpanded[position]);
        }
        mv.setOnClickListener(new OnItemClickListener(position));
        mv.editButton.setOnClickListener(new OnEditMemoClickListener(position));
        mv.deleteButton.setOnClickListener(new OnDeleteMemoClickListener(position));
        return mv;
    }

    public void toggle(int position) {
        mExpanded[position] = !mExpanded[position];
        notifyDataSetChanged();
    }

    /**
     * Our data, part 1.
     */
    private String[] mDates = { "22/05/1961", "22/05/1967", "22/05/1973", "22/05/1977", "22/05/1983",
            "22/05/1990", "22/05/1994", "22/05/1998", "22/05/2010" };

    /**
     * Our data, part 2.
     */
    private String[] mTimes = { "1:31 PM", "9:53 AM", "11:02 AM", "10:20PM", "2:46 PM", "10:34 PM",
            "10:26 AM", "2:31 PM", "8:51 PM" };

    /**
     * Our data, part 3.
     */
    private String[] mContents = {
            "ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ಭಾರತದ ಸಾಹಿತಿಗಳಿಗೆ ಸಲ್ಲುವ ಅತ್ಯಂತ ಪ್ರತಿಷ್ಟಿತ ಪ್ರಶಸ್ತಿ. "
                    + "ಈ ಪ್ರಶಸ್ತಿಯು ಭಾರತದ ಸಂವಿಧಾನದ ಎಂಟನೆ ಅನುಛ್ಛೇದದಲ್ಲಿ ಉಲ್ಲೇಖವಾಗಿರುವ "
                    + "ಭಾಷೆಗಳಲ್ಲಿ ಅತ್ಯುತ್ತಮ ಸಾಹಿತ್ಯ ಕೃತಿಯನ್ನು ರಚಿಸಿದ ಭಾರತೀಯ ನಾಗರಿಕನಿಗೆ ಲಭಿಸುವುದು. "
                    + "ಈ ಪ್ರಶಸ್ತಿಯನ್ನು ಮೇ ೨೨ ೧೯೬೧ ರಲ್ಲಿ ಸ್ಥಾಪಿಸಲಾಯಿತು. ಈ ಪ್ರಶಸ್ತಿಯನ್ನು ಪ್ರಪ್ರಥಮವಾಗಿ "
                    + "೧೯೬೫ ರಲ್ಲಿ ಮಲೆಯಾಳಂ ಲೇಖಕ ಜಿ. ಶಂಕರ ಕುರುಪರಿಗೆ ಪ್ರದಾನ ಮಾಡಲಾಯಿತು. "
                    + "ವಿಜೇತರಿಗೆ ಪ್ರಶಸ್ತಿ ಫಲಕ, ಐದು ಲಕ್ಷ ರುಪಾಯಿ ನಗದು ಹಾಗು ವಾಗ್ದೇವಿಯ ಕಂಚಿನ "
                    + "ವಿಗ್ರಹವನ್ನು ನೀಡಿ ಗೌರವಿಸಲಾಗುವುದು.",

            "ಕುವೆಂಪು - ಕುಪ್ಪಳ್ಳಿ ವೆಂಕಟಪ್ಪ ಪುಟ್ಟಪ್ಪ (೧೯೦೪ - ೧೯೯೪) - "
                    + "ಕನ್ನಡವು ಪಡೆದ ಅತ್ಯುತ್ತಮ ಕವಿ, 'ರಾಷ್ಟ್ರಕವಿ'. "
                    + "ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯನ್ನು ಪಡೆದ ಕನ್ನಡದ ಪ್ರಥಮ ವ್ಯಕ್ತಿ. "
                    + "'ವಿಶ್ವ ಮಾನವ'. ಕನ್ನಡ ಸಾಹಿತ್ಯಕ್ಕೆ ಇವರ ಕಾಣಿಕೆ ಅಪಾರ.",

            "'ದ.ರಾ.ಬೇಂದ್ರೆ - ಕುಣಿಯೋಣು ಬಾರಾ ಕುಣಿಯೋಣು ಬಾ', " + "'ಇಳಿದು ಬಾ ತಾಯಿ ಇಳಿದು ಬಾ', "
                    + "'ನಾನು ಬಡವಿ ಆತ ಬಡವ ಒಲವೆ ನಮ್ಮ ಬದುಕು', "
                    + "ಎಂದು ಆರಂಭವಾಗುವ ಕವಿತೆಗಳನ್ನು ಕೇಳದ ಕನ್ನಡಿಗನಿಲ್ಲ. " + "ಉತ್ಸಾಹದ ಚಿಲುಮೆಯನ್ನುಕ್ಕಿಸಬಲ್ಲ, "
                    + "ನೊಂದ ಜೀವಕ್ಕೆ ಸಾಂತ್ವನ ನೀಡಬಲ್ಲ, "
                    + "ಪ್ರೀತಿ ಪ್ರೇಮಗಳನ್ನು ಮೂಡಿಸಬಲ್ಲ ಕವಿತೆಗಳನ್ನು ರಚಿಸಿಕೊಟ್ಟ ವರಕವಿ ಬೇಂದ್ರೆ. "
                    + "ರಸವೆ ಜನನ, ವಿರಸವೆ ಮರಣ, ಸಮರಸವೆ ಜೀವನ ಎಂದು ಜೀವನವನ್ನು "
                    + "ಕುರಿತು ಪರಿಣಾಮಕಾರಿಯಾಗಿ ಹೇಳಿದ ಧೀಮಂತ ಕವಿ.",

            "ಶಿವರಾಮ ಕಾರಂತ - ಜ್ಞಾನಪೀಠ ಪುರಸ್ಕೃತ ಡಾ. ಶಿವರಾಮ ಕಾರಂತರು ಹುಟ್ಟಿದ್ದು "
                    + "ಉಡುಪಿ ಜಿಲ್ಲೆಯ ಕೋಟದಲ್ಲಿ ೧೯೦೨, ಅಕ್ಟೋಬರ್ ೧೦ರಂದು. "
                    + "ಒಂದು ಶತಮಾನಕ್ಕೆ ನಾಲ್ಕು ವರ್ಷಗಳಷ್ಟೇ ಕಮ್ಮಿ ಬಾಳಿ, "
                    + "ಅರ್ಥಪೂರ್ಣ ಬದುಕು ಕಳೆದ ಸಾಹಿತ್ಯ ದಿಗ್ಗಜ ಡಾ. "
                    + "ಶಿವರಾಮ ಕಾರಂತರು ೧೯೯೭, ಡಿಸೆಂಬರ್ ೦೯ ರಂದು ನಿಧನ ಹೊಂದಿದರು. "
                    + "ತಮ್ಮ ಜೀವಿತಾವಧಿಯಲ್ಲಿ ಸುಮಾರು ೪೨೭ ಪುಸ್ತಕಗಳನ್ನು ರಚಿಸಿದರು. "
                    + "ಅವುಗಳಲ್ಲಿ ಕಾದಂಬರಿಗಳು ೪೭. ತಮ್ಮ ೯೬ನೆಯ ವಯಸ್ಸಿನಲ್ಲೂ ಹಕ್ಕಿಗಳ "
                    + "ಕುರಿತು ಒಂದು ಪುಸ್ತಕವನ್ನು ಬರೆದಿದ್ದು, ಇದು ವಿಶ್ವ ದಾಖಲೆಗೆ "
                    + "ಅರ್ಹವಾಗಿರುವ ಒಂದು ಸಾಧನೆ ಎನ್ನಬಹುದು.",

            "ಮಾಸ್ತಿ ವೆಂಕಟೇಶ ಅಯ್ಯಂಗಾರರು (ಜೂನ್ ೬ ೧೮೯೧ - ಜೂನ್ ೬ ೧೯೮೬) "
                    + "- ಕನ್ನಡದ ಒಬ್ಬ ಅಪ್ರತಿಮ ಲೇಖಕರು. ಕನ್ನಡ ಸಾಹಿತ್ಯ ಲೋಕದಲ್ಲಿ ಮಾಸ್ತಿ "
                    + "ಎಂದೇ ಖ್ಯಾತರಾಗಿರುವ ಈ ಸಾಹಿತಿ ಶ್ರೀನಿವಾಸ ಎಂಬ ಕಾವ್ಯನಾಮದಡಿಯಲ್ಲಿ ಬರೆಯುತ್ತಿದರು. "
                    + "೧೯೮೩ ರಲ್ಲಿ ಚಿಕವೀರ ರಾಜೇಂದ್ರ ಕಾದಂಬರಿಗಾಗಿ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯಿಂದ "
                    + "ಪುರಸ್ಕೃತಗೊಂಡ ಮಾಸ್ತಿಯವರು ಕನ್ನಡಕ್ಕೆ ನಾಲ್ಕನೆ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯನ್ನು ತಂದು ಕೊಟ್ಟರು. "
                    + "ಜೀವನ ಪರ್ಯಂತ ಕನ್ನಡ ಸೇವೆಯನ್ನು ಮಾಡಿದ ಮಾಸ್ತಿಯವರು ಜೂನ್ ೬ ೧೯೮೬ ರಂದು ನಿಧನ ಹೊಂದಿದರು.",

            "ವಿನಾಯಕ ಕೃಷ್ಣ ಗೋಕಾಕ - ಕನ್ನಡಕ್ಕೆ ಐದನೆಯ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯನ್ನು ೧೯೯೧ರಲ್ಲಿ ತಂದುಕೊಟ್ಟ "
                    + "ವಿನಾಯಕ ಕೃಷ್ಣ ಗೋಕಾಕರು ಹಲವು ರೀತಿಯಲ್ಲಿ ಅದೃಷ್ಠವಂತರು. "
                    + "ಅವರು ಕನ್ನಡದ ಪ್ರತಿಭಾವಂತ ಕವಿ, ಪಂಡಿತರಾಗಿದ್ದರು. "
                    + "ಕನ್ನಡ-ಇಂಗ್ಲೀಷ್ ಭಾಷೆಗಳಲ್ಲಿ ಸಮಾನ ಪ್ರಭುತ್ವ ಪಡೆದಿದ್ದ ಅವರು "
                    + "ತಮ್ಮ ಜೀವಿತ ಕಾಲದಲ್ಲೇ ಒಬ್ಬ ಪ್ರತಿಭಾವಂತ ಸಾಹಿತಿಗೆ ದೊರಕಬೇಕಾದ "
                    + "ಎಲ್ಲ ಸಿದ್ಧಿ, ಪ್ರಸಿದ್ಧಿಗಳನ್ನು ಪಡೆದರು. "
                    + "ಗೋಕಾಕರು ಇದಕ್ಕೂ ಮೊದಲು ಭಾರತೀಯ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ಆಯ್ಕೆ ಸಮಿತಿಯ ಅಧ್ಯಕ್ಷರಾಗಿದ್ದರು.",

            "ಯು.ಆರ್.ಅನಂತಮೂರ್ತಿ - ಕನ್ನಡಕ್ಕೆ ಆರನೆಯ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ೧೯೯೪ರಲ್ಲಿ ಬಂದಾಗ ಕನ್ನಡ ಸಾಹಿತ್ಯ "
                    + "ಲೋಕ ಮತ್ತೊಮ್ಮೆ ಇಡೀ ದೇಶದ ಗಮನ ಸೆಳೆಯಿತು. "
                    + "ಈ ಗೌರವ ಪಡೆದವರು ಡಾ| ಉಡುಪಿ ರಾಜಗೋಪಾಲಾಚಾರ್ಯ ಅನಂತಮೂರ್ತಿ. "
                    + "ತಮ್ಮ ಬಹುಚರ್ಚಿತ ಸಂಸ್ಕಾರ ಕಾದಂಬರಿಯಿಂದ ಭಾರತೀಯ ಸಾಹಿತ್ಯ "
                    + "ಮತ್ತು ಚಲನಚಿತ್ರ ರಂಗಗಳಲ್ಲಿ ಒಂದು ದೊಡ್ಡ ವಿವಾದವನ್ನೇ ಮಾಡಿದ ಅನಂತಮೂರ್ತಿ "
                    + "ಅವರು ಹುಟ್ಟಿದ್ದು ಶಿವಮೊಗ್ಗ ಜಿಲ್ಲೆಯ ತೀರ್ಥಹಳ್ಳಿ ತಾಲ್ಲೂಕಿನ ಮೇಳಿಗೆ ಹಳ್ಳಿಯಲ್ಲಿ. "
                    + "ಇಬ್ಬರು ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ವಿಜೇತ (ಕುವೆಂಪು ಮತ್ತು ಅನಂತಮೂರ್ತಿ) ರನ್ನು "
                    + "ನೀಡಿದ ಹೆಗ್ಗಳಿಕೆ ತೀರ್ಥಹಳ್ಳಿ ತಾಲ್ಲೂಕಿನದು. "
                    + "ಇವರು ಹುಟ್ಟಿದ್ದು ೧೯೩೨ರ ಡಿಸೆಂಬರ್ ೨೧ರಂದು. "
                    + "ತಂದೆ ಉಡುಪಿ ರಾಜಗೋಪಾಲಾಚಾರ್ಯ. ತಾಯಿ ಸತ್ಯಮ್ಮ (ಸತ್ಯಭಾಮ).",

            "ಗಿರೀಶ್ ರಘುನಾಥ್ ಕಾರ್ನಾಡ್ (ಹುಟ್ಟು - ಮೇ ೧೯, ೧೯೩೮) "
                    + "ಕನ್ನಡಕ್ಕೆ ಏಳನೇ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ತಂದುಕೊಟ್ಟ ಕನ್ನಡ "
                    + "ಸಾಹಿತ್ಯದ ನಾಟಕ ಕ್ಷೇತ್ರಕ್ಕೆ ಸಾಹಿತಿ. "
                    + "ಭಾರತದಲ್ಲೇ ನಾಟಕ ಸಾಹಿತ್ಯ ರಚನೆಗೆ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ "
                    + "ಪಡೆದವರಲ್ಲಿ ಕಾರ್ನಾಡ್ ಮೊದಲಿಗರು. " + "ಮತ್ತು ಇಬ್ಬರು ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ಪುರಸ್ಕೃತರ "
                    + "ಕಾದಂಬರಿಗಳನ್ನು ಸಿನಿಮಾ ಮಾಡಿದ ಏಕೈಕ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ "
                    + "ಪುರಸ್ಕೃತರೆಂಬ ಗೌರವಕ್ಕೆ ಕಾರ್ನಾಡ್ ಪಾತ್ರರಾಗಿದ್ದಾರೆ.",

            "ಡಾ. ಚಂದ್ರಶೇಖರ ಕಂಬಾರ (ಜನನ- ೨ ಜನವರಿ ೧೯೩೭)ರಂದು "
                    + "ಬೆಳಗಾವಿ ಜಿಲ್ಲೆ ಘೋಡಿಗೇರಿ ಗ್ರಾಮದ ಬಸವಣ್ಣೆಪ್ಪ ಕಂಬಾರ ಹಾಗೂ ಚೆನ್ನಮ್ಮ ದಂಪತಿಯ "
                    + "ಪುತ್ರನಾಗಿ ಜನಿಸಿದರು,ಬೆಳಗಾವಿ ಲಿಂಗರಾಜ ಕಾಲೇಜಿನಲ್ಲಿ ಬಿಎ, "
                    + "೧೯೬೨ರಲ್ಲಿ ಕರ್ನಾಟಕ ವಿವಿಯಿಂದ ಎಂ.ಎ ಪದವಿ,ಪಿ.ಎಚ್.ಡಿ.ಪದವಿ ಪಡೆದಿರುವ ಅವರು, "
                    + "ಬೆಂಗಳೂರು ವಿವಿ ಅಧ್ಯಪಕರು, ಕರ್ನಾಟಕ ಜಾನಪದ ಅಕಾಡೆಮಿಯ ಅಧ್ಯಕ್ಷ, "
                    + "ನವದೆಹಲಿಯ ರಾಷ್ಟ್ರೀಯ ನಾಟಕ ಶಾಲೆಯ ನಿರ್ದೇಶಕ,ಹಂಪಿ ಕನ್ನಡ ವಿವಿಯ "
                    + "ಮೊದಲ ಕುಲಪತಿಯಾಗಿ ಡಾ. ಚಂದ್ರಶೇಖರ ಕಂಬಾರ ಕಾರ್ಯನಿರ್ವಹಿಸಿದ್ದಾರೆ." };

    /**
     * Our data, part 4.
     */
    private boolean[] mExpanded = { false, false, false, false, false, false, false, false, false };
}

private class OnItemClickListener implements OnClickListener {
    private int mPosition;

    OnItemClickListener(int position) {
        mPosition = position;
    }

    public void onClick(View arg0) {
        ((MemoListAdapter2) getListAdapter()).toggle(mPosition);
    }
}

private class OnEditMemoClickListener implements OnClickListener {
    private int mPosition;

    OnEditMemoClickListener(int position) {
        mPosition = position;
    }

    public void onClick(View arg0) {
        Toast.makeText(getBaseContext(), "Edit item " + (mPosition + 1), Toast.LENGTH_SHORT).show();

        Cursor cursor = memoDbAdapter.fetchAllMemos();
        cursor.moveToPosition(mPosition + 1);
        String message = cursor.getString(1);
        String date = cursor.getString(2);
        String time = cursor.getString(3);
        cursor.close();

        Intent intent = new Intent(MemoActivity.this, TextEditorActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("message", message);
        bundle.putString("date", date);
        bundle.putString("time", time);
        intent.putExtras(bundle);
        startActivityForResult(intent, 110);
    }
}


@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
    //MemoListAdapter = new ListAdapter<String>(this, android.R.layout.simple_list_item_1, fillData());
    getListView(); 

}

@Override
protected void onStart() {
    // TODO Auto-generated method stub
    super.onStart();
}

private class OnDeleteMemoClickListener implements OnClickListener {
    private int mPosition;

    OnDeleteMemoClickListener(int position) {
        mPosition = position;
    }

    public void onClick(View arg0) {
        Toast.makeText(getBaseContext(), "Delete item " + (mPosition + 1), Toast.LENGTH_SHORT).show();
        // mContext.getContentResolver().delete( DATABASE_TABLE, KEY_ROWID + "=" + rowId, null);
        memoDbAdapter.deleteMemo(mPosition + 1);
        Intent intent = new Intent(MemoActivity.this, MemoActivity.class);
        startActivity(intent);
    }
}

private class MemoView extends LinearLayout {
    ImageButton editButton;
    ImageButton deleteButton;
    private TextView createdDate;
    private TextView createdTime;
    private TextView content;

    public MemoView(Context context, LayoutInflater inflater, String _createdDate, String _createdTime,
            String _content, boolean expanded) {
        super(context);
        View inflatedView = inflater.inflate(R.layout.memo_entry, null);

        editButton = (ImageButton) inflatedView.findViewById(R.id.editIcon);
        deleteButton = (ImageButton) inflatedView.findViewById(R.id.deleteIcon);

        createdDate = (TextView) inflatedView.findViewById(R.id.createdDate);
        createdDate.setText(_createdDate);

        createdTime = (TextView) inflatedView.findViewById(R.id.createdTime);
        createdTime.setText(_createdTime);

        content = (TextView) inflatedView.findViewById(R.id.content);
        content.setTypeface(kannadaFont);
        content.setText(_content);
        content.setSingleLine(expanded ? false : true);

        addView(inflatedView, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT));
    }

    public void setCreatedDate(String _createdDate) {
        createdDate.setText(_createdDate);
    }

    public void setCreatedTime(String _createdTime) {
        createdTime.setText(_createdTime);
    }

    public void setContent(String _content) {
        content.setText(_content);
    }

    public void setExpanded(boolean expanded) {
        content.setSingleLine(expanded ? false : true);
    }
}
}

This is my TextEditorActivity.java:

  public class TextEditorActivity extends Activity implements OnClickListener{

private EditText indicTextEditor;
private Button buttonSave;
private Button buttonCancel;
Typeface kannadaFont;

private static final String EDITOR_CONTENT = "Current contents of text editor";
//private ArrayList<String> arrayList;
MemoDbAdapter memoAdapter=null;
String date;
String time;




@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.text_editor);



     indicTextEditor = (EditText) findViewById(R.id.textEditor);
    // arrayList=new ArrayList<String>();


    if (savedInstanceState != null) {
        String previousEditorContent = savedInstanceState.getString(EDITOR_CONTENT);
        if (previousEditorContent != null) {
            indicTextEditor.setText(previousEditorContent);
        }
    } else {
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            String msg = bundle.getString("message");
            String date = bundle.getString("date");
            String time = bundle.getString("time");
            if (msg != null) {

                indicTextEditor.setText(msg);
                kannadaFont = Typeface.createFromAsset(getAssets(), "fonts/Lohit-Kannada.ttf");
            }
        }
    }

    buttonSave = (Button) findViewById(R.id.buttonSave);

    buttonSave.setOnClickListener(this);
    buttonSave.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

        }
    });


    buttonCancel = (Button) findViewById(R.id.buttonCancel);
    buttonCancel.setOnClickListener(this);


}

@Override
protected void onSaveInstanceState(Bundle outState) {
    // Save the editor text, so we still have it if the activity needs to be killed while paused.
    outState.putString(EDITOR_CONTENT, indicTextEditor.getText().toString());
    super.onSaveInstanceState(outState);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuItem mnu1 = menu.add(0, 0, 0, "Color");
    MenuItem mnu2 = menu.add(0, 0, 0, "Delete");
    mnu1.setIcon(R.drawable.fonts);
    mnu2.setIcon(R.drawable.delete);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Toast.makeText(getBaseContext(), item.getTitle() + " menu selected", Toast.LENGTH_SHORT).show();

    return true;
}

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    default:
        return null;
    }
}


public void onClick(View v) {
    // TODO Auto-generated method stub
    if(v.getId()==R.id.buttonSave){
        String enteredText=null;
        enteredText=indicTextEditor.getText().toString();
        date=DateFormat.getDateFormatOrder(getBaseContext()).toString();
        time=DateFormat.getTimeFormat(getBaseContext()).toString();

        memoAdapter.open();
        long id=memoAdapter.createMemo(enteredText, date, time);
        memoAdapter.updateMemo(id, enteredText, date, time);
        memoAdapter.close();
        finish();
    }
    else if(v.getId()==R.id.buttonCancel){
        finish();
    }


}

}

This is my MemoDbAdapter.java:

public class MemoDbAdapter {

    private static final String TAG = "MemoDataHandler";

    private static final String DATABASE_NAME = "indicAppMemo.db";
    private static final int DATABASE_VERSION = 1;
    private static final String DATABASE_TABLE = "memo";

    public static final String KEY_ROWID = "_id";
    public static final String KEY_NOTE = "note";
    public static final String KEY_CREATED_DATE = "created_date";
    public static final String KEY_CREATED_TIME = "created_time";

    /**
     * This class helps open, create, and upgrade the database file.
     */
    private static class DatabaseHelper extends SQLiteOpenHelper {

        DatabaseHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY,"
                    + KEY_NOTE + " TEXT," + KEY_CREATED_DATE + " TEXT," + KEY_CREATED_TIME + " TEXT"
                    + ");");
            for (int i = 0; i < mDates.length; i++) {
                ContentValues initialValues = createContentValues(mContents[i], mDates[i], mTimes[i]);
                db.insert(DATABASE_TABLE, null, initialValues);
            }
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion
                    + ", which will destroy all old data");
            db.execSQL("DROP TABLE IF EXISTS" + DATABASE_TABLE);
            onCreate(db);
        }

        /**
         * Our data, part 1.
         */
        private String[] mDates = { "22/05/1961", "22/05/1967", "22/05/1973", "22/05/1977", "22/05/1983",
                "22/05/1990", "22/05/1994", "22/05/1998", "22/05/2010" };

        /**
         * Our data, part 2.
         */
        private String[] mTimes = { "1:31 PM", "9:53 AM", "11:02 AM", "10:20PM", "2:46 PM", "10:34 PM",
                "10:26 AM", "2:31 PM", "8:51 PM" };

        /**
         * Our data, part 3.
         */
        private String[] mContents = {
                "ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ಭಾರತದ ಸಾಹಿತಿಗಳಿಗೆ ಸಲ್ಲುವ ಅತ್ಯಂತ ಪ್ರತಿಷ್ಟಿತ ಪ್ರಶಸ್ತಿ. "
                        + "ಈ ಪ್ರಶಸ್ತಿಯು ಭಾರತದ ಸಂವಿಧಾನದ ಎಂಟನೆ ಅನುಛ್ಛೇದದಲ್ಲಿ ಉಲ್ಲೇಖವಾಗಿರುವ "
                        + "ಭಾಷೆಗಳಲ್ಲಿ ಅತ್ಯುತ್ತಮ ಸಾಹಿತ್ಯ ಕೃತಿಯನ್ನು ರಚಿಸಿದ ಭಾರತೀಯ ನಾಗರಿಕನಿಗೆ ಲಭಿಸುವುದು. "
                        + "ಈ ಪ್ರಶಸ್ತಿಯನ್ನು ಮೇ ೨೨ ೧೯೬೧ ರಲ್ಲಿ ಸ್ಥಾಪಿಸಲಾಯಿತು. ಈ ಪ್ರಶಸ್ತಿಯನ್ನು ಪ್ರಪ್ರಥಮವಾಗಿ "
                        + "೧೯೬೫ ರಲ್ಲಿ ಮಲೆಯಾಳಂ ಲೇಖಕ ಜಿ. ಶಂಕರ ಕುರುಪರಿಗೆ ಪ್ರದಾನ ಮಾಡಲಾಯಿತು. "
                        + "ವಿಜೇತರಿಗೆ ಪ್ರಶಸ್ತಿ ಫಲಕ, ಐದು ಲಕ್ಷ ರುಪಾಯಿ ನಗದು ಹಾಗು ವಾಗ್ದೇವಿಯ ಕಂಚಿನ "
                        + "ವಿಗ್ರಹವನ್ನು ನೀಡಿ ಗೌರವಿಸಲಾಗುವುದು.",

                "ಕುವೆಂಪು - ಕುಪ್ಪಳ್ಳಿ ವೆಂಕಟಪ್ಪ ಪುಟ್ಟಪ್ಪ (೧೯೦೪ - ೧೯೯೪) - "
                        + "ಕನ್ನಡವು ಪಡೆದ ಅತ್ಯುತ್ತಮ ಕವಿ, 'ರಾಷ್ಟ್ರಕವಿ'. "
                        + "ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯನ್ನು ಪಡೆದ ಕನ್ನಡದ ಪ್ರಥಮ ವ್ಯಕ್ತಿ. "
                        + "'ವಿಶ್ವ ಮಾನವ'. ಕನ್ನಡ ಸಾಹಿತ್ಯಕ್ಕೆ ಇವರ ಕಾಣಿಕೆ ಅಪಾರ.",

                "'ದ.ರಾ.ಬೇಂದ್ರೆ - ಕುಣಿಯೋಣು ಬಾರಾ ಕುಣಿಯೋಣು ಬಾ', " + "'ಇಳಿದು ಬಾ ತಾಯಿ ಇಳಿದು ಬಾ', "
                        + "'ನಾನು ಬಡವಿ ಆತ ಬಡವ ಒಲವೆ ನಮ್ಮ ಬದುಕು', "
                        + "ಎಂದು ಆರಂಭವಾಗುವ ಕವಿತೆಗಳನ್ನು ಕೇಳದ ಕನ್ನಡಿಗನಿಲ್ಲ. " + "ಉತ್ಸಾಹದ ಚಿಲುಮೆಯನ್ನುಕ್ಕಿಸಬಲ್ಲ, "
                        + "ನೊಂದ ಜೀವಕ್ಕೆ ಸಾಂತ್ವನ ನೀಡಬಲ್ಲ, "
                        + "ಪ್ರೀತಿ ಪ್ರೇಮಗಳನ್ನು ಮೂಡಿಸಬಲ್ಲ ಕವಿತೆಗಳನ್ನು ರಚಿಸಿಕೊಟ್ಟ ವರಕವಿ ಬೇಂದ್ರೆ. "
                        + "ರಸವೆ ಜನನ, ವಿರಸವೆ ಮರಣ, ಸಮರಸವೆ ಜೀವನ ಎಂದು ಜೀವನವನ್ನು "
                        + "ಕುರಿತು ಪರಿಣಾಮಕಾರಿಯಾಗಿ ಹೇಳಿದ ಧೀಮಂತ ಕವಿ.",

                "ಶಿವರಾಮ ಕಾರಂತ - ಜ್ಞಾನಪೀಠ ಪುರಸ್ಕೃತ ಡಾ. ಶಿವರಾಮ ಕಾರಂತರು ಹುಟ್ಟಿದ್ದು "
                        + "ಉಡುಪಿ ಜಿಲ್ಲೆಯ ಕೋಟದಲ್ಲಿ ೧೯೦೨, ಅಕ್ಟೋಬರ್ ೧೦ರಂದು. "
                        + "ಒಂದು ಶತಮಾನಕ್ಕೆ ನಾಲ್ಕು ವರ್ಷಗಳಷ್ಟೇ ಕಮ್ಮಿ ಬಾಳಿ, "
                        + "ಅರ್ಥಪೂರ್ಣ ಬದುಕು ಕಳೆದ ಸಾಹಿತ್ಯ ದಿಗ್ಗಜ ಡಾ. "
                        + "ಶಿವರಾಮ ಕಾರಂತರು ೧೯೯೭, ಡಿಸೆಂಬರ್ ೦೯ ರಂದು ನಿಧನ ಹೊಂದಿದರು. "
                        + "ತಮ್ಮ ಜೀವಿತಾವಧಿಯಲ್ಲಿ ಸುಮಾರು ೪೨೭ ಪುಸ್ತಕಗಳನ್ನು ರಚಿಸಿದರು. "
                        + "ಅವುಗಳಲ್ಲಿ ಕಾದಂಬರಿಗಳು ೪೭. ತಮ್ಮ ೯೬ನೆಯ ವಯಸ್ಸಿನಲ್ಲೂ ಹಕ್ಕಿಗಳ "
                        + "ಕುರಿತು ಒಂದು ಪುಸ್ತಕವನ್ನು ಬರೆದಿದ್ದು, ಇದು ವಿಶ್ವ ದಾಖಲೆಗೆ "
                        + "ಅರ್ಹವಾಗಿರುವ ಒಂದು ಸಾಧನೆ ಎನ್ನಬಹುದು.",

                "ಮಾಸ್ತಿ ವೆಂಕಟೇಶ ಅಯ್ಯಂಗಾರರು (ಜೂನ್ ೬ ೧೮೯೧ - ಜೂನ್ ೬ ೧೯೮೬) "
                        + "- ಕನ್ನಡದ ಒಬ್ಬ ಅಪ್ರತಿಮ ಲೇಖಕರು. ಕನ್ನಡ ಸಾಹಿತ್ಯ ಲೋಕದಲ್ಲಿ ಮಾಸ್ತಿ "
                        + "ಎಂದೇ ಖ್ಯಾತರಾಗಿರುವ ಈ ಸಾಹಿತಿ ಶ್ರೀನಿವಾಸ ಎಂಬ ಕಾವ್ಯನಾಮದಡಿಯಲ್ಲಿ ಬರೆಯುತ್ತಿದರು. "
                        + "೧೯೮೩ ರಲ್ಲಿ ಚಿಕವೀರ ರಾಜೇಂದ್ರ ಕಾದಂಬರಿಗಾಗಿ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯಿಂದ "
                        + "ಪುರಸ್ಕೃತಗೊಂಡ ಮಾಸ್ತಿಯವರು ಕನ್ನಡಕ್ಕೆ ನಾಲ್ಕನೆ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯನ್ನು ತಂದು ಕೊಟ್ಟರು. "
                        + "ಜೀವನ ಪರ್ಯಂತ ಕನ್ನಡ ಸೇವೆಯನ್ನು ಮಾಡಿದ ಮಾಸ್ತಿಯವರು ಜೂನ್ ೬ ೧೯೮೬ ರಂದು ನಿಧನ ಹೊಂದಿದರು.",

                "ವಿನಾಯಕ ಕೃಷ್ಣ ಗೋಕಾಕ - ಕನ್ನಡಕ್ಕೆ ಐದನೆಯ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿಯನ್ನು ೧೯೯೧ರಲ್ಲಿ ತಂದುಕೊಟ್ಟ "
                        + "ವಿನಾಯಕ ಕೃಷ್ಣ ಗೋಕಾಕರು ಹಲವು ರೀತಿಯಲ್ಲಿ ಅದೃಷ್ಠವಂತರು. "
                        + "ಅವರು ಕನ್ನಡದ ಪ್ರತಿಭಾವಂತ ಕವಿ, ಪಂಡಿತರಾಗಿದ್ದರು. "
                        + "ಕನ್ನಡ-ಇಂಗ್ಲೀಷ್ ಭಾಷೆಗಳಲ್ಲಿ ಸಮಾನ ಪ್ರಭುತ್ವ ಪಡೆದಿದ್ದ ಅವರು "
                        + "ತಮ್ಮ ಜೀವಿತ ಕಾಲದಲ್ಲೇ ಒಬ್ಬ ಪ್ರತಿಭಾವಂತ ಸಾಹಿತಿಗೆ ದೊರಕಬೇಕಾದ "
                        + "ಎಲ್ಲ ಸಿದ್ಧಿ, ಪ್ರಸಿದ್ಧಿಗಳನ್ನು ಪಡೆದರು. "
                        + "ಗೋಕಾಕರು ಇದಕ್ಕೂ ಮೊದಲು ಭಾರತೀಯ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ಆಯ್ಕೆ ಸಮಿತಿಯ ಅಧ್ಯಕ್ಷರಾಗಿದ್ದರು.",

                "ಯು.ಆರ್.ಅನಂತಮೂರ್ತಿ - ಕನ್ನಡಕ್ಕೆ ಆರನೆಯ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ೧೯೯೪ರಲ್ಲಿ ಬಂದಾಗ ಕನ್ನಡ ಸಾಹಿತ್ಯ "
                        + "ಲೋಕ ಮತ್ತೊಮ್ಮೆ ಇಡೀ ದೇಶದ ಗಮನ ಸೆಳೆಯಿತು. "
                        + "ಈ ಗೌರವ ಪಡೆದವರು ಡಾ| ಉಡುಪಿ ರಾಜಗೋಪಾಲಾಚಾರ್ಯ ಅನಂತಮೂರ್ತಿ. "
                        + "ತಮ್ಮ ಬಹುಚರ್ಚಿತ ಸಂಸ್ಕಾರ ಕಾದಂಬರಿಯಿಂದ ಭಾರತೀಯ ಸಾಹಿತ್ಯ "
                        + "ಮತ್ತು ಚಲನಚಿತ್ರ ರಂಗಗಳಲ್ಲಿ ಒಂದು ದೊಡ್ಡ ವಿವಾದವನ್ನೇ ಮಾಡಿದ ಅನಂತಮೂರ್ತಿ "
                        + "ಅವರು ಹುಟ್ಟಿದ್ದು ಶಿವಮೊಗ್ಗ ಜಿಲ್ಲೆಯ ತೀರ್ಥಹಳ್ಳಿ ತಾಲ್ಲೂಕಿನ ಮೇಳಿಗೆ ಹಳ್ಳಿಯಲ್ಲಿ. "
                        + "ಇಬ್ಬರು ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ವಿಜೇತ (ಕುವೆಂಪು ಮತ್ತು ಅನಂತಮೂರ್ತಿ) ರನ್ನು "
                        + "ನೀಡಿದ ಹೆಗ್ಗಳಿಕೆ ತೀರ್ಥಹಳ್ಳಿ ತಾಲ್ಲೂಕಿನದು. " + "ಇವರು ಹುಟ್ಟಿದ್ದು ೧೯೩೨ರ ಡಿಸೆಂಬರ್ ೨೧ರಂದು. "
                        + "ತಂದೆ ಉಡುಪಿ ರಾಜಗೋಪಾಲಾಚಾರ್ಯ. ತಾಯಿ ಸತ್ಯಮ್ಮ (ಸತ್ಯಭಾಮ).",

                "ಗಿರೀಶ್ ರಘುನಾಥ್ ಕಾರ್ನಾಡ್ (ಹುಟ್ಟು - ಮೇ ೧೯, ೧೯೩೮) "
                        + "ಕನ್ನಡಕ್ಕೆ ಏಳನೇ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ತಂದುಕೊಟ್ಟ ಕನ್ನಡ "
                        + "ಸಾಹಿತ್ಯದ ನಾಟಕ ಕ್ಷೇತ್ರಕ್ಕೆ ಸಾಹಿತಿ. "
                        + "ಭಾರತದಲ್ಲೇ ನಾಟಕ ಸಾಹಿತ್ಯ ರಚನೆಗೆ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ " + "ಪಡೆದವರಲ್ಲಿ ಕಾರ್ನಾಡ್ ಮೊದಲಿಗರು. "
                        + "ಮತ್ತು ಇಬ್ಬರು ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ ಪುರಸ್ಕೃತರ "
                        + "ಕಾದಂಬರಿಗಳನ್ನು ಸಿನಿಮಾ ಮಾಡಿದ ಏಕೈಕ ಜ್ಞಾನಪೀಠ ಪ್ರಶಸ್ತಿ "
                        + "ಪುರಸ್ಕೃತರೆಂಬ ಗೌರವಕ್ಕೆ ಕಾರ್ನಾಡ್ ಪಾತ್ರರಾಗಿದ್ದಾರೆ.",

                "ಡಾ. ಚಂದ್ರಶೇಖರ ಕಂಬಾರ (ಜನನ- ೨ ಜನವರಿ ೧೯೩೭)ರಂದು "
                        + "ಬೆಳಗಾವಿ ಜಿಲ್ಲೆ ಘೋಡಿಗೇರಿ ಗ್ರಾಮದ ಬಸವಣ್ಣೆಪ್ಪ ಕಂಬಾರ ಹಾಗೂ ಚೆನ್ನಮ್ಮ ದಂಪತಿಯ "
                        + "ಪುತ್ರನಾಗಿ ಜನಿಸಿದರು,ಬೆಳಗಾವಿ ಲಿಂಗರಾಜ ಕಾಲೇಜಿನಲ್ಲಿ ಬಿಎ, "
                        + "೧೯೬೨ರಲ್ಲಿ ಕರ್ನಾಟಕ ವಿವಿಯಿಂದ ಎಂ.ಎ ಪದವಿ,ಪಿ.ಎಚ್.ಡಿ.ಪದವಿ ಪಡೆದಿರುವ ಅವರು, "
                        + "ಬೆಂಗಳೂರು ವಿವಿ ಅಧ್ಯಪಕರು, ಕರ್ನಾಟಕ ಜಾನಪದ ಅಕಾಡೆಮಿಯ ಅಧ್ಯಕ್ಷ, "
                        + "ನವದೆಹಲಿಯ ರಾಷ್ಟ್ರೀಯ ನಾಟಕ ಶಾಲೆಯ ನಿರ್ದೇಶಕ,ಹಂಪಿ ಕನ್ನಡ ವಿವಿಯ "
                        + "ಮೊದಲ ಕುಲಪತಿಯಾಗಿ ಡಾ. ಚಂದ್ರಶೇಖರ ಕಂಬಾರ ಕಾರ್ಯನಿರ್ವಹಿಸಿದ್ದಾರೆ." };

        /**
         * Our data, part 4.
         */
        private boolean[] mExpanded = { false, false, false, false, false, false, false, false, false };
    }

    private Context context;
    private SQLiteDatabase database;
    private DatabaseHelper dbHelper;

    public MemoDbAdapter(Context context) {
        this.context = context;
    }

    public MemoDbAdapter open() throws SQLException {
        dbHelper = new DatabaseHelper(context);
        database = dbHelper.getWritableDatabase();
        return this;
    }

    public void close() {
        dbHelper.close();
    }

    /**
     * Create a new Memo. If the Memo is successfully created then return the new rowId for that note,
     * otherwise return a -1 to indicate failure.
     */
    public long createMemo(String note, String createdDate, String createdTime) {
        open();
        ContentValues initialValues = createContentValues(note, createdDate, createdTime);

        return database.insert(DATABASE_TABLE, null, initialValues);
    }

    public boolean updateMemo(long rowId, String note, String createdDate, String createdTime) {
        ContentValues updateValues = createContentValues(note, createdDate, createdTime);

        return database.update(DATABASE_TABLE, updateValues, KEY_ROWID + "=" + rowId, null) > 0;
    }

    public boolean deleteMemo(long rowId) {
        return database.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
    }

    /**
     * Return a Cursor over the list of all Memo in the database.
     * 
     * @return Cursor over all notes
     */
    public Cursor fetchAllMemos() {
        return database.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_NOTE, KEY_CREATED_DATE,
                KEY_CREATED_TIME }, null, null, null, null, null);
    }

    /** * Return a Cursor positioned at the defined Memo */
    public Cursor fetchMemo(long rowId) throws SQLException {
        Cursor mCursor = database.query(true, DATABASE_TABLE, new String[] { KEY_ROWID, KEY_NOTE,
                KEY_CREATED_DATE, KEY_CREATED_TIME }, KEY_ROWID + "=" + rowId, null, null, null, null, null);
        if (mCursor != null) {
            mCursor.moveToFirst();
        }
        return mCursor;
    }

    static ContentValues createContentValues(String note, String createdDate, String createdTime) {
        ContentValues values = new ContentValues();
        values.put(KEY_NOTE, note);
        values.put(KEY_CREATED_DATE, createdDate);
        values.put(KEY_CREATED_TIME, createdTime);
        return values;
    }
}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:42:18+00:00Added an answer on June 10, 2026 at 6:42 am

    First of all, is there any reason why you first create your memo and then update it with the same values?
    Overall the code looks ok, I’d review that the values of your note are != null in “createMemo”.
    Ultimately I’d suggest a more proper use in your “updateMemo” method.
    SQLiteDatabase.update has the following structure

    update(String table, ContentValues values, String whereClause, String[] whereArgs)
    

    It’s recommended to pass parameters in whereArgs as follows

    return database.update(DATABASE_TABLE, updateValues, KEY_ROWID + "=?", new String[]{Long.toString(rowId)}) > 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have text file with some stuff that i would like to put into
I have text in a mysql database which is correctly holding the Euro symbol.
I have text in db which looks like this: <p> blah blah blah </p>
I have text links which change colour on hover with CSS and shift left
I have noticed that in Delphi 2009, the text in a multi-line memo has
I have text widgets that can be added on the page. A click should
I have text file with string which code page is 1250. I want to
I am inserting text into a Memo field in a Excel cell via a
i have the below response from server: {result:{js:memo,text:some value,tag:some tag}} in the client side
I have text file which contains lines as mentioned below <property>PASSWORD_X_1</property> <property>PASSWORD_A_2</property> <property>PASSWORD_B_6</property> so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.