Application Issues facing with Android 2.1

11 posts / 0 new
Last post
abhijit
abhijit's picture
Offline
Joined: 31 Dec 2010
Posts:
Application Issues facing with Android 2.1

Hello,

I am developing some applications with MoSync-2.4.0-r2425 build for my
Android device Motorola Milestone (Android 2.1) and facing following
issues:

1. I have created simple application with list having 20 Label items.
It was installed properly on Android 2.1 BUT when I tried to scroll it,
it was not able to scroll till the last item....only scroll upto 10 items.

What is the problem? I have no idea...

2. I have created another application where I am using 5-6 Font resources(approx
70kb), with 5-6 .png image resources(approx 30kb).
This application works fine with all simulators provided with MoSync, also I have
installed it on Samsung GT-S5233S, Samsung Wave GT-S8500, and Samsung Corby and
it is working fine on all devices.

BUT when I was trying to install it on Android 2.1 Motorola Milestone it gets
installed but when I starts the application it was giving me the "Malloc Failed:
try to increase the heap memory.." error.
Previously I was using,
Heap = 1024 kb
Stack = 512 kb
Data = 2048 kb

So I have increase it to, the largest that Motorola Milestone Android 2.1
supports,
Heap = 9000 kb
Stack = 2000 kb
Data = 16384 kb

Then, the Malloc issue is solved, BUT it is giving me the
"Font::setResource(MAHandle ...), out of memory, not able to load Font image.."
error with "Force Close" button...and application get closed...

I have also read the http://www.mosync.com/content/android-crash-maui-font-constructor article and tried to change the font file extensions to .bin BUT the
problem remains the same....

So Please please can anybody tell me is it some issue with MoSync-2.4.0-r2425
to that is not able to handle it on Android phones because same application
works very fine on low end devices like corby....or what what is going
wrong....???

Please reply anybody...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

I've seen the font memory issue before, when the font is added as a .ubin resource. How have you loaded it?

Is the list a standard MAUI ListBox control? If so, is the control the same size as the screen? I wonder if the problem is that the listbox thinks it is larger than it actually is. Can you share some code?

abhijit
abhijit's picture
Offline
Joined: 31 Dec 2010
Posts:

Hi Sam,

Thank you for reply...

For issue 1:
------------
Yes, it is MAUI ListBox control.
Its the application with the MoSync-2.4.0-r2425 Tutorial 'MAUIEx'
I have just added the N-number of Labels to the listBox in MAUIex.cpp

The code between
// START-MyCode and // END-MyCode is added by me

- Issue is scrolling issue on Android 2.1, Motorola Milestone is Touch Screen phone
- Works fine on other devices - J2ME where scrolling is done by keys

I have attached the MAUIex.cpp file in MAUIex.zip

For issue 2:
------------

I am first creating the fonts by using bmfont.exe tool from C:\MoSync\bin\BMFont\
I use,
- font descriptor - binary
- Textures - png
- compression - deflate
and after creating xyz.mof file I rename it to xyz.bin resource and add it to the
res.lst file
Is there any other way?...

AttachmentSize
MAUIEx.zip 107.46 KB
Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Thanks, I'll have a look at the code shortly. Sometimes when people add fonts to the res.lst, they have
.res MYFONT
.ubin
.include "font.mof"

Which I've seen cause problems.

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Yeah, I've been able to reproduce this now. I've got two font files, which are big, but the screen is big, using the open source DroidSans font converted to a mof font. Doesn't matter how much memory I allocate, I get this error. I'm recreating the Android listbox, so I've got a black font and a white font, which the forum won't let me attach. They are attached to the bug report at https://github.com/MoSync/MoSync

Works great in MoRE, but Android puts its pants on its head.

abhijit
abhijit's picture
Offline
Joined: 31 Dec 2010
Posts:

yea, I also have commented the bug at https://github.com/MoSync/MoSync

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Hmm, its working fine for me again now. One thing I did different was that before I created the fonts in a newer version of BMFont than the one supplied. I've recreated the fonts using the old BMFont and I can see that the output is a different size. Mof didn't complain about the newer fonts, and it worked in MoRE, but it might be the root of the problem.

Miguel Augusto
miguelmaugusto's picture
Offline
Mobile Wizard
Joined: 19 Dec 2011
Posts:

Can you tell me how to create a black font, please?

Many thanks in advance,
Mike

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

In a NativeUI Label (or similar), in C, you set the property MAW_LABEL_FONT_COLOR. For instance

maWidgetSetProperty(myLabel, MAW_LABEL_FONT_COLOR, "0x000000");

If you are using the NativeUI C++ library, you'd do it as:

myLabel->setProperty(MAW_LABEL_FONT_COLOR, "0x000000");

In MAUI (non-native UI), you can follow the instructions here http://www.mosync.com/documentation/tutorials/creating-new-fonts - for details, but at the command line you'd specify the color as 000000 e.g.
mof -fontData Arial.fnt -fontImage Arial_00.png -fontColor 000000 -outFile ArialBlack.mof

Hope this helps.

Miguel Augusto
miguelmaugusto's picture
Offline
Mobile Wizard
Joined: 19 Dec 2011
Posts:

Thanks! :-)

The only thing I was doing wrong then, was putting the 0x in the 0x000000 hex black color, instead of simply 000000.

Hope it helps others that get this misunderstanding too. :-)

Sam Pickard
rival's picture
Offline
Mobile Archmage
Joined: 19 Mar 2009
Posts:

Yeah, I did that the first time too :-)