How to open wifi settings on Nook/NookColor

落爺英雄遲暮 提交于 2020-01-13 06:15:09

问题


My app needs active wifi connection. I added button "Go to wifi settings" with this code

Intent settings = new Intent(Settings.ACTION_WIFI_SETTINGS);
settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(settings);

It is works perfect on 95% of devices. But on Nook color I have error

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.WIFI_SETTINGS flg=0x10000000 }

How to open wifi settings on Nook/Nook color?


回答1:


Summary:
1-Find desired activity's complete name in Nook.
2-Set your intent classname with it.
3-Start your intent.
Details:
1-a:Connect your device to PC that you are developing your project.
1-b:Open Hierarchy view perspective of eclipse and then open Windows in that perspective.
1-c:Open your desired Activity manually in device.(home -> setting -> ...)
1-d:It may be need to do refresh on Windows in perspective.
1-e:All existing Activities with their complete name and package name must be seen in Windows in Hierarchy view perspective.


For example,here my desired activity name is:com.android.settings.WirelessSettings and it's package name is com.android.settings.

I hope this snippet code help you to continue:

b1 = (Button) findViewById(R.id.button1);
b1.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        Intent i = new Intent();
        i.setClassName("com.android.settings",
        "com.android.settings.WirelessSettings");
        startActivity(i);
    }
});

For more details on Calling App from another you can see this questions: Q1 - Q2



来源:https://stackoverflow.com/questions/11429090/how-to-open-wifi-settings-on-nook-nookcolor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!