Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Bug fix for the Android port "List" object

3 views
Skip to first unread message

Wolthenstain

unread,
May 4, 2011, 12:25:30 AM5/4/11
to microemulator-developers
This is for snapshot 3.0.0 (I'm not sure if it's present in the
release version) - since you yourself (as I have read) suggest this
version for Android - because 2.0.4/2.0.5 requires old Android SDK.

Here is the sample code :

import javax.microedition.lcdui.*;
public class Main implements Runnable
{
public void Main()
{
List test = new List ("Test list",List.IMPLICIT);
int i=test.size(); // this would cause null pointer exception
}
}

Here is the fixed function for "microemu-android\src\org\microemu
\android\device\ui\AndroidListUI.java" :

public int size()
{
while (listAdapter == null) /* there is probably a better workaround
for this */
{
try {Thread.sleep(50);} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
return listAdapter.getCount();
}

The problem is that listAdapter is created in another thread, and if
you call size() too quickly it might not yet be initialized.
I'm sorry I don't have time to make a better post. Feel free to use
this information as you like - or not use it at all.

Bartek Teodorczyk

unread,
May 9, 2011, 9:50:53 AM5/9/11
to microemulato...@googlegroups.com
Thanks for reporting the problem. It should be fixed now and tomorrow
3.0.0 snapshot will include it.

BR,
Bartek Teodorczyk

> --
> You received this message because you are subscribed to the Google Groups "microemulator-developers" group.
> To post to this group, send email to microemulato...@googlegroups.com.
> To unsubscribe from this group, send email to microemulator-deve...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/microemulator-developers?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages