Issue
I would like to update the content of the TextView from "Loading.." to "Getting ready" after three seconds. Any advice on how to achieve this?
Thats my Loading Dialog.
public class LoadingDialog {
private Activity activity;
private AlertDialog dialog;
LoadingDialog(Activity activity) {
this.activity = activity;
}
void startLoadingDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
LayoutInflater inflater = activity.getLayoutInflater();
builder.setView(inflater.inflate(R.layout.document_request_loading, null));
builder.setCancelable(false);
dialog = builder.create();
dialog.show();
}
void dismissStartLoadingDialog(){
dialog.dismiss();
}
}
Solution
I think this will work for you make timer change in your main thread
public class LoadingDialog {
private Activity activity;
private AlertDialog dialog;
TextView tView;
LoadingDialog(Activity activity) {
this.activity = activity;
}
void startLoadingDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
LayoutInflater inflater = activity.getLayoutInflater();
View view =inflater.inflate(R.layout.document_request_loading, null);
tView=view.findViewById(R.id.tView);
builder.setView(view);
builder.setCancelable(false);
dialog = builder.create();
dialog.show();
}
void changeTextLoading(String string){
if(tView!=null){
tView.setText(string);
}
}
void dismissStartLoadingDialog(){
dialog.dismiss();
}
}
Answered By - Ajay K S
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.