I have a library project that I use to create two applications: public and private for personal use, with several settings that are useless for most people. In this library project, I define PreferenceActivity (for API <Honeycomb) and some PreferenceFragments (for API> = Honeycomb) with preference headers using this guide: http://developer.android.com/guide/topics/ui/settings.html #BackCompatHeaders
To support older devices, I define this XML file as shown in the manual:
<?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <Preference android:title="@string/base_de_donnees" android:summary="@string/summary_pref_restaurer_bdd_sd"> <intent android:targetPackage="com.me.app_lib" android:targetClass="com.me.app_lib.activities.preferences.SettingsActivity" android:action="com.me.app_lib.activities.preferences.SettingsActivity.ACTION_PREF_BDD" /> </Preference> <Preference android:title="@string/saisie" android:summary="@string/summary_pref_saisie"> <intent android:targetPackage="com.me.app_lib" android:targetClass="com.me.app_lib.activities.preferences.SettingsActivity" android:action="com.me.app_lib.activities.preferences.SettingsActivity.ACTION_PREF_SASISIE" /> </Preference> </PreferenceScreen>
Where com.me.app_lib is the library project package that defines the SettingsActivity parameter. However, I get a failure when the intent is called from one of the child projects, because targetPackage does not match that for the child project. If I change com.me.app_lib to com.me.app_public (the package of one of the child projects), it works, but since I have two child projects, this is not an option.
Do I need to copy this file to each of the child projects and change only the targetPackage line, or is there a better option?
source share