My problem is this. 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 can not open another activity on the second screen (on the first screen that opens normal) more or less this scheme below (| activity1> button continues | > >> activity2> continue2 | > does not respond | screen3 > > does not open) to praise and test the apk in 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);
}
});}}
Screen 2 code
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 xml butao 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"/>