0
My problem is the following. my application has a welcome screen where the user ckick the "continue" button and goes to the next screen. The next one contains a menu with several buttons. my problem is that I cannot open another Activity on the second screen (on the first screen that opens normal) more or less this scheme below (| activity1> continue button | >> | activity2> Continue2 button |> does not answer |tela3>> does not open) to praise and test the apk on a Galaxy grand duos 4.2.2
code below Code 1 screen (welcome).
public class Main2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Button button7 = (Button) findViewById(R.id.button7);
button7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setContentView(R.layout.activity_main4);
}
});}}
code screen 2
public class Main4Activity extends AppCompatActivity {
private Button prova;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main4);
prova = (Button) findViewById(R.id.button5);
prova.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent( Main4Activity.this,
Main3Activity.class);
startActivity(intent);
}
});
}}
screen 2 input xml code
<Button
android:id="@+id/button5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/button4"
android:layout_marginTop="11dp"
android:text="tela 2"/>
very good, worked perfectly. thank you!!!
– gabriel