I am having a problem with the removeAllViews() method. as you can see in the pictures, it still has 2 TextViews which are empty, but still creating an empty space in my layout that makes it look bad.
http://jacho981.hol.es/Screenshot_2014-04-22-11-55-12.png
as you can see in the next picture, those TextViews which should be disappearing in the previous picture, are used in this one.
http://jacho981.hol.es/Screenshot_2014-04-22-11-55-19.png
Everytime I press the "Moto" or "Coche" butons, the first method called is removeAllViews() on the LinearLayout that holds the views.
In theory those views are created only if the objects contains something in that string.
In case the removeAllViews is working properly, then I don't understand why it's creating the TextViews, as they are in an IF sentence like this (the removeAllViews() method is called before a sequence of IF sentences like the next one):
// COBER_TITLE
if (listaSeguros
.get(j)
.getSeg_cober_title() != null
|| listaSeguros
.get(j)
.getSeg_cober_title() != "") {
TextView tv_seg_cober_title = new TextView(
getActivity());
tv_seg_cober_title
.setText(listaSeguros
.get(j)
.getSeg_cober_title());
tv_seg_cober_title
.setAllCaps(true);
tv_seg_cober_title
.setTextColor(Color
.parseColor("#275880"));
tv_seg_cober_title
.setTextSize(
TypedValue.COMPLEX_UNIT_SP,
26);
tv_seg_cober_title
.setGravity(Gravity.CENTER_HORIZONTAL);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
new LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
params.setMargins(10,
10, 10, 10);
tv_seg_cober_title
.setLayoutParams(params);
content_frame_seguros
.addView(tv_seg_cober_title);
}
so in case the String variable Seg_cober_title is null or empty, the textView shouldn't be created at all... at least that's what I can't understand.
Thisis really messing up how my app looks. I would appreciate some help from you all!
PS: If you want me to post more CODE I will, I just didn't want to fill this with codelines.
THANKS!!