I want to display a lodaing screen when user requests some http connections.I got some good samples from stackoverflow and google,But all of them displays the loading screen using a seperate screen.I want to show it in the same screen where user request for http Connection. If any one have idea please share it to me,Thanks in advance.
Asked
Active
Viewed 292 times
2 Answers
1
I usually use a GaugeField in the status section of a MainScreen. Set it using the setStatus(Field field) method.

Richard
- 8,920
- 2
- 18
- 24
0
If your developing for OS v6.0 then RIM has provided the api for progress indication http://docs.blackberry.com/en/developers/deliverables/17971/Indicate_activity_1210002_11.jsp
For below OS v6.0 below code might help u.i.e ProgressAnimationField it is a custom field which takes the bitmap spinner/loader img, its num frames and style.
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;
}
}
}

amsiddh
- 3,513
- 2
- 24
- 27