I want to populate items without using a xml layout instead I want to create view at the runtime.This is my getView()
method.
public View getView(final int position, View convertView, ViewGroup parent) {
EditText v ;
if(convertView ==null)
{
v = new EditText(mContext);
convertView = v;
convertView.setTag(R.string.edittext_child, v);
}
else
{
v = (EditText)convertView.getTag(R.string.edittext_child);
}
v.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 80));
v.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.custom_edit));
v.setEms(12);
v.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
v.setPadding(10, 0, 5, 0);
v.setHint(Ids[position]);
return convertView;
}
I am getting this error while returning my view.
java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams