Android Open Source - SimpleNoteTakingApp Note Item






From Project

Back to project page SimpleNoteTakingApp.

License

The source code is released under:

MIT License

If you think the Android project SimpleNoteTakingApp 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.example.notetakingapp.data;
/* w  w  w. j  a v a  2 s . c  o  m*/
import android.annotation.SuppressLint;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;


public class NoteItem {
  
  private String key;
  private String text;

  public String getKey() {
    return key;
  }
  public void setKey(String key) {
    this.key = key;
  }
  public String getText() {
    return text;
  }
  public void setText(String text) {
    this.text = text;
  }
  
  @SuppressLint("SimpleDateFormat") 
  public static NoteItem getNew(){
    
    Locale locale = new Locale("en_US");
    Locale.setDefault(locale);
    
    String patten = "yyyy-MM-dd HH:mm:ss Z";
    SimpleDateFormat formatter = new SimpleDateFormat(patten);
    String key = formatter.format(new Date());
    
    NoteItem note = new NoteItem();
    note.setKey(key);
    note.setText("");
    
    return note;
  }
  
  public String toString(){
    return this.getText();
    
  }
  
}




Java Source Code List

com.example.notetakingapp.EditNoteActivity.java
com.example.notetakingapp.MainActivity.java
com.example.notetakingapp.data.NoteItem.java
com.example.notetakingapp.data.NotesDataSource.java