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
- Lenovo Thinkpad P1 Gen 6 - i9-13980HX, 32GB, 2TB SSD, 16" WQUXGA (3840 2400), RTX 4090
- 15.gen! Intel Core Ultra 9 285K +16-32GB DDR5 RAM +hűtött VRM-es Z890 lap! GAR/SZÁMLA (a Te nevedre)
- OP AudioCodes C450HD Ip Phones - Szines kijelzős - Teams/ Zoom telefon - Új dobozos
- ATEN Cat 5 KVM over IP Switch Altusen KH1508AI - Új ára 284.000Ft
- AirPort Extreme 802.11n (3rd Generation) Model A1301 -
- LG 27UL500P-W - 27" IPS - 3840x2160 4K - 60Hz 5ms - HDR10 - AMD FreeSync - 300 Nits - sRGB 99%
- Bontatlan, Sony PS5 PRO Pro 2TB, lemez mentes verzió
- AKCIÓ! LG UltraFine 27" 5K IPS 99% DCI-P3 1 év garancia
- Samsung Galaxy A53 5G 128GB, Kártyafüggetlen, 1 Év Garanciával
- GYÖNYÖRŰ iPhone 14 Pro 128GB Space Black-1 ÉV GARANCIA - Kártyafüggetlen, MS3781
Állásajánlatok
Cég: Laptopszaki Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest



