import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class FileSaveReadActivity extends Activity {
private EditText filenameText;
private EditText contentText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
filenameText = (EditText) this.findViewById(R.id.filename);
contentText = (EditText) this.findViewById(R.id.content);
Button saveButton = (Button) this.findViewById(R.id.save);
Button readButton = (Button) this.findViewById(R.id.read);
/*saveButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
String content = contentText.getText().toString();
String filename = filenameText.getText().toString();
String sendResult = "发送成功!";
OutputStream outputStream;
try {
outputStream = FileSaveReadActivity.this.openFileOutput(filename, MODE_APPEND);
FileService.save(outputStream, content);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
sendResult = "发送失败";
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
sendResult = "发送失败";
}
Toast.makeText(FileSaveReadActivity.this, sendResult, Toast.LENGTH_LONG).show();
}
});*/
saveButton.setOnClickListener(onClickListener);
readButton.setOnClickListener(onClickListener);
}
private View.OnClickListener onClickListener = new View.OnClickListener(){