简体   繁体   English

当我尝试从一个按钮打开另一个 window 时出现问题应用程序完全关闭“Android Studio”

[英]Problem when I try to open another window from a button the app closes completely "Android Studio"

i'm a student and i'm working on a mobile app.我是一名学生,正在开发一款移动应用程序。 The probleme is that my app was working, but now when i click on the button to open another window it closes.问题是我的应用程序正在运行,但现在当我单击按钮打开另一个 window 时,它关闭了。 Here is my code: `这是我的代码:`

   public class MainActivity extends AppCompatActivity {
    Button b_inscrire_etudiant;
    Button b_inscrire_enseignant;
    Button b_inscrire_admin;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        b_inscrire_etudiant = findViewById(R.id.b_inscrire_etudiant);
        b_inscrire_enseignant = findViewById(R.id.b_inscrire_enseignat);
        b_inscrire_admin = findViewById(R.id.b_inscrire_admin);

       
        b_inscrire_etudiant.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this , InscriptionEtudiant.class);
                startActivity(i);
            }
        });

        b_inscrire_enseignant.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this , InscriptionEnseignant.class);
                startActivity(i);
            }
        });

        b_inscrire_admin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this , InscriptionAdmin.class);
                startActivity(i);
            }
        });

    }
   }

` `

I worked as usual "using Intent" besides it worked well until now.我像往常一样“使用 Intent”工作,但到目前为止它运行良好。

Here is my Manifest file:这是我的清单文件:

<?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.myusto">

<application
    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.MyUsto"
    tools:targetApi="31">

    <activity
        android:name=".InscriptionEnseignant"
        android:exported="false">
        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>

    <activity
        android:name=".InscriptionEtudiant"
        android:exported="false">
        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>

    <activity
        android:name=".InscriptionAdmin"
        android:exported="false">
        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>

    <activity
        android:name=".Connexion"
        android:exported="false">
        <meta-data
            android:name="android.app.lib_name"
            android:value="" />
    </activity>

    <activity
        android:name=".MainActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

         <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

</application>
</manifest> 

ps: I solved the problem, by the way two were missing ps:我解决了问题,顺便少了两个

Thank you for the answers.谢谢你的回答。 It's true, it was missing a part of the code which was not written in the manifest file是的,它缺少了一部分没有写在清单文件中的代码

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试打开它时,Android 应用程序崩溃了 - Android App crashed when i try to open it 我使用按钮打开 window。 在 window 里面是另一个按钮,它关闭刚刚打开的 window 并启用第一个按钮 - I use a button to open a window . And inside that window is another button which closes the window just opened and enables the first button 我在android studio中打开视频时出现问题 - problem when i open video in android studio 当我按下按钮应用程序时,强制关闭? 安卓系统 - When i press on button app force closes? Android 当我单击按钮打开此活动时,它关闭 - When I click the button to open this activity it closes 当我单击按钮(将订单添加到购物车)时,它可以工作,但是当我尝试打开购物车时,Android Studio出现错误 - When i click on the button (add order to cart) it work but when i try to open the cart, Android Studio gives an error 当我尝试在 Mobile 或 Android Studio 中打开我的应用程序时。 它说无法读取应用程序数据未能启动应用程序 - When I try to open my app in Mobile or Android Studio. It says cannot read app data failed to launch app 每当我单击按钮时,Android 应用程序就会关闭 - Android app closes whenever i click on button 当我尝试在模拟器上打开时,android 应用程序不断停止 - android app keeps stopping when i try to open on emulator 当我尝试测试时,Android Studio应用程序崩溃 - Android Studio app crashes when i try to test it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM