Back to project page blogwriter.
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.
package com.example.blogerwriter; //from w ww . java 2s .com import android.os.Bundle; import android.app.Activity; import android.content.SharedPreferences.Editor; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class ItemEditActivity extends Activity implements OnClickListener { private Button mBtnOk; private Button mBtnCanceal; private EditText mEditText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_item_edit); mBtnOk=(Button) findViewById(R.id.button_ok); mBtnCanceal=(Button) findViewById(R.id.button_cancel); mEditText=(EditText) findViewById(R.id.editText); mBtnOk.setOnClickListener(this); mBtnCanceal.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.item_edit, menu); return true; } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.button_ok: saveData(); break; case R.id.button_cancel: finish(); default: break; } } private void saveData(){ String tx=mEditText.getText().toString().trim(); if(tx!=null&&!tx.equals("")){ DBHelper dbHelper=new DBHelper(this); dbHelper.open(); long re=dbHelper.insertData(tx, dbHelper.getTimeStr(System.currentTimeMillis())); }else{ Toast.makeText(this, "please input msg", Toast.LENGTH_SHORT).show(); } } }