I have a progress bar in my app but it is showing some text default i want to remove the text. please help me how to remove the text.
Here is my code snippet:
Create this class for Android < API Level 11 and use it instead the default ProgressDialog. It uses reflection to set the visbility to GONE:
public class CustomProgressDialog extends ProgressDialog {
public CustomProgressDialog(Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
Method method = TextView.class.getMethod("setVisibility",
Integer.TYPE);
Field[] fields = this.getClass().getSuperclass()
.getDeclaredFields();
for (Field field : fields) {
if (field.getName().equalsIgnoreCase("mProgressNumber")) {
field.setAccessible(true);
TextView textView = (TextView) field.get(this);
method.invoke(textView, View.GONE);
}
if (field.getName().equalsIgnoreCase("mProgressPercent")) {
field.setAccessible(true);
TextView textView = (TextView) field.get(this);
method.invoke(textView, View.GONE);
}
}
} catch (Exception e) {
Log.e(TAG,
"Failed to invoke the progressDialog method 'setVisibility' and set 'mProgressNumber' to GONE.",
e);
}
}
}