Hirdetés
Új hozzászólás Aktív témák
-
automATIc
csendes tag
public class MainActivity extends AppCompatActivity {
EditText editText;
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = (EditText) findViewById(R.id.editText);
textView = (TextView) findViewById(R.id.textView);
textView.setVisibility(View.GONE);
}
public void writeMessage(View view){
String Message = editText.getText().toString();
String file_name = "user_data";
try {
FileOutputStream fileOutputStream = openFileOutput(file_name,MODE_PRIVATE);
fileOutputStream.write(Message.getBytes());
fileOutputStream.close();
Toast.makeText(getApplicationContext(),"Message saved",Toast.LENGTH_LONG).show();
editText.setText("");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void readMessage(View view){
try {
String Message;
FileInputStream fileInputStream = openFileInput("user_data");
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
StringBuffer stringBuffer = new StringBuffer();
while ((Message=bufferedReader.readLine())!=null)
{
stringBuffer.append(Message +"\n");
}
textView.setText(stringBuffer.toString());
textView.setVisibility(View.VISIBLE);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void showClick(View view){
if (view.getId() == R.id.showTextButton);
Intent sb = new Intent();
sb.setClass(this, ReadText.class);
startActivity(sb);
}
}Kb. itt tartok most. Azt szeretném, hogy az Activity mutassa a beírt szövegemet.
Egyelőre ezt az "adatbázist" tudtam kiCopyzni ami működik is
[ Módosította: Karma ]
Új hozzászólás Aktív témák
- HONOR Magic8 Lite 5G 512GB + CHOICE Cubuds - Gyári Bontatlan, 2028-ig garanciális
- HONOR Magic8 Pro 5G 12/512GB (Black) - Új, Kártyafüggetlen, 2029-ig garanciális
- HP ProBook 6560b, 15,6" HD+, i5-2520M CPU, 8GB DDR3, 500GB HDD, W10, Számla, garancia ( olvasd végi
- Lenovo Thinkpad L450, 14" HD, i3-5005U CPU, 8GB DDR3, 128GB SSD, W11, Számla, 1 év garancia ( olvas
- HP ProBook 650 G2 15,6" FHD, i5-6200 CPU, 8GB DDR4, 256GB SSD, W11, Számla, 1 év garancia ( olvasd
- Telefon felvásárlás!! iPhone 16/iPhone 16 Plus/iPhone 16 Pro/iPhone 16 Pro Max
- MSI Crosshair 16 i7-14700HX 14. gen 16gb ddr5 + RTX 4060 (140W) + 240Hz QHD+
- ÚJ Razer Kraken V4 Pro gamer fejhallgató
- Dell XPS 13 9300 i7-1065G7 8GB 512GB FHD+ 500nit! 1 év garancia
- Akció!!! Sosemhasznált! HP OmniBook 5 i7-1355U 16GB 512GB 16" FHD+ Gar.: 1 év
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest


