I have a grid view in which I need to display radio buttons that allows the user to change the displayed language. When I click on the grid item it has to uncheck the other radio buttons and also change the display text to black for the selected option and to grey for the other ones. I am able to display the options in the grid but the problem is when I'm clicking on the item is not responding (setOnItemClickListener is not firing up). I couldn't figure out where have I done wrong.
This is how the layout that is inflated for each cell looks like:
<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textLanguageName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="10sp"
android:textColor="#000"
android:text="radioButton"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="false"/>
And the grid:
<GridView
android:id="@+id/gridview_setup_language"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numColumns="2"
android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
android:listSelector="#00000000"
android:paddingTop="20sp"
android:layout_below="@+id/textSettingsLanguage" />
And the clicked item:
m_oLanguagesGridview = (GridView) findViewById(R.id.gridview_setup_language);
m_oImageAdapterGridViewLanguages = new GridViewLanguagesAdapter(this,m_sSelectedLanguage);
m_oLanguagesGridview.setAdapter(m_oImageAdapterGridViewLanguages);
m_oLanguagesGridview.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, android.view.View v, int position, long id)
{
LanguagePanel languagePanel = (LanguagePanel)m_oImageAdapterGridViewLanguages.getItem(position);
m_sSelectedLanguage = languagePanel.m_sLanguage;
displaySelectedLanguage(m_sSelectedLanguage);
refreshTranslationsOnSettingPage();
}
});
Is there at least a way to get the position of the clicked item from the GridView?
I'm new in Android programming so please be gentle :)