VEJA SE ESSE CODIGO TE AJUDA:
import com.example.progressdialog.R; import android.os.Bundle; import android.app.Activity; import android.app.ProgressDialog; import android.view.Menu; import android.view.View; public class MainActivity extends Activity { private ProgressDialog progress; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progress = new ProgressDialog(this); } public void open(View view){ progress.setMessage("Downloading Music :) "); 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) { // TODO Auto-generated catch block e.printStackTrace(); } } } }; t.start(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
Link:http://www.tutorialspoint.com/android/android_progressbar.htm
Em 24 de fevereiro de 2015 21:54, Luciano Pimenta <lucianoalmeidapimenta@gmail.com> escreveu:
Tenho 5 chamadas Volley (por necessidade, sincronização de dados) e gostaria de colocar um ProgressBar para indicar esse processo.--Sei como funciona o ProgressBar, mas estou com dúvidas em como atualizar o percentual e até o título para cada método que terei.Se alguém puder indicar um exemplo, agradeceria.Att
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
------------------------------------------------------------
Levi José de S. S. Dias
Twitter/Skype: levisaturnino
Twitter/Skype: levisaturnino
Formado......: Informática para Internet - IFPE / Técnico em Informática - Leiaut
Cursando.....: Sistemas de Informação - UPE
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
0 comentários:
Postar um comentário