|I shared a link for a thread that talks about a common problem in Android programming. The function
findViewById() tries to capture the View from the current context or the scope, which is mostly the
Activity. When you try to find the view by the ID of,
keywordlist, runtime will try to find the view inside the current context, most likely,
Activity you are currently inside.
For example, you just inflated the
activity_main layout, but you are having the
ListView defined inside another layout file,
This is one of the problems that you might be facing, because your View is not even inflated — unless your
activity_main tries to inflate this view internally, which I am not sure of as you did not show the code for that activity.
I did not run the code, or analyze it completely, but most likely there are two things that might go wrong here,
Also check if the ID is being used correctly and for the view you are expecting to be there. Debug, debug, debug. Also try to listen on a click listener of the view and find the ID or parents of that to check the hierarchy of the elements.
- The view does not get inflated, or it not found in the context you are trying to look under.
- You are not using the correct ID of the element.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~