Illegalargumentexception while updating image using dataprovider

19 messages - 2666 views

I use MainFrame.java which displays a list. Each listitem has an image and text. on Selecting a list item, the FrameA.java is pushed and a form is shown to the user. When the user submits this form in FrameA, the selected listitem in MainFrame.java should be updated with a new image. I get an illegalargumentexception when i try to update the image. Please suggest me what to do.

MainScreen.xml:

<scrollPane>

 <list> 

 

 

<_renderer><![CDATA[ 

<listitem onAction="details">

<picture><_image>@{newImage}</_image></picture>

<text>@{listItemText}</text>

</listitem>

 

 

]]></_renderer> 

 

 

<_items>@{listItems}</_items>

 

 

 

</list>

 </scrollPane>

Please let me know if you need any further information.

 

 

 

 

We are developing a product with KUix which is almost 80% complete now. The above issue has become a show stopper for our product. Please let us know a solution for this issue.

Are you updating the data provider ?

Hi

Yes I am updating the dataprovider for the listitem with the new image. here is the code snippet we used for updating the image.

public class ListItemDataProvider extends DataProvider
{
 private static final String IMAGE_PROPERTY = "newImage";
 
 private Image image;

 public void setImage(Image image)
 {
         this.image = image;
         dispatchUpdateEvent(IMAGE_PROPERTY);
 }

 protected Object getUserDefinedValue(String property)
 {
         if (IMAGE_PROPERTY.equals(property))
         {
              return this.image;
         }
 }
}

we are getting an illegalargumentexception while updating the dataprovider with the new image. The Stack Trace Show thats the exception occurs in the method 'setImageData()' of javax.microedition.lcdui.Image Class.

Any help would be appreciated.

Thanks.

 

Sorry the exception is in setImageData() method of javax.microedition.lcdui.game.Sprite Class.

IllegalArgumentException is resolved now. The issue was that the old and new image should have same dimensions, otherwise it would throw illegalargumentexception which is strange.

But i am facing another issue now. After the list item is updated with the new image, it is not visible in the list anymore. This List item is getting deleted from the list. Strange one again.

Any ideas from Kuix Team is welcome.

 

 

If you only invoke the setImage(..) on a listItem dataprovider, the corresponding listItem disappear ?

Hi Tofu,

Exactly. After i invoke the setImage method on list item dataprovider, the corresponding listitem disappear. 

Is there any work around for this. Any help would be appreciated.

Thanks.

 

 

 

 

As mentioned previously, We are in the final phase of our product development but this issue has turned out to be a nightmare to demo/release our product. Kuix Dev Team, please kindly post a solution for this issue.

Hi Kuix Experts,

Please Post a solution for this issue.

Thanks.

 

 

i wish i could help, I'm in the same boat as you. 

   [wtkrun] java.lang.IllegalArgumentException
   [wtkrun]     at javax.microedition.lcdui.game.Sprite.setImage(+35)
   [wtkrun]     at org.kalmeo.kuix.widget.Picture.doLayout(+94)

that's the exception (snippet) I get when I update my image via databinding.  the image is a different size.  is there no way to use 2 different sized images in a databinding scenario?

Hi Pandora808,

There is a way. you have to set the framewidth and frameheight values to image's width and height respectively through the dataprovider. See Below.

 <picture>

<_image>@{newImage}</_image>

<_framewidth>@{imageWidth}</_framewidth>

</picture>

It Updates the image correctly.

But if you are updating the image inside the list item, there is another issue. The listitem disappears. For all other components, it works fine.

Kuix Experts, Kindly help me to fix this issue. When the image in the list item is updated, the list item disappears. Without fixing this issue, we cannot show the midlet to our client. Please co-operate and help us in fixing this issue.

<_frameheight>@{imageHeight}</_frameheight>

are you using kuix 1.0.1 or an SVN build?

i am using kuix 1.0.1 source from svn repository

i am using kuix 1.0.1 source from svn repository along