I am trying to add listView to a LinearLayout inside the code. But its not working for some reason. I am newbiw to this. can somebody help me out. //activity class ListView listview = new ListView(this); ArrayList myArrayList = new ArrayList<String>(); myArrayList.add(new String("abcd")); ArrayAdapter adapter = new ArrayAdapter<String> (getApplicationContext(),R.layout.list,myArrayList ); listview .setAdapter(adapter); LinearLayout linearLayout = new LinearLayout(this); linearLayout.addView(lv); //this one does not work -- adding other views like EditText works fine.