以编程方式打开 Android 设置 [英] Opening Android Settings programmatically

查看:38
本文介绍了以编程方式打开 Android 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式打开设置?

How can I open settings programmatically?

推荐答案

我使用了最受好评的答案中的代码:

startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);

在同一窗口中打开设备设置,从而获得了我的 android 应用程序的用户 (finnmglas/Launcher) for android 卡在那里.

It opens the device settings in the same window, thus got the users of my android application (finnmglas/Launcher) for android stuck in there.

2020 年及以后的答案(在 Kotlin 中):

The answer for 2020 and beyond (in Kotlin):

startActivity(Intent(Settings.ACTION_SETTINGS))

它适用于我的应用程序,也应该适用于您的应用程序而不会产生任何不必要的后果.

It works in my app, should also be working in yours without any unwanted consequences.

这篇关于以编程方式打开 Android 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