Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Problem in ButtonField and BitmapField

Hi

I have made a bitmapfield and editfield and add fieldChange listener to both.

There is a save button.

I want when the user changes the bitmapfield and enter save button the particular action takes place and same with editfield.

 

So the problem is i don't understand how to check bitmapfield with the save buttonfield.

 

if(field==save)

{

//do this

}

else if(bitmapfield==save) ///???

{

//do this

}

 

Developer
Posts: 19,624
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in ButtonField and BitmapField

The BitmapField does not normally generate a fieldchanged notification as it is normally just displays an image and people don't click it.  So you have two choices:

 

a) Implement a change notification in your BitmapField

b) override navigationClick in your BitmapField. 

 

Of the two options (a) is probably the more elegant, but it is also the most code changes - so try to get (b) wotking.  You have already been told about this in one of your other Threads here:

http://supportforums.blackberry.com/t5/Java-Development/How-to-select-the-image-through-gallery-or-c...

Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in ButtonField and BitmapField

Hi

in my bitmapfield i have already added a navigational click and its doing different task.

What i want when the user edit the bitmapfield by adding new image and then click on save button then this image gets saved in some url.

And when the user edits the other field and click the save button then that content gets saved to some other link.

The problem is i have to use the same save button but that sends data to different url.

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: Problem in ButtonField and BitmapField

So u want bitmap from that bitmap field to be saved on save button click?
Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in ButtonField and BitmapField

Yes.When i edit the bitmapfield that new Bitmap image should be save

Developer
Posts: 19,624
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in ButtonField and BitmapField

What exactly are you saving? 

 

The actual raw bytes that make up the Birmap that is displayed, or some 'name' that is associated with the displayed image.  Most people will save the 'name' since it is a lot smaller.  Saving the raw byes can be done, but then you should look at how you create the Bitmap you display in the first place.  If this is, for example, downloaded, then saving the URL you downloaded it from is probably OK.

 

Please can you describe what you want to save?

Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in ButtonField and BitmapField

See i have made a profile page that contains the data from the server.

ProfileImage

Name1

name2, etc

i can edit them and send the changed fields to the server.

I am getting the response from the server in string .

So i retrieve the string as image name of the server and get the Bitmap from that and place it in bitmapfield.

So when i edit the bitmapfield and click the save button the new image gets saved .

 

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: Problem in ButtonField and BitmapField

the way u r sending remains same because bitmap field remains same only bitmap in that changes
Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in ButtonField and BitmapField

So, if i edit the bitmap field and save the changes made.Then how do i check??

Developer
Posts: 19,624
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in ButtonField and BitmapField

If I understand correctly, your profile picture is a URL, that you download. 

 

If someone selects a new profile image, then you need to update that URL with new image.  You can't do that directly from the Blackberry.  You will have to send a request to the server and supply the raw bytes in whatever format the Server requires.

 

There will probably be a special Server request that you will have to use, and it will specify the format of the request and the type of data that it will accept.  You need to review the Server documentation before you can implement this.