简体   繁体   English

Android Studio 在没有错误的情况下因新意图崩溃

[英]Android Studio crashing on new intent without error

Sorry if I am wasting anyone's time, but I encountered this odd error when working on my android studio app.对不起,如果我在浪费任何人的时间,但我在我的 android studio 应用程序上工作时遇到了这个奇怪的错误。 I have this code where when I press the button it brings me to an activity called notes, and it all worked fine until I added a save and load method.我有这个代码,当我按下按钮时,它会将我带到一个名为 notes 的活动,并且一切正常,直到我添加了一个保存和加载方法。 The weirdest part is I don't even receive an error in my logcat and it is set to no filters.最奇怪的部分是我什至没有在我的 logcat 中收到错误并且它被设置为没有过滤器。 To all people who think the error is in the Notes file .致所有认为错误出在 Notes 文件中的人。 I added a breakpoint at the beggining of my Notes java file and it didn't run.我在 Notes java 文件的开头添加了一个断点,但它没有运行。 Meaning it didn't get past the intent part.这意味着它没有通过意图部分。

Here is my Button code:这是我的按钮代码:

Button NotesBtn = findViewById(R.id.NotesBtn);

NotesBtn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Intent goToNotes = new Intent(Home.this,Notes.class);
        startActivity(goToNotes);
    }
});

Here is my xml for anyone who wants:这是我给任何想要的人的 xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.quikdrone">

    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/robofaceicon"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/geministudioslogo"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".WordOfTheDay"></activity>


        <service
            android:name=".BackroundService"
            android:enabled="true"
            android:exported="true" />
        <activity android:name=".Notes" />
        <activity android:name=".RollADice" />
        <activity android:name=".SetttingsPage" />
        <activity android:name=".Home" />
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>

</manifest>

The logcat also warned me that I might be doing too many intents and actions in the same thread but I don't know if that relates. logcat 还警告我,我可能在同一个线程中执行了太多意图和操作,但我不知道这是否相关。 If anyone could help me with this, I would be very grateful.如果有人能帮助我解决这个问题,我将不胜感激。

Thanks!谢谢!

 Intent goToNotes = new Intent(Home.this,Notes.class.java);
        startActivity(goToNotes);

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM