-3
BlackBerry 응용 프로그램이 원격 서버에서 데이터를 가져올 때 진행률 화면을 표시하는 방법은 무엇입니까?BlackBerry 응용 프로그램의 진행률 화면 표시
단추없이 애니메이션 GIF없이 진행 화면을 원합니다. 먼저이 사이트에
BlackBerry 응용 프로그램이 원격 서버에서 데이터를 가져올 때 진행률 화면을 표시하는 방법은 무엇입니까?BlackBerry 응용 프로그램의 진행률 화면 표시
단추없이 애니메이션 GIF없이 진행 화면을 원합니다. 먼저이 사이트에
public class ProgressDialog extends PopupScreen
{
public ProgressDialog(String waitString)
{
super(new VerticalFieldManager());
add(new LabelField(waitString,Field.FIELD_HCENTER));//add a string which u want to show for progressing
}
}
ProgressDialog progress = new ProgressDialog("Please Wait...");
//Add screen to UI
UiApplication.getUiApplication().pushScreen(progress);
//Remove screen from UI
progress.close();
ProgressBar progressBar = new ProgressBar("Waiting for location update....",50,1000);
progressBar.start(); // Start progress bar
progressBar.remove(); //remove progress bar
의 ProgressBar 스레드
public class ProgressBar extends Thread {
Thread thd;
private int maximum, timeout;
private boolean useful = true;
private PopupScreen popup;
private int iterations = 0;
/**
* Object constructor
*
* @param title
* Text to display on popup area
* @param maximum
* Range/width of the gauge field of progress bar
* @param timeout
* Milliseconds to pause between updates to progress bar
* @see GaugeField
* @see Thread
* @see PopupScreen
*/
public ProgressBar(String title, int maximum, int timeout) {
this.maximum = maximum;
this.timeout = timeout;
VerticalFieldManager manager = new VerticalFieldManager();
popup = new PopupScreen(manager);
manager.add(new LabelField(title));
}
/**
* run() method for starting thread
*/
public void run() {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
UiApplication.getUiApplication().pushScreen(popup);
}
});
int iterations = 0;
while (useful) {
System.out.println("I m here in while runn "+ useful);
try {
Thread.sleep(timeout);
} catch (Exception e) {
}
if (++iterations > maximum)
{
iterations = 1;
useful = false;
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
_locationProvider.reset();
Dialog.alert("Location not found.");
}
});
}
// gaugeField.setValue(iterations);
}
if (popup.isDisplayed()) {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
UiApplication.getUiApplication().popScreen(popup);
}
});
}
}
/**
* Method to shutdown the thread and remove the popup screen
*
*/
public synchronized void remove() {
useful = false;
}
}
검색 (확인 또는 취소). – Rupak