Good morning,
It's my first time in this forum, so if there is a protocol and I skipped it, I apologize haha.
My doubt is that when I simulate my app in Android Studio, the images associated with the buttons are not displayed. However, I do not see any errors when compiling, it simply takes me to a blank page when I press the button.
Thanks in advance, greetings.
PS: Here you have the code:
From one of the XML images:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/javi"
android:id="@+id/imageView6" ></ImageView>
</LinearLayout>
From the same image, but Java:
public class javi extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.javi);
}
}
From the Main code: public class MainActivity extends Activity {
//Objetos
private Button boton1, boton2, boton3, boton4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Buscamos los botones en nuestro programa
boton1 = (Button) findViewById (R.id.button);
boton2 = (Button) findViewById (R.id.button2);
boton3 = (Button) findViewById (R.id.button3);
boton4 = (Button) findViewById (R.id.button4);
//Damos uso a los botones
boton1.setOnClickListener(new Button.OnClickListener() {
public void onClick(View view) {
mostrarRafa(null);
}
}
);
boton2.setOnClickListener(new Button.OnClickListener() {
public void onClick(View view) {
mostrarJavi(null);
}
}
);
boton3.setOnClickListener(new Button.OnClickListener() {
public void onClick (View view){
mostrarMario(null);
}
}
);
boton4.setOnClickListener(new Button.OnClickListener() {
public void onClick(View view) {
mostrarJuanmi(null);
}
}
);
}
public void mostrarRafa(View view){
Intent kwh= new Intent(this, rafa. class);
startActivity(kwh);
}
public void mostrarJavi(View view){
Intent kwh= new Intent(this, javi. class);
startActivity(kwh);
}
public void mostrarMario(View view){
Intent kwh= new Intent(this, mario. class);
startActivity(kwh);
}
public void mostrarJuanmi(View view){
Intent kwh= new Intent(this, juanmi. class);
startActivity(kwh);
}
}
Fixed, thank you very much everyone. Greetings