BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 01-22-2010, 03:51 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question How to click on a .jpg image in Blackberry 4.5 ?

Please Login to Remove!

Hi all,

I m displaying a .jpg image in a BitmapField & adding it in a VerticalFieldManager. It is getting displayed but I cannot click on it.

I m doing it like..

Code:
Bitmap bitmap = Bitmap.getBitmapResource("image.jpg");

BitmapField bitmapField = new BitmapField(bitmap , BitmapField.FOCUSABLE)        
    {
        protected boolean navigationClick(int status, int time )
        {
            //handle click event                
            return true;
        }
    };
VerticalFieldManager vfm = new VerticalFieldManager();
vfm.add(bitmapField);
add(vfm_stamp);
But if I take a .png image like

Code:
Bitmap bitmap = Bitmap.getBitmapResource("image.png");
then it is clickable. Why so?

Blackberry 4.5 supports .jpg image format. It displays a .jpg image then why its not clickable ? I want to make it clickable.

How to do it ?
Offline  
Old 01-22-2010, 06:45 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

You want your custom BitmapField class to extend BitmapField and override isFocusable() to return true.
Offline  
Old 01-22-2010, 07:41 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question

Thanks for the reply.

By my method also it gets clicked. Only thing is that .jpg image doesnt show focus (Blue background) when pointer is moved on it.

Even I have overridden isFocusable() to return true.

How to show that focus ?
Offline  
Old 01-22-2010, 08:49 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

If you are talking about the focus highlight, then you won't see it if the JPG is not transparent or does not have a transparent border.

Try adding some margin around the bitmap - check the javadocs, I believe the method is setSpace(int,int)
Offline  
Old 01-22-2010, 10:47 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

Hey,

Thanks a lot... Its working by setSpace(int,int) .
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.