Advertisement
StoneHaos

untitled

May 18th, 2021
717
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.myapp;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4.  
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.DatePicker;
  8. import android.widget.EditText;
  9. import android.widget.TextView;
  10. import android.widget.Toast;
  11. import android.view.Gravity;
  12.  
  13. import com.google.android.material.snackbar.Snackbar;
  14.  
  15. public class MainActivity extends AppCompatActivity {
  16.  
  17.     @Override
  18.     protected void onCreate(Bundle savedInstanceState) {
  19.         super.onCreate(savedInstanceState);
  20.         setContentView(R.layout.activity_main);
  21.     }
  22.     public void Ender (View view){
  23.  
  24.         DatePicker datePicker = (DatePicker)findViewById(R.id.datePicker);
  25.         String date = String.format("%d.%d.%d", datePicker.getDayOfMonth(), datePicker.getMonth() + 1, datePicker.getYear());
  26.  
  27.         String name = ((EditText)findViewById(R.id.Name)).getText().toString();
  28.         String surname = ((EditText)findViewById(R.id.Surname)).getText().toString();
  29.         String endname = ((EditText)findViewById(R.id.Endname)).getText().toString();
  30.         String gender = ((EditText)findViewById(R.id.gender)).getText().toString();
  31.         String lvl = ((EditText)findViewById(R.id.lvl)).getText().toString();
  32.         String color = ((EditText)findViewById(R.id.color)).getText().toString();
  33.  
  34.         String message = String.format("Дата: %s\nИмя: %s\nФамилия: %s\nОтчество: %s\nПол: %s\nРост: %s\nЛюбимый цвет: %s", date, name, surname, endname, gender, lvl, color);
  35.  
  36.         Toast.makeText(this, message, Toast.LENGTH_LONG).show();
  37.  
  38.     }
  39. }
Advertisement
RAW Paste Data Copied
Advertisement