2

有没有办法settings->location & security->Install from SD card从我的应用程序以编程方式打开系统对话框?

4

1 回答 1

0

You launch at least the security setting by the following code.

public class MainActivity extends Activity {

Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    button = (Button) findViewById(R.id.button1);

    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            final Intent intent = new Intent(Intent.ACTION_MAIN, null);
            intent.addCategory(Intent.CATEGORY_LAUNCHER);
            final ComponentName cn = new ComponentName(
                    "com.android.settings",
                    "com.android.settings.SecuritySettings");
            intent.setComponent(cn);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        }
    });
}
于 2013-04-26T16:08:47.400 回答