I wanted to programatically put a listview into my android application. So, when the user clicks a button, it will setContentView(listview). When the user selects the item, it will setContentView(R.layout.main). However, when I try to refer to layout widgets inside of the orginal layout, R.layout.main, I receive a javaNullPointerException. Can someone help to clarify this issue for me?
I am using an onItemClickListener for user selection.
I don’t think it makes sense what are you trying to do here:
the listview should simply be part of your layout.