Skip to main content

ANDROID

8 replies [Last post]
veer25oct
Offline
Joined: 2010-02-23

Hi, LWUIT porting to android is a grt sigh of relief,
But i have a few concerns rather doubts.

1- Android allows you to save the state of your activity in case it is close or sent to the background, like when a phone call comes, or amny other cases,
How can i make use of that for my LWUIT code ported onto Android?

2- using components like surface view to make my video play?
Audio plays as that does'nt need a surface veiw.

3- can i somehow integrate both the codes. As in write some thing in android but integrate the code in LWUIT?

Can anyone help me on this, i need this urgently.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
technolgia
Offline
Joined: 2009-03-09

Hello,

I downloaded the latest LWUIT sources from svn and Thorston's Android imlementation classes. I deleted the files as metioned in the README.txt file provided in Thorstons imlpementation.I added android.jar file to the project sources, i still get error in the AndroidImplementation class at the following lines:

editText.setText(text == null ? "" : text);
bob.setTitle("");
bob.setPositiveButton(m.localize("ok", "OK"),
bob.setNegativeButton(m.localize("cancel", "Cancel"),

which are present in the editString method. Also
textView.setText("An internal application error occurred: " + err.toString()); in the handleEDTException method gives me an error. Am i missing out on something. Could someone kindly help me with this.

[b]Thanking you,
Regards,
S.A.Norton Stanley [/b]

thorsten_s
Offline
Joined: 2008-08-15

I don't know what could be going wrong here, please give the complete stacktrace and/or a compilable testcase to reproduce.

technolgia
Offline
Joined: 2009-03-09

Hi Thorston,

Thank you for replying. Since i could not check out your implementation of Android, i copied the sources from the incubator. Could you kindly provide me the correct URL to check out the Android impl. sources from the subversion and kindly let me know which version of Android jar file should be added to compile the lwuit sources with the Android implementation. When i port my existing application without the Android Implementation of LWUIT i do not see commands added to the form, because of which am stuck with my porting. Kindly help me with this.

[b]Thanking you,
Regards,
S.A.Norton Stanley[/b]

technolgia
Offline
Joined: 2009-03-09

Hi Thorston,

In the AndroidImplementation class, the following lines give me an error
1. editText.setText(text == null ? "" : text);
[b]Error: Cannot find symbol
Symbol: method setText(java.lang.String)
location class android.widget.EditText[/b]

2.) bob.setPositiveButton(m.localize("ok", "OK"),
new DialogInterface.OnClickListener() {

public void onClick(DialogInterface d, int which) {
d.dismiss();
synchronized (messageComplete) {
messageComplete[0] = true;
messageComplete.notify();
}
}
});
[b] Error: The method AlertDialog.Builder .setPositiveButton does not take a string as an argument it requires a CharacterSequence where as m.localize("ok", "OK") reutrns a string.[/b]

3.)BitmapFactory.Options.class.getField("inPurgeable").set(opts, true); in the createImage method gives the following error

[b]The method getField() does not exist.[/b]

These errors are repeated in a couple of places in the class. How do i resolve these issues? Kindly help me with this.

[b]Thanking you,
Regards,
S.A.Norton Stanley[/b]

technolgia
Offline
Joined: 2009-03-09

Hi,

Is there no way i can combine the LWUIT sources and Thorston's Implementation of Android and build the sources using an IDE to get a resulting .jar file that can be added as a dependency to my project?

[b]Thanking you,
Regards,
S.A.Norton Stanley[/b]

thorsten_s
Offline
Joined: 2008-08-15

I don't know about phone calls, but on orientation changes for example the activity is usually killed. You can configure your application by using the manifest xml file to handle certain input events yourself, rather than accept being killed every time. If you do that, then you will receive Form.hideNotify()/Form.showNotify() calls and know once your app is in the background/foreground.

The current implementation uses a SurfaceView as the drawing area. So it might be possible to build your video play on that. You will have to dive into the sources, though.

I don't understand what you mean by your third question.

veer25oct
Offline
Joined: 2010-02-23

Hi thorsten_s ,

I know what i'm asking has nothing to do with LWUIT.
But i'm really frustrated searching about this, and the prob does'nt seem to solve any time soon..
Has anyone tried this?

I have my LWUIT code ported to android,
I'm trying to play an AUDIO file using this code,

MediaPlayer mp = new MediaPlayer();
mp.setDataSource(URL);
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.prepare();
mp.start();

this code always fails at mp.prepare();

This is a problem only with Android 1.6
Android 2.2 it works fine..

I jus don know how to make this work on Android 1.6,
Because i have to give the demo on 1.6 device.

Can anyone help me.. has anyone made this work on 1.6.
Any help would be highly appreciated.

I have tried setting content type to audio/mpeg,
tried writing the file to SD card first then playing it..
Everythin works on 2.2 but not on 1.6..

ERROR:

D/PlayerDriver( 30): buffering (3)
D/PlayerDriver( 30): buffering (12)
D/PlayerDriver( 30): buffering (15)
D/PlayerDriver( 30): buffering (18)
D/PlayerDriver( 30): buffering (21)
D/PlayerDriver( 30): buffering (25)
D/PlayerDriver( 30): buffering (28)
D/PlayerDriver( 30): buffering (31)
D/PlayerDriver( 30): buffering (35)
E/PlayerDriver( 30): Command PLAYER_INIT completed with an error or info PVMFFailure
E/MediaPlayer( 200): error (1, -1)
W/System.err( 200): java.io.IOException: Prepare failed.: status=0x1
W/System.err( 200): at android.media.MediaPlayer.prepare(Native Method)
W/System.err( 200): at com.tcs.channels.mobile.ChannelsHome.playAudio(ChannelsHome.java:608)

veer25oct
Offline
Joined: 2010-02-23

Anyone?