dan saya disini hanya menambahkan pada file InputBiodataActivity.java
try {
OutputStreamWriter save = new OutputStreamWriter(openFileOutput("akbar.txt", MODE_PRIVATE));
save.write(outputnama.getText().toString());
save.write(", ");
save.write(outputemail.getText().toString());
save.write(", ");
save.write(outputkgiatan.getText().toString());
save.write(", ");
save.write(outputjk.getText().toString());
save.close();
Toast.makeText(this, "Sukses menyimpan dalam file .txt", Toast.LENGTH_LONG).show();
} catch (Throwable e) {
Toast.makeText(this, "Kesalahan: "+e.toString(), Toast.LENGTH_LONG).show();
}
OutputStreamWriter save = new OutputStreamWriter(openFileOutput("akbar.txt", MODE_PRIVATE));
save.write(outputnama.getText().toString());
save.write(", ");
save.write(outputemail.getText().toString());
save.write(", ");
save.write(outputkgiatan.getText().toString());
save.write(", ");
save.write(outputjk.getText().toString());
save.close();
Toast.makeText(this, "Sukses menyimpan dalam file .txt", Toast.LENGTH_LONG).show();
} catch (Throwable e) {
Toast.makeText(this, "Kesalahan: "+e.toString(), Toast.LENGTH_LONG).show();
}
Untuk melihat filenya yang tadi kita cetak, kita buka "Window - Open Perspective - DDMS". File
tersimpan di "data - data - com.contoh.inputbiodata - files - akbar.txt"
Untuk membukanya kita send file tersebut dengan "Pull a file from the device" ke dalam folder di dalam komputer.
akhirnya data yang kita input di aplikasi android bisa tersimpan dalam
notepad. Sekian posting dari saya, jika ada banyak kekurangan mohon maaf, saya juga masih sama2 belajar disini. Terima Kasih.
Tidak ada komentar:
Posting Komentar