this is my first time trying to make an android app, or dealing with java, so please be patient with my questions :(
what i'm trying to do is to have screen-1 with a few buttons, when pressed, it will bring the user to screen-2 with another group of buttons. upon pressing a button in screen-2, the user will be brought to a new screen with some text based on which buttons he pressed, and in which order.
same goes with the other buttons in each screen.
what i already have is screen 1 full of buttons, and their ids. I'm not sure where to even begin for the next part. I can create an onClick activity for every button in screen-1, but how will screen-3 remember which buttons were pressed on screen-1 and screen-2?
activity_main.xml
<Button
android:id="@+id/button1"
android:layout_height="wrap_content"
android:layout_width="110dp"
android:layout_weight="1"
android:text="@string/button1"
android:onClick="button1OnClick"/>
<Button
android:id="@+id/button2"
android:layout_height="wrap_content"
android:layout_width="110dp"
android:layout_weight="1"
android:text="@string/button2"
android:onClick="button1OnClick2"/>
MainActivity.java
public class Click extends Activity {
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_main.xml);
final Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// open up screen 2? do i use intent??
}
});
}
}
activity_main2.xml
<Button
android:id="@+id/button1"
android:layout_height="wrap_content"
android:layout_width="110dp"
android:layout_weight="1"
android:text="@string/button1"
android:onClick="button1OnClick"/>
<Button
android:id="@+id/button2"
android:layout_height="wrap_content"
android:layout_width="110dp"
android:layout_weight="1"
android:text="@string/button2"
android:onClick="button1OnClick2"/>
MainActivity2.java
public class Click extends Activity {
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_main2.xml);
final Button button = (Button) findViewById(R.id.button2);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// open up screen 3?
}
});
}
}
screen-1 and screen-2 will share the same set of buttons. screen 3 will show which order, and which buttons were pressed.