I'm new here. Let me know if I ask the question in the wrong way or if I need to clarify this.
I am creating an Android application and I use fragments in my code (for example, 4 tabs that can be shifted). I am trying to add a panel to show the percentage of how much the user has used. I thought a progress bar would be the best option, but I can't get it to work.
Here is my code for the fragment I want to add a panel to;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class UserFragment extends Fragment {
private ProgressDialog progress;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_calls, container, false);
progress = new ProgressDialog(this);
return rootView;
}
public void open(View view){
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progress.setIndeterminate(true);
progress.show();
final int totalProgressTime = 100;
final Thread t = new Thread(){
@Override
public void run(){
int jumpTime = 0;
while(jumpTime < totalProgressTime){
try {
sleep(200);
jumpTime += 5;
progress.setProgress(jumpTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
t.start();
}
}
, , , " - undefined". , - , , . - , .