Hi,
I've added an activity in settings android manifest file and also created a class for that. When I build an image and install on device I'm able to see that option but when I click on that, the settings app crashes and in logcat getting error as -
Note: I've created an event in MetricsEvent class and in metrics_constants.proto
Process: com.android.settings, PID: 1849
java.lang.RuntimeException: Unable to pause activity {com.android.settings/com.android.settings.Settings}: java.lang.IllegalArgumentException: Must define metric category
Here's my manifest
<activity
android:name="Settings$PowerOptions"
android:label="@string/power_info_title"
android:icon="@drawable/ic_homepage_power"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE_LAUNCH" />
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter>
<intent-filter android:priority="7">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.homepage" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.PowerOptions" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" />
<meta-data android:name="com.android.settings.summary"
android:resource="@string/power_info_description"/>
</activity>
and my class -
public class PowerOptions extends SettingsPreferenceFragment {
private static final String TAG = "PowerSettings";
@Override
public int getMetricsCategory() {
return MetricsEvent.POWER_OPTIONS;
}
@Override
public int getHelpResource() {
return 0;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.device_power_settings);
}
}
--
--
unsubscribe:
[hidden email]
website:
http://groups.google.com/group/android-porting
---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-porting/8a600c90-ecca-4cd0-b367-afaffca20eacn%40googlegroups.com.