shank
shank

Reputation: 159

not able click on list view in fragments

OnClickListner is not working!

I have two text view in each row of my list view which is in Fragmnet. I want to pass the ID of the particular row onClick which is not working.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_news, container, false);
    newsListView = (ListView) view.findViewById(R.id.news_list);
    newsListView.setClickable(true);
    newsList = new ArrayList<>();
    newsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> arg0,View arg1, int position, long arg3) {
            System.out.println(position);

        }
    });
    loadNewsList();
    getActivity().setTitle("News");
    newsListView.setClickable(true);
    return view;
}

i get this in console on click

D/ViewRootImpl@19f3c4b[MusicActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 530252349440}
D/ViewRootImpl@19f3c4b[MusicActivity]: Relayout returned: oldFrame=[0,0][1080,1920] newFrame=[0,0][1080,1920] result=0x1 surface={isValid=true 530252349440} surfaceGenerationChanged=false
D/ViewRootImpl@19f3c4b[MusicActivity]: ViewPostImeInputStage processPointer 0
D/ViewRootImpl@19f3c4b[MusicActivity]: ViewPostImeInputStage processPointer 1

Upvotes: 1

Views: 69

Answers (1)

Nagarjun B N
Nagarjun B N

Reputation: 61

Problem with XML files . Please share those .

Upvotes: 2

Related Questions