0

Given below the sample code from AOSP project. How can I added "settings:controller" class in PreferenceCategory. I created a class and got error as AAPT: error: attribute controller (aka com.example.prefscreen:controller) not found. This is the error that I am getting.

AOSP Code:-

   <PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="user_and_account_settings_screen"
    android:title="@string/account_dashboard_title"
    settings:keywords="@string/keywords_accounts">
    <PreferenceCategory
        android:key="passwords_category"
        android:order="10"
        android:persistent="false"
        android:title="@string/autofill_passwords"
    settings:controller="com.android.settings.applications.autofill.PasswordsPreferenceController"
        settings:keywords="@string/autofill_keywords" />
   </PreferenceScreen> ```


**Code that I created**
   

   
```<?xml version="1.0" encoding="utf-8"?>
     <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto">
    <PreferenceCategory android:title="General"/>
    <SwitchPreference
        android:defaultValue="false"
        android:key="remind_me"
        android:title="@string/remind_for_bed_time"
        android:summary="@string/restricated_mode" />
    <Preference
        android:key="hardware_info_device_serial"
        android:title="@string/stream_video"
        android:summary="@string/stream_video"
        android:selectable="false"
        settings:controller="com.example.prefscreen.TestController" />
       </PreferenceScreen>```









 
Robin Baby
  • 11
  • 4

0 Answers0