0

enter image description here

Above is my screenshot I am getting while displaying the wait screen using ActivityIndicatorView. Any idea why my spinner image is being displayed within a narrow strip?

My code is:

ActivityIndicatorView act = new ActivityIndicatorView(Field.FIELD_HCENTER);
Bitmap spinImage = Bitmap.getBitmapResource("img/spinner.jpg");
act.createActivityImageField(spinImage, 9,Field.FIELD_HCENTER );
LabelField label = new LabelField(message);
DialogFieldManager manager = new DialogFieldManager();
popup = new PopupScreen(manager);
manager.addCustomField(label);
manager.addCustomField(act);

EDIT: Spinner Image
enter image description here
EDIT 2: Full spinner image only when No. of frames = 1 and image = spinner.gif enter image description here

Atif Imran
  • 1,899
  • 2
  • 18
  • 33
  • add the ActivityIndicatorView class – Rince Thomas Oct 03 '12 at 11:58
  • @Signare check this http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/ui/component/progressindicator/ActivityIndicatorView.html – Rupak Oct 03 '12 at 14:01
  • please post your multiple-frame spinner image. we can't debug why you can only get it to work with 1 frame, if you only show the 1 frame image. – Nate Oct 04 '12 at 20:18
  • @Nate With multiple frames I get the spinner image within a narrow strip, please see the above image. Moreover, as I said below in a comment its not animated even when I get the full image(only with 'gif' not 'jpg') with 1 frame and a gif image(see EDIT 2) – Atif Imran Oct 05 '12 at 04:32
  • If you want us to help, then upload the multi-frame image. I'm not sure why this is so difficult. – Nate Oct 05 '12 at 04:43
  • @Nate I m not sure what are you asking for? If you want to see how does my spinner image appears when I have multiple frames its the same as my first image(a narrow strip). – Atif Imran Oct 05 '12 at 06:31
  • @Nate I m sorry I could not get your question earlier, finally I nailed the problem and it was my image width. Thanks a lot for the suggestion :) – Atif Imran Oct 05 '12 at 06:56
  • No problem. That's why I was asking. It's easy to have the underlying image be wrong, and the code be correct. The device was probably trying to divide your single frame image into 1/9ths. Thanks for posting your solution, and accepting it, so we know the problem is solved. – Nate Oct 05 '12 at 22:13

2 Answers2

2

You didn't upload the img/spinner.jpg, so I assumed that the image has only one frame. Try replacing the line

act.createActivityImageField(spinImage, 9,Field.FIELD_HCENTER );

with the line

act.createActivityImageField(spinImage, 1, Field.FIELD_HCENTER);

Also check the API documentation carefully.

Rupak
  • 3,674
  • 15
  • 23
  • The spinner image is a simple jpg image and yes I did try with 1 frame as you mentioned above but it didn't work. You can see my spinner image I added as an edit. – Atif Imran Oct 03 '12 at 17:59
  • @Atif Imran, Is the output same when you use `1`? – Rupak Oct 04 '12 at 07:12
  • Not sure what is going wrong. You can try other values instead of `Field.FIELD_HCENTER` while invoking `createActivityImageField`. Try 0 once. – Rupak Oct 04 '12 at 09:41
  • I already tried with 0 and 1 with no luck. Changed the style to Bottom, leading etc. Even tried with a 'gif' image and got the full spinner image finally but not animated! Rupak, I need you to solve this!! – Atif Imran Oct 04 '12 at 10:08
1

Thanks Nate and Rupak.
I leave this for others facing similar issue.
I simply had to use the width of the image frames be the width of a frame multiplied by the total number of frames. Reference here


I set the number of frames 4 and image: enter image description here

Atif Imran
  • 1,899
  • 2
  • 18
  • 33