How to open Default Browser settings from my android application?

折月煮酒 提交于 2019-12-13 20:53:19

问题


As per my requirement I have to clear default browser cache from my application. I want to open browser settings from my application, so that user can clear the cache. By using following code.

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

I'm able to open all manage applications. Is there any way to open browser settings directly?

Thanks


回答1:


Settings of an application is stored in Shared Preferances of the application and each application has different directories to store it by default. For your internet browser the settings are stored in "data/data/com.android.browser/shared-prefs/" direcory. There is a XML file named as "com.android.browser_preferences.xml" that has these settings. Access this file by shared prefs and make changes. Code.

String path = "data/data/com.android.browser/shared-prefs/";
String file = "com.android.browser_preferences.xml";
SharedPreferances setting = getSharedPreferances(path+file, MODE_PRIVATE, null);
SharedPreferances.editor edit = setting.edit();


来源:https://stackoverflow.com/questions/11649516/how-to-open-default-browser-settings-from-my-android-application

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