2011-03-12 5 views
0

사용자가 일부 HTTP 연결을 요청할 때 lodaing 화면을 표시하고 싶습니다. stackoverflow 및 google에서 좋은 샘플을 얻었지만 모두 별도의 화면이 필요합니다. 사용자가 http 연결을 요청한 화면과 동일한 화면에 표시하고 싶습니다. 아무도 아이디어가 있다면 나에게 그것을 공유하시기 바랍니다, 미리 감사드립니다.별도의 화면 또는 팝업을 사용하여 UI 화면 자체에로드 표시 없음

답변

1

나는 보통 MainScreen의 상태 섹션에서 GaugeField를 사용합니다. setStatus (Field 필드) 메서드를 사용하여 설정합니다.

0

당신의 코드가 UIE는 비트 맵 회/로더 소요 사용자 정의 필드 ProgressAnimationField 도움이 될 수 아래 다음 RIM은 OS 버전 6.0 이하의 경우 진행 표시 http://docs.blackberry.com/en/developers/deliverables/17971/Indicate_activity_1210002_11.jsp

하기위한 API를 제공하고있다 OS 버전 6.0에 대한 개발하는 경우 img, 그것의 num 프레임과 스타일.

import net.rim.device.api.system.*; 
import net.rim.device.api.ui.*; 

/** 
* Custom class for spinner animation 
*/ 
public class ProgressAnimationField extends Field implements Runnable 
{ 
    private Bitmap _bitmap; 
    private int _numFrames; 
    private int _frameWidth; 
    private int _frameHeight; 

    private int _currentFrame; 
    private int _timerID = -1; 

    private Application _application; 
    private boolean _visible; 

    public ProgressAnimationField(Bitmap bitmap, int numFrames, long style) 
    { 
     super(style | Field.NON_FOCUSABLE); 
     _bitmap = bitmap; 
     _numFrames = numFrames; 
     _frameWidth = _bitmap.getWidth()/_numFrames; 
     _frameHeight = _bitmap.getHeight(); 

     _application = Application.getApplication(); 
    } 

    public void run() 
    { 
     if(_visible) { 
      invalidate(); 
     } 
    } 

    protected void layout(int width, int height) 
    { 
     setExtent(_frameWidth, _frameHeight); 
    } 

    protected void paint(Graphics g) 
    { 
     g.drawBitmap(0, 0, _frameWidth, _frameHeight, _bitmap, _frameWidth * _currentFrame, 0); 
     _currentFrame++; 
     if(_currentFrame >= _numFrames) { 
      _currentFrame = 0; 
     } 
    } 

    protected void onDisplay() 
    { 
     super.onDisplay(); 
     _visible = true; 
     if(_timerID == -1) { 
      _timerID = _application.invokeLater(this, 200, true); 
     } 
    } 

    protected void onUndisplay() 
    { 
     super.onUndisplay(); 
     _visible = false; 
     if(_timerID != -1) { 
      _application.cancelInvokeLater(_timerID); 
      _timerID = -1; 
     } 
    } 
}