0

I'm building custom preferences and I've read these posts:

Android: Creating custom preference

Android Set Custom Preference Layout

In layout Text_description_value_referencePreference I have

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/widget_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
    android:id="@android:id/title"
    style="@android:style/TextAppearance.DeviceDefault.SearchResult.Title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Title" />

<TextView
    android:id="@android:id/summary"
    style="@android:style/TextAppearance.DeviceDefault.SearchResult.Subtitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Summary" />

<TextView
    android:id="@+id/currentvalue"
    style="@android:style/TextAppearance.DeviceDefault.SearchResult.Subtitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Current Value Layout" />
</LinearLayout>

Class:

public class Text_description_value_referencePreference extends EditTextPreference {

String currentvalue;

// // https://stackoverflow.com/questions/28095643/android-set-custom-preference-layout
public Text_description_value_referencePreference(Context context) {
    super(context);
}

public Text_description_value_referencePreference(Context context, AttributeSet attrs) {
    super(context, attrs);
}

// https://stackoverflow.com/questions/16108609/android-creating-custom-preference
@Override
protected View onCreateView( ViewGroup parent)
{
    super.onCreateView(parent);
    LayoutInflater li = (LayoutInflater)getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
    return li.inflate( R.layout.text_description_value_reference, parent, false);
}
}

In preferences:

    <com.julius.ble.Text_description_value_referencePreference
        android:key="test"
        android:title="title"
        android:currentvalue="currentvalue"/>

In preferences.xml Studio gives error:

Error:(19) No resource identifier found for attribute 'currentvalue' in package 'android'

Prerences worked w/out this added custom currentvalue. Cleaning/rebuilding does not help. What am I missing?

Community
  • 1
  • 1
Alex Martian
  • 3,423
  • 7
  • 36
  • 71

1 Answers1

0

Answer is here: error: No resource identifier found for attribute 'adSize' in package 'com.google.example' main.xml

xmlns:app="http://http://schemas.android.com/apk/lib/YourPackageName"

app:currentvalue="Current Value"
Community
  • 1
  • 1
Alex Martian
  • 3,423
  • 7
  • 36
  • 71