Set Listview height according to Listview Items and Display irregular JSON - OMDB api Sketchware
3
ASD BLOCKS :
CODE 1 :
listdata = (new Gson()).toJson(info.get("Episodes"), new TypeToken<ArrayList<HashMap<String, Object>>>(){}.getType());
listdata = variable to store the nested json
info = map variable which stores the full response
Episodes = the key which contains next json (which we are going to place in listview
CODE 2 :
cou = (listview1.getAdapter().getCount());
the variable "cou" contains the list items number
CODE 3 :
ViewGroup.LayoutParams params = listview1.getLayoutParams();
params.height =(int) (450 * cou);
listview1.setLayoutParams(params);
listview1.requestLayout();
450 = replace it with your cutsom view height
with all of these tutorials (using them on appropriate places )
you can make a movies app..
like one of my video
i showed a OMDB api platform..
which makes these job easier
.