如何打开三星的设置页面?

huangapple go评论210阅读模式
英文:

How to open Samsung's Settings Page?

问题

以下是您要翻译的内容:

有谁能帮我打开三星手机的设置吗?尝试了以下代码,但不起作用。

代码:

  1. public class MainActivity extends AppCompatActivity {
  2. @Override
  3. protected void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.activity_main);
  6. Intent intent = new Intent();
  7. intent.setComponent(new ComponentName("com.samsung.android.sm", "com.samsung.android.sm.ui.battery.BatteryActivity"));
  8. try {
  9. MainActivity.this.startActivity(intent);
  10. } catch (ActivityNotFoundException ex) {
  11. Toast.makeText(MainActivity.this, "此设备未安装智能管理器", Toast.LENGTH_LONG)
  12. .show();
  13. }
  14. }
  15. }
英文:

Can anyone help me with opening Samsung phone's settings? Tried the following code but it's not working

CODE:

  1. public class MainActivity extends AppCompatActivity {
  2. @Override
  3. protected void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.activity_main);
  6. Intent intent = new Intent();
  7. intent.setComponent(new ComponentName("com.samsung.android.sm", "com.samsung.android.sm.ui.battery.BatteryActivity"));
  8. try {
  9. MainActivity.this.startActivity(intent);
  10. } catch (ActivityNotFoundException ex) {
  11. Toast.makeText(MainActivity.this, "Smart manager not installed on this device", Toast.LENGTH_LONG)
  12. .show();
  13. }
  14. }
  15. }

答案1

得分: 1

你尝试过这个吗?

  1. Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
  2. startActivityForResult(intent, 0);
英文:

Have you tried this?

  1. Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
  2. startActivityForResult(intent, 0);

huangapple
  • 本文由 发表于 2020年4月10日 16:38:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/61136727.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定