A
AlexxxBcN
Gamma
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola , estoy usando Android Studio , y en una App , tengo esta parte del menú:
PD: Solucion :
Añadirlo en la activity
android:theme="@Style/Theme.AppCompat.Light"
En esa parte quiero añadir esta parte que tengo en otra App
Probando este code no me da error , pero cuando cliqueo en About , me crashea la app
Aunque no me de error algo habrá ....
Alguna ayuda , o idea , Gracias !!!
Mirando en el Logcat , tengo esto como error:
PD: Solucion :
Añadirlo en la activity
android:theme="@Style/Theme.AppCompat.Light"
Insertar CODE, HTML o PHP:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.image_info) {
updateInfoListActivity();
}
return super.onOptionsItemSelected(item);
}
En esa parte quiero añadir esta parte que tengo en otra App
Insertar CODE, HTML o PHP:
case R.id.About:
Intent abt;
abt = new Intent(MainActivity.this, About.class);
startActivity(abt);
return true;
case R.id.exit:
finish();
return true;
Probando este code no me da error , pero cuando cliqueo en About , me crashea la app
Aunque no me de error algo habrá ....
Insertar CODE, HTML o PHP:
if (id == R.id.About) {
Intent abt = new Intent(MainActivity.this, About.class);
startActivity(abt);
Alguna ayuda , o idea , Gracias !!!
Mirando en el Logcat , tengo esto como error:
Insertar CODE, HTML o PHP:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.miapp.image, PID: 8576
java.lang.RuntimeException: Unable to start activity ComponentInfo{ com.miapp.image/com.miapp.image.About}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:696)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:659)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:552)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.miapp.image.About.onCreate(About.kt:21)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
Última edición:

