what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 17:58:47 GMT


Sponsored Links
 Hi my code (red colored) is not responding, saying that time out,
please let me know where i'm doing wrong.

// Prepare a request object
        HttpGet httpget = new HttpGet(" http://10.91.28.203 ");

        // Execute the request
        HttpResponse response = null;

        JSONObject json = new JSONObject();
        System.out.println("result = " + result);
        System.out.println("json object " + json.toString());

        try {
            System.out.println("inside try 1");
            response = httpclient.execute(httpget);

-- 
Thanks & Regards

Rakesh Kumar Jha

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by neha jain » Wed, 18 May 2011 18:33:20 GMT


 Whereas i know with GET request data is send as part of url and JSONObject
is used with POST.





-- 


Sponsored Links


Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Kostya Vasilyev » Wed, 18 May 2011 18:36:15 GMT


 Possibly a real connection error?

The 10.* range is for private subnets, if the server is on your 
company's internal network, then it won't be visible through the phone's 
mobile data connection (as that would be coming from the outside).


-- Kostya

18.05.2011 14:33, neha jain ?????:
Whereas i know with GET request data is send as part of url and JSONObject is used with POST. On Wed, May 18, 2011 at 10:58 AM, Rocky <rkjhaw1...@gmail.com Hi my code (red colored) is not responding, saying that time out, please let me know where i'm doing wrong. // Prepare a request object HttpGet httpget = new HttpGet(" http://10.91.28.203 "); // Execute the request HttpResponse response = null; JSONObject json = new JSONObject(); System.out.println("result = " + result); System.out.println("json object " + json.toString()); try { System.out.println("inside try 1"); response = httpclient.execute(httpget); -- Thanks & Regards Rakesh Kumar Jha -- --
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by neha jain » Wed, 18 May 2011 18:38:57 GMT


 Add this line and try.
 HttpConnectionParams.setConnectionTimeout(client.getParams(), 5000);






-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 18:41:24 GMT


 thanks Kostya,

so how to test it, "localhost:2853" also not supported.
please let me know, my code is ok









-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Kostya Vasilyev » Wed, 18 May 2011 18:51:38 GMT


 Localhost refers to your device's or the emulator's internal network - 
and that's probably not where your server is running.


Do you have INTERNET permission in the manifest?

If you do, two things to try:

- Open the URL with the device's web browser (or the emulator's);

- Use 'adb shell' and then 'ping' to check if the host is reachable.

-- Kostya

18.05.2011 14:41, Rocky :
thanks Kostya, so how to test it, "localhost:2853" also not supported. please let me know, my code is ok
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 18:55:45 GMT


 Hi Kostya,

INTERNET permission is there,

i'm pinging host, but not reachable,
what to do








-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 18:59:10 GMT


 10.91.28.203 its not reachable , but localhost is reachable, while
www.google.com is also not reachable from adb shell








-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Kostya Vasilyev » Wed, 18 May 2011 19:08:02 GMT


 18.05.2011 14:58, Rocky :
10.91.28.203 its not reachable , but localhost is reachable, while www.google.com < http://www.google.com > is also not reachable from adb shell
Then your device is not configured to access the Internet. -- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Diogo Salaberri » Wed, 18 May 2011 20:24:23 GMT


 // Create a default client HTTP
DefaultHttpClient cliente = new DefaultHttpClient();

// Set post or get method and set the URL
HttpPost post = new HttpPost("URL");

// Here you can set a parameter,
post.addHeader("Name", "Value");

// When you receive a response, you need to get this in a TRY/CATCH
try{
response = cliente.execute(post);
        HttpEntity entity = response.getEntity();
Out = EntityUtils.toString(entity);
}catch (Exception e) {
        // Do something with your exception
}

One more thing, if want to receive a JSON object, just use ( object =
(JSONObject) new JSONTokener(Out).nextValue(); ).. Cutting extra caracters
that isn't a JSON.

I hope can you enjoy this.. see you.

-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Cincia da Computao - UFPel

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 20:28:16 GMT


 Hi
I'm not getting any response from below line.

response = cliente.execute(post);







-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Diogo Salaberri » Wed, 18 May 2011 21:55:01 GMT


 verify your URL, are you requesting a local server our something like this ?








