I have checked the data that must show are true by means of a toast that prints them, but when wanting to show in the TextView (lessons_count) the original data does not do it, even if I put it to show a Hello. but where I update progress_general if it does.
the value of number is 1.
Code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v;
v = inflater.inflate(R.layout.fragment_principal, container, false);
progreso(v);
return v;
}
public void progreso(View v){
TextView progreso_general = (TextView)v.findViewById(R.id.General_Count);
ProgressBar progreso_general_bar = (ProgressBar)v.findViewById(R.id.General_bar);
int total = totalejercicios+totalteoria;
progreso_general.setText(String.valueOf(c)+" %");
progreso_general_bar.setMax(total);
progreso_general_bar.setProgress(nejercicios+nteoria);
TextView lecciones_count = (TextView)v.findViewById(R.id.lecciones_count);
ProgressBar lecciones_bar = (ProgressBar)v.findViewById(R.id.lecciones_bar);
Toast toast1 = Toast.makeText(getContext(),String.valueOf(nteoria), Toast.LENGTH_SHORT);
toast1.show();
lecciones_count.setText(String.valueOf(nteoria).concat("/").concat(String.valueOf(totalteoria)));
lecciones_bar.setMax(totalteoria);
lecciones_bar.setSecondaryProgress(totalteoria);
lecciones_bar.setProgress(nteoria);
TextView ejercicios_count = (TextView)v.findViewById(R.id.ejercicios_count);
ProgressBar ejercicios_bar = (ProgressBar)v.findViewById(R.id.ejercicios_bar);
lecciones_count.setText(String.valueOf(nejercicios)+"/"+String.valueOf(totalejercicios));
lecciones_bar.setMax(totalejercicios);
lecciones_bar.setSecondaryProgress(totalejercicios);
lecciones_bar.setProgress(nejercicios);
}
XML '
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="50sp"
android:paddingTop="15sp"
android:text="@string/lecciones"
android:textSize="26sp" />
<TextView
android:id="@+id/lecciones_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0/0"
android:textSize="32sp" />
</LinearLayout>'