Back to project page Crescendo.
The source code is released under:
GNU General Public License
If you think the Android project Crescendo 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.crescendo.crescendo; //from w w w .j a v a2s .c om import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; import android.media.MediaRecorder; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; //import android.widget.TextView; public class texteditor extends Activity{ public void goabout(View view) { Intent about = new Intent(view.getContext(), aboutactivity.class); this.startActivity(about); } float x, y = 0; //private TextView Txt; private EditText TxtS; String FILENAME; String GENRENAME; public String text; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.texteditor); FILENAME = getIntent().getStringExtra("ProjName"); GENRENAME = getIntent().getStringExtra("ProjGenre"); Log.d("Genre", GENRENAME); // ActionBar actionBar = getActionBar(); UiC(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.textedit, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.rhymes) { Intent change = new Intent(this, RhymeDictionary.class); startActivityForResult(change, 1); } if (item.getItemId() == R.id.savebtn) { try { ObjectOutputStream out=new ObjectOutputStream(openFileOutput(FILENAME, Context.MODE_PRIVATE)); out.flush(); out.writeObject(GENRENAME+";"+TxtS.getText().toString()); out.flush(); out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return super.onContextItemSelected(item); } public void UiC() { TxtS = (EditText) findViewById(R.id.editT); TxtS.setSelection(0); File file = new File(getFilesDir().getAbsolutePath()+File.separator+FILENAME); if (file.exists()) { try { ObjectInputStream in= new ObjectInputStream(openFileInput(FILENAME)); String text= (String)in.readObject(); int n=0; for (int i=0; i<text.length();i++){ if (text.charAt(i)==';'){ n=i; break; } } TxtS.append(text.substring(n+1)); in.close(); }catch (Exception e){ } } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode==1&&resultCode==-1){ TxtS.append(" "+data.getStringExtra("Rhyme")); } } }