xml - how to get Android Custom Preference TextView OnClick? -


i can't custom preference textview action. may know how it.

here preference xml file user_setting.xml,

<preferencecategory android:title="@string/security_settings"         android:key="security">      <preference         android:title="@string/change_pin"         android:summary="@string/change_pin_summary"         android:key="change_pin"         android:layout="@layout/test"/>  </preferencecategory> 

here custom xml layout preference test.xml

<?xml version="1.0" encoding="utf-8"?>  <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"           android:orientation="vertical"           android:layout_width="fill_parent"           android:layout_height="wrap_content"           android:minheight="?android:attr/listpreferreditemheight"           android:gravity="center_vertical"           android:paddingleft="7dp"           >  <textview android:id="@android:id/title"           android:layout_width="fill_parent"           android:layout_height="wrap_content"           android:singleline="true"           android:ellipsize="marquee"           android:fadingedge="horizontal"           android:textsize="19dp"         />  <textview android:id="@android:id/summary"           android:layout_width="wrap_content"           android:layout_height="wrap_content"           android:layout_below="@android:id/title"           android:layout_alignleft="@android:id/title"           android:textappearance="?android:attr/textappearancesmall"           android:maxlines="2"           />  </linearlayout> 

my activity here,

 public class apppreference extends sherlockpreferenceactivity {      private boolean needresource=false;      @suppresswarnings("deprecation")     @override     public void oncreate(bundle savedinstancestate){           super.oncreate(savedinstancestate);          if (needresource || build.version.sdk_int < build.version_codes.honeycomb) {             addpreferencesfromresource(r.xml.user_setting);         }         initialize();      }      private void initialize(){          preference change_pin = findpreference("change_pin");         change_pin.setonpreferencechangelistener(new preference.onpreferencechangelistener() {             @override             public boolean onpreferencechange(preference preference, object newvalue) {                 toast.maketext(getbasecontext(), "pin",                         toast.length_short).show();                /* intent myintent = new intent(apppreference.this, originalpinactivity.class);                 apppreference.this.startactivity(myintent);*/                 return true;             }         });     } 

it's not work when click or touch on preference. please pointing me how it.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -