I am trying to create a progressBar (not a progressBar dialog ) using only java.
I cannot get it to work, all I get is:

(image that keeps spinning in circles)
Here is my code:
b4 = new Button(this);
t4 = new ProgressBar(this);
b4.setId(4);
b4.setText(SensorData.sensorName[4]);
b4.setTypeface(null, 1);
b4.setTextSize(15);
b4.setGravity(Gravity.LEFT);
b4.setTextColor(R.color.black);
b4.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.icon, 0);
t4.setPadding(20, 10, 10, 10);
t4.setIndeterminate(false);
t4.setProgress(0);
t4.setScrollBarStyle(ProgressBar.SCROLLBARS_OUTSIDE_INSET);
t4.setMax(100);
t4.setVisibility(t4.VISIBLE);
sensorsView.addView(b4, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
sensorsView.addView(t4, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
b4.setOnClickListener(this);
What I want is horizontal progress, but do you know how I can do this? Thank.
source
share