-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Cincia da Computao - UFPel

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Vishal » Thu, 19 May 2011 02:50:47 GMT


 Little modification

HttpGet httpget = new HttpGet(" http://10.91.28.203 ");

    // Execute the request
     HttpResponse response = null;

     try {
       System.out.println("inside try 1");
       response = httpclient.execute(httpget);

         HttpEntity entity = response.getEntity();

         if(entity!=null)
         {
             BufferedReader reader = new BufferedReader(new
InputStreamReader(response.getEntity().getContent(), "UTF-8"));
            StringBuilder builder = new StringBuilder();
            for (String line = null; (line = reader.readLine()) !=
null;)
            {
                   builder.append(line).append("\n");
            }
           JSONTokener tokener = new JSONTokener(builder.toString());
           JSONArray finalResult = new JSONArray(tokener);

         }







-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Denis Shalagin » Thu, 19 May 2011 02:51:05 GMT


 Are you sure that ping for " http://10.91.28.203 " is OK?





-- 



Re: Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Diogo Salaberri » Thu, 19 May 2011 03:50:15 GMT


 Your code is right, but can generate erros because, normally, the response
of a request have caracteres that can't be used like a native JSON. The
response string need to be looked more carefully, use subString is a hint.

bye

-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Cincia da Computao - UFPel

-- 



Other Threads

1. Problems storing images with Base64 encode into a row of a SQL DB

0 down vote favorite


Hi

i'm encodding images with Base64 into Strings, and i am uploading
these images into a remote database, in a row of the table USER. That
row is TEXT, because i dont know if there is anothr String type with
more space than TEXT.

When i store very small images, with 5 or 10 KB of space, they store
OK, and when i get these images back from the sql DB into my app, i
can decode them into BitMap and show them into a ImageView.

THE PROBLEM: When i store images with for example 110 KB of space, i
think they doesn't store OK in the TEXT row of my table USER in the
SQL DB, because when i try to decode them, i got an error, they can't
be decoded, but i dont know why, because the decode function of Base64
simply returns null when he can't decode.

There is a way to solve it?

How munch KB can have a image to be stored into the row of a databse?

The better option for the row is to be TEXT ? or there is another Type
that can store more higher Strings?

thanks

-- 

2. Emulator snapshots in API 9 work with older API levels

I am loving the emulator snapshot feature that is at "Early look" stage in 
SDK Tools Revision 9

http://developer.android.com/sdk/tools-notes.html#

This capability is speeding up my development using the emulator 
significantly. It took me a while to figure out how to use it so wanted to 
share it here :


* Set the "Snapshot Enabled" checkbox in the SDK Manager > Virtual Devices > 
New...

NOTE : Make sure you upgrade your Eclipse plugin for Android Development to 
9.0.0 or the Snapshot Enabled feature wont show.

* Start your AVM and enable the `Save to Snapshot` checkbox, then click 
Launch button

* Once the AVM is running. Set it up how you want it to resume later. E.g. 
change settings, screen rotation and run the app you want.

* Close the emulator window (click the close box). The AVM state will be 
saved and the window will close.

RESUME the AVM

* From the SDK Manager > Virtual Devices select your device and click 
Start...

* This time turn `Launch from Snapshot` ON and `Save to Snapshot` checkbox 
OFF then click Launch button.

* Your AVM should launch in a few seconds and resume to its saved state like 
magic.

* Close the emulator window and the present state will be lost (because we 
turned  `Save to Snapshot` checkbox OFF). Resume again to the originally 
saved snapshot at any time.

SUMMARY

Emulator Snapshots - New in API Level 9
Good
- Instant-On Emulator at a state you decide.
- Saves time (several minutes)
- Configure your AVM settings Once
- Works with older API versions (e.g. Froyo 2.2)
Bad
- Only one snapshot per AVM
- Defaults to standard screen orientation



-- 

3. Put all my Nexus S data through a SOCKS5 proxy a la firefox advanced settings?

4. Adding Custom Color Effects to Camera

5. Newbie help, please.

6. Periodic update of surface

7. Marketplace download failure -- anybody else seen this?