Android实现记事本功能(26)

  

本文实例为大家分享了Android实现记事本功能的具体代码,供大家参考,具体内容如下
  

  

MainActivity.java代码:

        包siso.smartnotef.activity;      进口android.app.AlertDialog;   进口android.content.DialogInterface;   进口android.content.Intent;   进口android.os.Bundle;   进口android.support.v7.app.AppCompatActivity;   进口android.view.View;   进口android.view.ViewGroup;   进口android.widget.ListAdapter;   进口android.widget.ListView;   进口android.widget.TextView;      进口java.util.ArrayList;   进口并不知道;      进口siso.smartnotef.R;   进口siso.smartnotef.adapter.NotepadeAdapter;   进口siso.smartnotef.db.DataHelper;   进口siso.smartnotef.global.GlobalParams;   进口siso.smartnotef.model.NotepadBean;   进口siso.smartnotef.model.NotepadWithDataBean;   进口siso.smartnotef.service.MainService;      公共类MainActivity AppCompatActivity延伸实现视图。OnClickListener NotepadeAdapter。ClickFunction {      私人TextView tv_add;   私人ListView lv_contents;   私人ListnotepadWithDataBeanList;      @Override   保护空白>   包siso.smartnotef.activity;      进口android.app.DatePickerDialog;   进口android.app.TimePickerDialog;   进口android.os.Bundle;   进口android.support.v7.app.AppCompatActivity;   进口android.view.View;   进口android.widget.DatePicker;   进口android.widget.EditText;   进口android.widget.TextView;   进口android.widget.TimePicker;   进口android.widget.Toast;      进口java.util.Calendar;      进口siso.smartnotef.R;   进口siso.smartnotef.db.DataHelper;   进口siso.smartnotef.global.GlobalParams;   进口siso.smartnotef.model.NotepadBean;   进口siso.smartnotef.model.NotepadWithDataBean;      公共类AddContentActivity AppCompatActivity延伸实现视图。OnClickListener {      私人TextView tv_save;   私人TextView tv_date;   私人TextView tv_time;   私人TextView tv_cancel;   私人EditText et_content;   私人字符串时间=" ";   私人字符串日期=" ";   私人捆包;   私人int类型;      @Override   受保护的空白;   日期+=;   如果(month<9) {   日期=日期+“0”+ (+ 1);   其他}{   日期+=(月+ 1);   }   如果(day<10) {   日期=日期+“0”+天;   其他}{   日期+=天;   }   返回日期;   }   @Override   公共空间>   包siso.smartnotef.activity;      进口android.media.MediaPlayer;   进口android.media.RingtoneManager;   进口android.net.Uri;   进口android.os.Bundle;   进口android.support.v7.app.AppCompatActivity;   进口android.view.View;   进口android.widget.Button;   进口android.widget.TextView;      进口java.io.IOException;      进口siso.smartnotef.R;   进口siso.smartnotef.global.GlobalParams;      公开课RemindActivity延伸AppCompatActivity {      私人TextView tv_content;   私人按钮bt_confirm;   私人媒体播放器mMediaPlayer;;   @Override   保护空白>   & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   & lt; LinearLayout xmlns: android=" http://schemas.android.com/apk/res/android "   xmlns:工具=" http://schemas.android.com/tools "   android: id=癅 + id/activity_main”   android: layout_width=" match_parent "   android: layout_height=" match_parent "   android:取向=按怪薄?   工具:上下文=皊iso.smartnotef.activity.MainActivity”比;      & lt;使用   android: layout_width=" match_parent "   android: layout_height=" 50 dp”   android:背景=" @color/title_color”   android: paddingLeft=" 10 dp”   android: paddingRight=" 10 dp”比;   & lt; TextView   android: layout_width=" wrap_content "   android: layout_height=" wrap_content "   android:输入textColor=" @color/白”   android: textSize=" 18 sp "   android: layout_centerInParent=" true "   android:文本="智能记事本”/比;   & lt; TextView   android: id=癅 + id/tv_add”   android: layout_width=" wrap_content "   android: layout_height=" wrap_content "   android:输入textColor=" @color/白”   android:文本="新增”   android: layout_centerVertical=" true "   android: layout_alignParentRight=" true "   android: textSize=" 13 sp "/比;   & lt;/RelativeLayout>   & lt;列表视图   android: id=癅 + id/lv_content”   android: layout_width=" match_parent "   android: layout_height=" wrap_content "祝辞& lt;/ListView>   & lt;/LinearLayout>      

Android实现记事本功能(26)