简体   繁体   English

单击Android Daydream服务中的设置按钮以停止应用程序

[英]Clicking on settings button in Android Daydream service stopping the application

Clicking on settings button of daydream application closing my application. 单击白日梦应用程序的设置按钮,关闭我的应用程序。 Please have allok at the Manifest file - 请对清单文件进行分配-

 <application android:label="Bouncing Logo">

    <activity
        android:name="com.example.optionsmenuexample.empty_settings"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.empty_settings" />

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


        <service
        android:name=".BouncerDaydream"
        android:exported="true"
        android:label="Bouncing Logo new">
        <intent-filter>
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.service.dreams.DreamService" />
        </intent-filter>
        <meta-data
            android:name="android.service.dream"
            android:resource="@xml/dream_info" />
    </service>

</application>

Instead, empty_settings.java class should open up. 而是应打开empty_settings.java类。

I have read the solution given here . 我已经阅读了这里给出的解决方案。 But that did not suit my context. 但这不适合我的情况。 Please guide me the right way, if I am going in a wrong way. 如果我走错路,请以正确的方式引导我。 Please tell me where my code gone wrong. 请告诉我我的代码哪里出错了。

This is my logcat - 这是我的日志-

09-26 10:16:46.807: E/AndroidRuntime(2036): FATAL EXCEPTION: main
09-26 10:16:46.807: E/AndroidRuntime(2036): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.app/com.example.app.empty_settings}; have you declared this activity in your AndroidManifest.xml?
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.app.Activity.startActivityForResult(Activity.java:3390)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.app.Activity.startActivityForResult(Activity.java:3351)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.app.Activity.startActivity(Activity.java:3587)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.app.Activity.startActivity(Activity.java:3555)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at com.android.settings.DreamBackend.launchSettings(DreamBackend.java:208)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at com.android.settings.DreamSettings$DreamInfoAdapter$2.onClick(DreamSettings.java:327)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.view.View.performClick(View.java:4240)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.view.View$PerformClick.run(View.java:17721)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.os.Handler.handleCallback(Handler.java:730)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.os.Looper.loop(Looper.java:137)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at android.app.ActivityThread.main(ActivityThread.java:5103)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at java.lang.reflect.Method.invokeNative(Native Method)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at java.lang.reflect.Method.invoke(Method.java:525)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-26 10:16:46.807: E/AndroidRuntime(2036):     at dalvik.system.NativeStart.main(Native Method)
09-26 10:16:46.817: W/ActivityManager(1226):   Force finishing activity com.android.settings/.SubSettings

And this is my Manifest file - 这是我的清单文件-

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.optionsmenuexample"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:targetSdkVersion="17" android:minSdkVersion="17"/>


<application android:label="Bouncing Logo">

    <activity
        android:name="com.example.optionsmenuexample.empty_settings"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.empty_settings" />

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


        <service
        android:name=".BouncerDaydream"
        android:exported="true"
        android:label="Bouncing Logo new">
        <intent-filter>
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.service.dreams.DreamService" />
        </intent-filter>
        <meta-data
            android:name="android.service.dream"
            android:resource="@xml/dream_info" />
    </service>

</application>

This is the dream_info.xml :- 这是dream_info.xml:

<!-- res/xml/dream_info.xml -->
<?xml version="1.0" encoding="utf-8"?>
<dream xmlns:android="http://schemas.android.com/apk/res/android"
    android:settingsActivity="com.example.app/.ExampleDreamSettingsActivity" />

Thanks in advance. 提前致谢。

I got it now. 我知道了 My mistake was, I mistyped the package name in dream_info.xml file. 我的错误是,我在dream_info.xml文件中键入了程序包名称。 Now my app is working fine. 现在我的应用程序运行正常。

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

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