如何打开三星设置页面?
How to open Samsung's Settings Page?
谁能帮我打开三星 phone 的设置?尝试了以下代码,但它不起作用
代码:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.samsung.android.sm", "com.samsung.android.sm.ui.battery.BatteryActivity"));
try {
MainActivity.this.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this, "Smart manager not installed on this device", Toast.LENGTH_LONG)
.show();
}
}
}
你试过吗?
Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
startActivityForResult(intent, 0);
谁能帮我打开三星 phone 的设置?尝试了以下代码,但它不起作用
代码:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.samsung.android.sm", "com.samsung.android.sm.ui.battery.BatteryActivity"));
try {
MainActivity.this.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this, "Smart manager not installed on this device", Toast.LENGTH_LONG)
.show();
}
}
}
你试过吗?
Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
startActivityForResult(intent, 0);