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 <[email protected]> wrote:
>
> Will do - thanks
>
> On Aug 27, 7:05 am, "[email protected]" <[email protected]>
> 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 [email protected]
>>
>> Thanks !!!!
>>
>> On 27 אוגוסט, 11:28, Indicator Veritatis <[email protected]> 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 <[email protected]> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to