I am trying to add textview
in a layout programmatically the textview
is added on layout but it's not visible.
I have created a method setSelectedContactTextView()
which is called from onResume()
the method adds textview
but not make them visible on screen.
Here is my code:
protected void onResume() {
if(Constants.fbContactListArrayList!=null && Constants.fbContactListArrayList.size()!=0){
setSelectedContactTextView(Constants.fbContactListArrayList);
}
super.onResume();
}
//SET SELECTED CONTACTS IN TEXTVIEW FORMS
public void setSelectedContactTextView(final ArrayList<Object> list){
//Constants.progressDialog=ProgressDialog.show(this, "", Constants.MSG_PROGESSDIALOG);
new Thread(new Runnable() {
@Override
public void run() {
while(i<list.size()){
ContactBean contactBean=(ContactBean)list.get(i);
if(contactBean.isSelected()==true){
TextView contactTextView=new TextView(NewEventShowDetails.this);
contactTextView.setText(contactBean.getUserName().toString());
fbContactTextLinearLayout.addView(contactTextView);
}
i++;
}
}
});
}
See Question&Answers more detail:os