Android Open Source - blogwriter Memo Activity






From Project

Back to project page blogwriter.

License

The source code is released under:

GNU General Public License

If you think the Android project blogwriter 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.blogerwriter;
/*from   ww w .  j a  v  a 2s. c  om*/
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class MemoActivity extends Activity {

  private ListView mListView;
  private SimpleCursorAdapter mAdapter;
  private DBHelper mDbHelper;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_memo);
    mListView=(ListView) findViewById(R.id.listview);
    
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.memo, menu);
    return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    if(item.getItemId()==R.id.action_add){
      Intent intent=new Intent();
      intent.setClass(this, ItemEditActivity.class);
      startActivity(intent);
    }else if(item.getItemId()==R.id.action_old){
      Intent intent=new Intent();
      intent.setClass(this, MainActivity.class);
      startActivity(intent);
    }else if(item.getItemId()==R.id.action_old_transfer){
      VersionTransfer versionTransfer=new VersionTransfer(this);
      versionTransfer.versionTransfer();
    }else if(item.getItemId()==R.id.action_export){
      DataExporter exporter=new DataExporter(this);
      exporter.export(Environment.getExternalStorageDirectory().getPath(), "blog_export");
    }
    return super.onOptionsItemSelected(item);
  }

  @Override
  protected void onResume() {
    // TODO Auto-generated method stub
//    DBHelper dbHelper=new DBHelper(this);
    mDbHelper=new DBHelper(this);
    mDbHelper.open();
    Cursor c=mDbHelper.fetchAllData();
    mAdapter=new SimpleCursorAdapter(this,R.layout.list_item,c,new String[]{DBHelper.KEY_DATA,DBHelper.KEY_DATE},new int[]{R.id.item_content,R.id.item_date});
    mListView.setAdapter(mAdapter);
    super.onResume();
  }

  
}




Java Source Code List

com.example.blogerwriter.DBHelper.java
com.example.blogerwriter.DataExporter.java
com.example.blogerwriter.ItemEditActivity.java
com.example.blogerwriter.MainActivity.java
com.example.blogerwriter.MemoActivity.java
com.example.blogerwriter.VersionTransfer.java