MainActivity Use the previous one to get the time and comments
Pass value to SubActivty with Intent intent.putExtra("String Value", comment); intent.putExtra("int Value", quantity);
        intent.putExtra("String Value", comment);
        intent.putExtra("int Value", quantity);
    private void addQuantityInfo() {
        //Variable declaration of quantity
        private int quantity = 0;
        //Get comments
        EditText edittext = (EditText) findViewById(R.id.edit_comment);
        String comment = edittext.getText().toString();
        //Screen transition
        Intent intent = new Intent(getApplication(), DetailScreen.class);
        intent.putExtra("String Value", comment);
        intent.putExtra("int Value", quantity);
        startActivity(intent);
    }
SubActivty Char Sequence = Reading a string CharSequence getstring Reading the string obtained by this
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.detail_screen);
        setTitle("");
        Intent intent = getIntent();
        //Receive value from MainActivity
        CharSequence getstring = intent.getCharSequenceExtra("String Value");
        int getint = intent.getIntExtra("int Value",0);
        //Applying id textView1 to t1
        TextView t1 = (TextView)findViewById(R.id.textView1);
        //Applying id textView1 to t2
        TextView t2 = (TextView)findViewById(R.id.textView2);
        //Show received value
        t1.setText("The received characters are"+getstring);
        t3.setText("The number received is"+String.valueOf(getint));
        Recommended Posts