-
Notifications
You must be signed in to change notification settings - Fork 0
/
choice.java
60 lines (46 loc) · 1.85 KB
/
choice.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.example.ebbill;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class choice extends AppCompatActivity {
private Button but;
private Context con;
private Button but1;
private Context con1;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_choice);
con=this;
but=findViewById(R.id.reading);
but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(con, reading.class);
startActivity(intent);
}
}
);
con1=this;
but1=findViewById(R.id.amount);
but1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(con1,unit.class);
startActivity(intent);
}
}
);
// Retrieve the value from the Intent
Intent intent = getIntent();
String inputText = intent.getStringExtra("inputText");
// Append a comma after the name
inputText += ",";
// Use the modified value, set it to a TextView
TextView textView = findViewById(R.id.show); // Replace textView with your TextView ID
textView.setText(inputText);
}
}