[android-developers] Re: J2ME vs Android Java
hey sparky.. thanks. i got it now. On Jan 12, 5:59 am, sparky spar...@google.com wrote: J2ME and Android are very different frameworks. You do not need to know anything about J2ME to write Android applications. You can pretend J2ME doesn't exist. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME vs Android Java
hey kris.. thanks. i got it now. On Jan 12, 6:49 am, Kristopher Micinski krismicin...@gmail.com wrote: On Wed, Jan 11, 2012 at 3:59 PM, sparky spar...@google.com wrote: J2ME and Android are very different frameworks. You do not need to know anything about J2ME to write Android applications. You can pretend J2ME doesn't exist. Agreed: I would wager a fair amount of (probably: most) Android developers have never used J2ME, simply because of the huge surge of newcomers that have come to Android. kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME vs Android Java
J2ME and Android are very different frameworks. You do not need to know anything about J2ME to write Android applications. You can pretend J2ME doesn't exist. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: J2ME vs Android Java
On Wed, Jan 11, 2012 at 3:59 PM, sparky spar...@google.com wrote: J2ME and Android are very different frameworks. You do not need to know anything about J2ME to write Android applications. You can pretend J2ME doesn't exist. Agreed: I would wager a fair amount of (probably: most) Android developers have never used J2ME, simply because of the huge surge of newcomers that have come to Android. kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
I did contact the J2ME Polish forum but no response. The J2ME list did have older archives on why the Connection class would be throwing a ConnectionNotFound exception and primarily was because of a non-supported protocol. So that's why I was wondering if there is anything else that I needed to configure with the emulator here or if the only option would be to rewrite all those parts of this code. In any case - thanks very much Miguel. If I do find a soln I would be happy to share it just in case anyone needs it - even though I have a feeling few ppl would be willing to follow this rough path ;) Cheers On Sep 10, 10:38 pm, Miguel Morales therevolti...@gmail.com wrote: Ah. Perhaps you might have better luck contacting the J2ME polish or J2ME mailing lists? On Fri, Sep 10, 2010 at 7:04 PM, kypriakos demet...@ece.neu.edu wrote: Thanks for the good information Miguel, I appreciate it even though I am aware of most of the code you are displaying below. My original question was a more general one, regarding the porting of J2ME code into Android, something that has been an issue for many developers who have large chunks of code in J2ME that are not easy to rewrite. I didn't give much information about the overall goal so you are right, the small code segment I showed looked like a very small update that would have taken seconds actually to port and in fact modified to be done correctly (to avoid casting etc.). That particular piece of code is trying to open tcp sockets and use low lever streams to communicate. I have been porting a large peer-to-peer software baseline that has been running successfully under J2ME. In fact most of the code I imported in Android so far from J2ME has been working correctly and with very good performance results. The J2ME Polish project actually has ported the libs that I need in this case (including the javax.microedition) for the Android platform and that's what I have been using. So no, I am not lazily importing old code, I am importing current code that we need to run on Android. Logically if the places where this Connection class is used is in the hundreds, it made sense to be more efficient and try to use libs of J2ME ported in Android rather than changing all those places. Yes - not optimal but it is what it is. In summary, yes you and others have answered my original question, unless the trafeoffs are against it, it makes sense to always try to 'translate' everything that you run on Android using Android's API. Again thanks for the good pointers below On Sep 10, 7:26 pm, Miguel Morales therevolti...@gmail.com wrote: Sounds like you're doing it wrong. One, try not to include any foreign APIs/Jars unless you need it. Two, instead of trying to lazily port old code, redo the functionality using the classes android provides. Casting is prone to bugs, if don't incorrectly, it can hide warnings and errors. I don't know what it is you're trying to do there. You haven't explained what it is you're trying to do. Are you trying to open a socket and communicate via low level streams or just http? I suspect what you're trying to do is really easy, and shouldn't have taken more than a few minutes to update. You'll want to create an http url using the Url class: String mUrl = http://whatever.com;; URL url = new URL(mUrl); Then open a connection using URLConnection: URLConnection connection = url.openConnection(); You can then work with the stream directly using connection.getInputStream(), or work with BufferedReader like: BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()), 8); Grab the response to a string, not recommended, but if it's not a lot of data: String line; while ((line = in.readLine()) != null) { response = response + line;} in.close(); On Fri, Sep 10, 2010 at 2:56 PM, kypriakos demet...@ece.neu.edu wrote: Will do - thanks On Aug 27, 7:05 am, michal.g...@gmail.com michal.g...@gmail.com wrote: How about using a semi-automated service to convert J2ME to Android ? Give it a try - free for eval purposes. Take a look atwww.upontek.com, or send me your jar to michal.g...@upontek.com Thanks On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection;
[android-developers] Re: J2ME to Android
I found out that ConnectionNotFound exception thrown when opening a stream-based socket could be thrown when the protocol indicated in the Connection class is not supported - does Android support all of the following? http, comm, datagram, file, socket etc? I think yes but the exception does not seem to make sense. Thanks. On Sep 2, 11:58 pm, kypriakos demet...@ece.neu.edu wrote: Hey Kostya, are you referring to the apache http API included in Android? I will give it a shot. I downloaded and included the J2ME-polish that actually does run under Android but I am getting a Connection Not Found exception thrown when I run that piece of code in the emulator. I can actually connect to the location using the browser directly so something is not getting set right in that config ... Thanks On Sep 1, 3:34 pm, Kostya Vasilyev kmans...@gmail.com wrote: The code seems to be really simple, establishing an HTTP connection, and getting raw streams for reading and writing. Replace javax.microedition classes with those included with Android. -- Kostya 01.09.2010 23:26, kypriakos пишет: Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakosdemet...@ece.neu.edu wrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: J2ME to Android
Don't know off hand, sorry. Your code, however, appears to expect http protocol at least in one case out of the two: streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Note that cast to HttpConnection. -- Kostya 10.09.2010 18:56, kypriakos пишет: I found out that ConnectionNotFound exception thrown when opening a stream-based socket could be thrown when the protocol indicated in the Connection class is not supported - does Android support all of the following? http, comm, datagram, file, socket etc? I think yes but the exception does not seem to make sense. Thanks. On Sep 2, 11:58 pm, kypriakosdemet...@ece.neu.edu wrote: Hey Kostya, are you referring to the apache http API included in Android? I will give it a shot. I downloaded and included the J2ME-polish that actually does run under Android but I am getting a Connection Not Found exception thrown when I run that piece of code in the emulator. I can actually connect to the location using the browser directly so something is not getting set right in that config ... Thanks On Sep 1, 3:34 pm, Kostya Vasilyevkmans...@gmail.com wrote: The code seems to be really simple, establishing an HTTP connection, and getting raw streams for reading and writing. Replace javax.microedition classes with those included with Android. -- Kostya 01.09.2010 23:26, kypriakos пишет: Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakosdemet...@ece.neu.eduwrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
No worries Kostya, you have been helpful anyway many times and I appreciate it ;) You are right, the Http cast I can deal with, for some reason the Socket one is the one that is puzzling and not working. I will play around with it and I will post a soln (hopefully) in case anyone else runs into this. Thanks again On Sep 10, 11:24 am, Kostya Vasilyev kmans...@gmail.com wrote: Don't know off hand, sorry. Your code, however, appears to expect http protocol at least in one case out of the two: streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Note that cast to HttpConnection. -- Kostya 10.09.2010 18:56, kypriakos пишет: I found out that ConnectionNotFound exception thrown when opening a stream-based socket could be thrown when the protocol indicated in the Connection class is not supported - does Android support all of the following? http, comm, datagram, file, socket etc? I think yes but the exception does not seem to make sense. Thanks. On Sep 2, 11:58 pm, kypriakosdemet...@ece.neu.edu wrote: Hey Kostya, are you referring to the apache http API included in Android? I will give it a shot. I downloaded and included the J2ME-polish that actually does run under Android but I am getting a Connection Not Found exception thrown when I run that piece of code in the emulator. I can actually connect to the location using the browser directly so something is not getting set right in that config ... Thanks On Sep 1, 3:34 pm, Kostya Vasilyevkmans...@gmail.com wrote: The code seems to be really simple, establishing an HTTP connection, and getting raw streams for reading and writing. Replace javax.microedition classes with those included with Android. -- Kostya 01.09.2010 23:26, kypriakos пишет: Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakosdemet...@ece.neu.edu wrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: J2ME to Android
10.09.2010 21:37, kypriakos пишет: You are right, the Http cast I can deal with, for some reason the Socket one is the one that is puzzling and not working. I will play around with it and I will post a soln (hopefully) in case anyone else runs into this. May I suggest taking a look at the other URL, the one whose connection is *not* cast to an HttpConnection. Knowing what scheme (http, datagram, etc) it uses should help you come up with a suitable Android replacement. -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
Yes I do have the Internet permission set: uses-permission android:name=android.permission.INTERNET / On Sep 3, 4:01 am, Kostya Vasilyev kmans...@gmail.com wrote: Not familiar with J2ME-polish, sorry. You should really try to add regular Android code, at least as a test. Oh, and you do have INTERNET permission in your application, right? -- Kostya 03.09.2010 7:58, kypriakos пишет: Hey Kostya, are you referring to the apache http API included in Android? I will give it a shot. I downloaded and included the J2ME-polish that actually does run under Android but I am getting a Connection Not Found exception thrown when I run that piece of code in the emulator. I can actually connect to the location using the browser directly so something is not getting set right in that config ... Thanks On Sep 1, 3:34 pm, Kostya Vasilyevkmans...@gmail.com wrote: The code seems to be really simple, establishing an HTTP connection, and getting raw streams for reading and writing. Replace javax.microedition classes with those included with Android. -- Kostya 01.09.2010 23:26, kypriakos пишет: Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakosdemet...@ece.neu.edu wrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
Will do - thanks On Aug 27, 7:05 am, michal.g...@gmail.com michal.g...@gmail.com wrote: How about using a semi-automated service to convert J2ME to Android ? Give it a try - free for eval purposes. Take a look atwww.upontek.com, or send me your jar to michal.g...@upontek.com Thanks On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much-הסתר טקסט מצוטט- -הראה טקסט מצוטט- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
Sometimes easier set than done but I agree, it makes sense to use what the platform offers. As an alternative I will see if I can use the apache.conn. Out of curiosity, how do you determine the 'better than' below? Still the issue I am getting with the ConnectionNotFound does not seem to be an implementation or a performance issue but rather a configuration issue - I will keep at it a bit more before I give it up. Thanks again On Aug 27, 4:28 am, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: J2ME to Android
Sounds like you're doing it wrong. One, try not to include any foreign APIs/Jars unless you need it. Two, instead of trying to lazily port old code, redo the functionality using the classes android provides. Casting is prone to bugs, if don't incorrectly, it can hide warnings and errors. I don't know what it is you're trying to do there. You haven't explained what it is you're trying to do. Are you trying to open a socket and communicate via low level streams or just http? I suspect what you're trying to do is really easy, and shouldn't have taken more than a few minutes to update. You'll want to create an http url using the Url class: String mUrl = http://whatever.com;; URL url = new URL(mUrl); Then open a connection using URLConnection: URLConnection connection = url.openConnection(); You can then work with the stream directly using connection.getInputStream(), or work with BufferedReader like: BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()), 8); Grab the response to a string, not recommended, but if it's not a lot of data: String line; while ((line = in.readLine()) != null) { response = response + line; } in.close(); On Fri, Sep 10, 2010 at 2:56 PM, kypriakos demet...@ece.neu.edu wrote: Will do - thanks On Aug 27, 7:05 am, michal.g...@gmail.com michal.g...@gmail.com wrote: How about using a semi-automated service to convert J2ME to Android ? Give it a try - free for eval purposes. Take a look atwww.upontek.com, or send me your jar to michal.g...@upontek.com Thanks On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much-הסתר טקסט מצוטט- -הראה טקסט מצוטט- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- ~ Jeremiah:9:23-24 Android 2D MMORPG: http://developingthedream.blogspot.com/, http://diastrofunk.com, http://www.youtube.com/user/revoltingx -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
Thanks for the good information Miguel, I appreciate it even though I am aware of most of the code you are displaying below. My original question was a more general one, regarding the porting of J2ME code into Android, something that has been an issue for many developers who have large chunks of code in J2ME that are not easy to rewrite. I didn't give much information about the overall goal so you are right, the small code segment I showed looked like a very small update that would have taken seconds actually to port and in fact modified to be done correctly (to avoid casting etc.). That particular piece of code is trying to open tcp sockets and use low lever streams to communicate. I have been porting a large peer-to-peer software baseline that has been running successfully under J2ME. In fact most of the code I imported in Android so far from J2ME has been working correctly and with very good performance results. The J2ME Polish project actually has ported the libs that I need in this case (including the javax.microedition) for the Android platform and that's what I have been using. So no, I am not lazily importing old code, I am importing current code that we need to run on Android. Logically if the places where this Connection class is used is in the hundreds, it made sense to be more efficient and try to use libs of J2ME ported in Android rather than changing all those places. Yes - not optimal but it is what it is. In summary, yes you and others have answered my original question, unless the trafeoffs are against it, it makes sense to always try to 'translate' everything that you run on Android using Android's API. Again thanks for the good pointers below On Sep 10, 7:26 pm, Miguel Morales therevolti...@gmail.com wrote: Sounds like you're doing it wrong. One, try not to include any foreign APIs/Jars unless you need it. Two, instead of trying to lazily port old code, redo the functionality using the classes android provides. Casting is prone to bugs, if don't incorrectly, it can hide warnings and errors. I don't know what it is you're trying to do there. You haven't explained what it is you're trying to do. Are you trying to open a socket and communicate via low level streams or just http? I suspect what you're trying to do is really easy, and shouldn't have taken more than a few minutes to update. You'll want to create an http url using the Url class: String mUrl = http://whatever.com;; URL url = new URL(mUrl); Then open a connection using URLConnection: URLConnection connection = url.openConnection(); You can then work with the stream directly using connection.getInputStream(), or work with BufferedReader like: BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()), 8); Grab the response to a string, not recommended, but if it's not a lot of data: String line; while ((line = in.readLine()) != null) { response = response + line;} in.close(); On Fri, Sep 10, 2010 at 2:56 PM, kypriakos demet...@ece.neu.edu wrote: Will do - thanks On Aug 27, 7:05 am, michal.g...@gmail.com michal.g...@gmail.com wrote: How about using a semi-automated service to convert J2ME to Android ? Give it a try - free for eval purposes. Take a look atwww.upontek.com, or send me your jar to michal.g...@upontek.com Thanks On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much-הסתר טקסט מצוטט- -הראה טקסט מצוטט- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- ~ Jeremiah:9:23-24 Android 2D MMORPG:http://developingthedream.blogspot.com/,http://diastrofunk.com,http://www.youtube.com/user/revoltingx -- You received this message because you are subscribed to the Google Groups Android
Re: [android-developers] Re: J2ME to Android
Ah. Perhaps you might have better luck contacting the J2ME polish or J2ME mailing lists? On Fri, Sep 10, 2010 at 7:04 PM, kypriakos demet...@ece.neu.edu wrote: Thanks for the good information Miguel, I appreciate it even though I am aware of most of the code you are displaying below. My original question was a more general one, regarding the porting of J2ME code into Android, something that has been an issue for many developers who have large chunks of code in J2ME that are not easy to rewrite. I didn't give much information about the overall goal so you are right, the small code segment I showed looked like a very small update that would have taken seconds actually to port and in fact modified to be done correctly (to avoid casting etc.). That particular piece of code is trying to open tcp sockets and use low lever streams to communicate. I have been porting a large peer-to-peer software baseline that has been running successfully under J2ME. In fact most of the code I imported in Android so far from J2ME has been working correctly and with very good performance results. The J2ME Polish project actually has ported the libs that I need in this case (including the javax.microedition) for the Android platform and that's what I have been using. So no, I am not lazily importing old code, I am importing current code that we need to run on Android. Logically if the places where this Connection class is used is in the hundreds, it made sense to be more efficient and try to use libs of J2ME ported in Android rather than changing all those places. Yes - not optimal but it is what it is. In summary, yes you and others have answered my original question, unless the trafeoffs are against it, it makes sense to always try to 'translate' everything that you run on Android using Android's API. Again thanks for the good pointers below On Sep 10, 7:26 pm, Miguel Morales therevolti...@gmail.com wrote: Sounds like you're doing it wrong. One, try not to include any foreign APIs/Jars unless you need it. Two, instead of trying to lazily port old code, redo the functionality using the classes android provides. Casting is prone to bugs, if don't incorrectly, it can hide warnings and errors. I don't know what it is you're trying to do there. You haven't explained what it is you're trying to do. Are you trying to open a socket and communicate via low level streams or just http? I suspect what you're trying to do is really easy, and shouldn't have taken more than a few minutes to update. You'll want to create an http url using the Url class: String mUrl = http://whatever.com;; URL url = new URL(mUrl); Then open a connection using URLConnection: URLConnection connection = url.openConnection(); You can then work with the stream directly using connection.getInputStream(), or work with BufferedReader like: BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()), 8); Grab the response to a string, not recommended, but if it's not a lot of data: String line; while ((line = in.readLine()) != null) { response = response + line;} in.close(); On Fri, Sep 10, 2010 at 2:56 PM, kypriakos demet...@ece.neu.edu wrote: Will do - thanks On Aug 27, 7:05 am, michal.g...@gmail.com michal.g...@gmail.com wrote: How about using a semi-automated service to convert J2ME to Android ? Give it a try - free for eval purposes. Take a look atwww.upontek.com, or send me your jar to michal.g...@upontek.com Thanks On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much-הסתר טקסט מצוטט- -הראה טקסט מצוטט- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- ~ Jeremiah:9:23-24 Android
Re: [android-developers] Re: J2ME to Android
Not familiar with J2ME-polish, sorry. You should really try to add regular Android code, at least as a test. Oh, and you do have INTERNET permission in your application, right? -- Kostya 03.09.2010 7:58, kypriakos пишет: Hey Kostya, are you referring to the apache http API included in Android? I will give it a shot. I downloaded and included the J2ME-polish that actually does run under Android but I am getting a Connection Not Found exception thrown when I run that piece of code in the emulator. I can actually connect to the location using the browser directly so something is not getting set right in that config ... Thanks On Sep 1, 3:34 pm, Kostya Vasilyevkmans...@gmail.com wrote: The code seems to be really simple, establishing an HTTP connection, and getting raw streams for reading and writing. Replace javax.microedition classes with those included with Android. -- Kostya 01.09.2010 23:26, kypriakos пишет: Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakosdemet...@ece.neu.eduwrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
Hey Kostya, are you referring to the apache http API included in Android? I will give it a shot. I downloaded and included the J2ME-polish that actually does run under Android but I am getting a Connection Not Found exception thrown when I run that piece of code in the emulator. I can actually connect to the location using the browser directly so something is not getting set right in that config ... Thanks On Sep 1, 3:34 pm, Kostya Vasilyev kmans...@gmail.com wrote: The code seems to be really simple, establishing an HTTP connection, and getting raw streams for reading and writing. Replace javax.microedition classes with those included with Android. -- Kostya 01.09.2010 23:26, kypriakos пишет: Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakosdemet...@ece.neu.edu wrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakos demet...@ece.neu.edu wrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: J2ME to Android
The code seems to be really simple, establishing an HTTP connection, and getting raw streams for reading and writing. Replace javax.microedition classes with those included with Android. -- Kostya 01.09.2010 23:26, kypriakos пишет: Hi all - trying this one again .. any ideas? If the Connector class was not created in the original Android Java, what else can be used in its place? 3rd Party software or any other part of the API? Thanks. On Aug 26, 4:47 pm, kypriakosdemet...@ece.neu.edu wrote: I am pretty much trying to solve these issues: import javax.microedition.io.Connector; socketCon = (SocketConnection) Connector.open(strURL, Connector.READ_WRITE); and import javax.microedition.io.StreamConnection; streamCon = (SocketConnection) Connector.open(strURL, Connector.READ); streamCon = (HttpConnection) Connector.open(strURL, Connector.READ); Any ideas would be greatly appreciated. Thanks -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: J2ME to Android
How about using a semi-automated service to convert J2ME to Android ? Give it a try - free for eval purposes. Take a look at www.upontek.com, or send me your jar to michal.g...@upontek.com Thanks On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much-הסתר טקסט מצוטט- -הראה טקסט מצוטט- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: J2ME to Android
The hardware is out there for it now. Is he willing to pay for it to be developed? If not then we need to get it done and out on the market calling in favours. Do you have a graphics person that could do graphics for free? Could you plan out the feature set and an IA and I'll get it realised asap. Cheers S --- Sena Gbeckor-Kove CTO/Founder - imKon UK : +44 7788 146652 s...@imkon.com|www.imkon.com Asia (Singapore) : 35 Selegie Road, #09-14/15 Parklane Shopping Mall, 188307 Singapore, Singapore Europe (London) : 145-157 St John's St, EC1V 4PY London, UK On 27 Aug 2010, at 13:05, michal.g...@gmail.com wrote: How about using a semi-automated service to convert J2ME to Android ? Give it a try - free for eval purposes. Take a look at www.upontek.com, or send me your jar to michal.g...@upontek.com Thanks On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote: Since Android does not include the javax.microedition package, one should not expect an exact equivalent. But we do have the org.apache.conn and org.apache.http.* packages; some of us think these are much better than anything in javax.microedition! One should still expect to use a very little bit from java.net, e.g. the Url and Uri classes. On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote: Does anyone know the equivalent of these imports from J2ME to Android? import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.io.SocketConnection; import javax.microedition.io.StreamConnection; Also, I needed to import midpapi20.jar but I don't want to use packages outside Android into my app -- would I be able to find most of the related packages in Android libs? Thanks very much-הסתר טקסט מצוטט- -הראה טקסט מצוטט- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en smime.p7s Description: S/MIME cryptographic signature