android - onclick event not getting triggered -


this code, can tell me whats problem?

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:background="@color/background_bf"     android:orientation="vertical" >      <scrollview         android:layout_width="fill_parent"         android:layout_height="0dp"         android:layout_margin="10dp"         android:layout_weight="1"         android:orientation="vertical" >          <linearlayout             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:background="@color/white"             android:orientation="vertical" >              <textview                 android:layout_width="fill_parent"                 android:layout_height="40dp"                 android:gravity="center_vertical"                 android:padding="10dp"                 android:text="select languages"                 android:textcolor="#8e8d8d"                 android:textstyle="bold" />              <textview                 android:id="@+id/langdutch"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:drawableleft="@drawable/bg_settings_dutchon_hc_2x"                 android:drawablepadding="10dp"                 android:gravity="center_vertical"                 android:onclick="onlanguageselect"                 android:padding="10dp"                 android:text="dutch"                 android:textcolor="#454c52" />              <textview                 android:id="@+id/langflemish"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:drawableleft="@drawable/bg_settings_dutchact_hc_2x"                 android:drawablepadding="10dp"                 android:gravity="center_vertical"                 android:onclick="onlanguageselect"                 android:padding="10dp"                 android:text="flemish"                 android:textcolor="#454c52" />              <textview                 android:id="@+id/langfrench"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:drawableleft="@drawable/bg_settings_franceon_hc_2x"                 android:drawablepadding="10dp"                 android:gravity="center_vertical"                 android:onclick="onlanguageselect"                 android:padding="10dp"                 android:text="french"                 android:textcolor="#454c52" />         </linearlayout>     </scrollview>      <textview         android:id="@+id/settingscontinue"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:layout_margin="20dp"         android:background="@drawable/button_hc_bf_language_2x"         android:gravity="center"         android:text="continue"         android:textcolor="@color/white"         android:textsize="16sp"         android:textstyle="bold" />  </linearlayout> 

and in activity:

public void onlanguageselect(view v){         log.v("language settings: ", " onlanguageselect clicked.");         int id = v.getid();         string lang;         switch (id) {         case r.id.langdutch:             lang = "nl_nl";             break;         case r.id.langflemish:             lang = "nl_be";             break;         case r.id.langfrench:             lang = "fr";             break;         default:             lang = "nl";             break;         }         changelocale(lang);     }      private void changelocale(string localestring){         locale locale = new locale(localestring);         locale.setdefault(locale);         configuration config = new configuration();         config.locale = locale;         getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics());         log.v("language settings: ", "language changed successfully.");     } 

as raghunandan said, every view have marked clickable onclick handler work.

try textviews:

        <textview             android:id="@+id/langfrench"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:drawableleft="@drawable/bg_settings_franceon_hc_2x"             android:drawablepadding="10dp"             android:gravity="center_vertical"             android:onclick="onlanguageselect"              android:clickable="true"              android:padding="10dp"             android:text="french"             android:textcolor="#454c52" /> 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -