Я делаю бинго приложение для работы.Я сделал несколько кнопок для перехода с одного экрана на другой.Все идет по центру, пока я не нажму "botonJugar", который называется "jugar" на экране эмулятора.
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class BingoPalabras extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bingo_palabras);
final Button botonJugar = (Button) findViewById(R.id.botonJugar);
botonJugar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent miIntent = null;
switch(v.getId()){
case R.id.botonJugar:
miIntent = new Intent(BingoPalabras.this,VentanaJugar.class);
break;
}
if(miIntent!=null){
startActivity(miIntent);
}
}
});
}
}
The ventanaJugar XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".VentanaJugar">
<Button
android:id="@+id/botonRegistrar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="@string/registrar_usuario"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.078"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.186" />
AndroidМанифест:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.eneko.bingo_dapas">
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".BingoPalabras">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".VentanaJugar" />
<activity android:name=".VentanaAjustes" />
<activity android:name=".RegistrarUsuario"></activity>
</application>
</manifest>
Кроме того, когда я запускаю приложение, появляется сообщение: В ожидании подключения целевого устройства, экран всегда черный.Logcat ничего не показывает
Спасибо.