简体   繁体   中英

Android Studio Layout is not Responding

I recently have added a layout and a java file connecting it to my java code file which is taking and giving actual output by implementing an algorithm but the second layout when opened in my phone it does not react to any of the two buttons clicked on it. Seems like an error in AndroidManifest file. here is Manifest file code,

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

    <application
        android:allowBackup="true"
        android:label="@string/app_name2"
        android:icon="@mipmap/jug_black_trasnparent"
        android:roundIcon="@mipmap/jug_black_trasnparent"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".Next"></activity>
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    <activity android:name=".connectorclass">
        <intent-filter>
            <action android:name="android.intent.action.ANSWER"/>
            <category android:name="android.intent.category.Calculator"/>
        </intent-filter>
    </activity>
    </application>
    <uses-sdk android:minSdkVersion="3" />
</manifest>

here connectorclass.java is linked to the Layout not Responding named something xyz..

you can remove

<intent-filter> <action android:name="android.intent.action.ANSWER"/> <category android:name="android.intent.category.Calculator"/> </intent-filter>

in android manifest and can start activity using class name by default like this

Intent intent = new Intent(this, connectorclass.class); startActivity(intent);

try this

只需删除“connectorclass”的意图过滤器。

In AndroidManifest.xml file, you provide two intent files. That doesn't need it. Always try to add one intent-filter on your activity and this activity is your lancer activity. So remove the second intent-filter from connectorclass activity . Then add below code on your button onClickListener

Intent intent = new Intent(MainActivity.class, connectorclass.class);
startActivity(intent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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