ListView OnItemClickListener Not working When ListView is inflated to onCreateInputView()
<p>I am developing a Keyboard. When i am inflating a ListView in onCreateInputView() and returning same View(or parent View) to it. I have implemented setOnItemClickListener for the ListView i am not getting callback to it.</p>

<p>What might be the issue?
android framework doesn't work for listview for keyboard(<strong>InputMethodService</strong>) ?</p>

<p>FY Reference i am attaching the code please have look at it.</p>

<p>NOTE: i am able to get ontouchlistner of it.</p>

<p>package com.listkeyboard;</p>

<pre><code>import java.util.ArrayList;

import android.content.Context;
import android.content.res.Configuration;
import android.inputmethodservice.InputMethodService;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

public class ListKeyBoardIME extends InputMethodService {



    private LinearLayout mainLayout;

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        // TODO Auto-generated method stub
        super.onConfigurationChanged(newConfig);
    }

    @Override
    public void onCreate() {
        // TODO Auto-generated method stub
        super.onCreate();
        System.out.println("onCreate");
    }

    @Override
    public View onCreateCandidatesView() {
        // TODO Auto-generated method stub
        System.out.println("onCreateCandidatesView");
        return super.onCreateCandidatesView();
    }

    @Override
    public void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        System.out.println("onDestroy");
    }

    @Override
    public void onFinishInput() {
        // TODO Auto-generated method stub
        super.onFinishInput();
        System.out.println("onFinishInput");
    }

    @Override
    public void onFinishInputView(boolean finishingInput) {
        // TODO Auto-generated method stub
        super.onFinishInputView(finishingInput);
        System.out.println("onFinishInputView");
    }

    @Override
    public View onCreateInputView() {
        // TODO Auto-generated method stub

        System.out.println(" onCreateInputView");
        LayoutInflater layoutInflater = (LayoutInflater) ListKeyBoardIME.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         View mMainKeyboardLayout = layoutInflater.inflate(R.layout.keyboard_list_view, null);

         mainLayout = (LinearLayout)mMainKeyboardLayout.findViewById(R.id.main_layout);

        ListView listView = (ListView)mainLayout.findViewById(R.id.list);



        ArrayList&lt;Character&gt; alphabets = new ArrayList&lt;Character&gt;();
        for (char ch = 'a'; ch  &lt;= 'z'; ch++) {
            alphabets.add(ch);
            if (ch == 'n') {
                break;
            }
        }

        ArrayAdapter&lt;Character&gt; adapter = new ArrayAdapter&lt;Character&gt;(ListKeyBoardIME.this, android.R.layout.simple_list_item_1,alphabets);

        listView.setAdapter(adapter);

        listView.setItemsCanFocus(false);

        listView.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                    long arg3) {
                Toast.makeText(getApplicationContext(), "on itemclicked clicked" , Toast.LENGTH_SHORT).show();

            }

        });

        setInputView(mainLayout);

        return mainLayout;
    }

    @Override
    public void onStartCandidatesView(EditorInfo info, boolean restarting) {
        // TODO Auto-generated method stub
        super.onStartCandidatesView(info, restarting);
        System.out.println("onStartCandidatesView ");
    }

    @Override
    public void onStartInput(EditorInfo attribute, boolean restarting) {
        // TODO Auto-generated method stub
        super.onStartInput(attribute, restarting);
        System.out.println("onStartInput ");
    }

    @Override
    public void onStartInputView(EditorInfo info, boolean restarting) {
        // TODO Auto-generated method stub
        super.onStartInputView(info, restarting);
        System.out.println("onStartInputView");
    }

}
</code></pre>
