How to work with Cookies in Android? Please help! its urgent

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

How to work with Cookies in Android? Please help! its urgent

Postby Chri » Mon Sep 07, 2009 1:19 pm

Hi guys!

I want to start a connection with a server and for this i need cookies! But how i work with them?!
In time I´am using a code which make one Connection, get infos and close. But i want to keep the Connection open!

My current code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4.                 URL meineURL = new URL(http://ExampleUrl.com);
  5.  
  6.                 URLConnection connection = meineURL.openConnection();
  7.  
  8.                 meineVerbindung = (HttpURLConnection)connection;
  9.  
  10.                
  11.  
  12.        
  13.  
  14.                 httpCode = meineVerbindung.getResponseCode();
  15.  
  16.                 if(httpCode == HttpURLConnection.HTTP_OK)
  17.  
  18.                 {
  19.  
  20.                        
  21.  
  22.                         isServerResponse = meineVerbindung.getInputStream();
  23.  
  24.                         byte[] haeppchen = new byte[4096];
  25.  
  26.                         int dieAnzahl;
  27.  
  28.                         while((dieAnzahl= isServerResponse.read(haeppchen))>0)
  29.  
  30.                                 sbuf.append(new String(haeppchen,0,dieAnzahl));
  31.  
  32.                         tvSettingInfo.setText(sbuf.toString());
  33.  
  34.                         if(sbuf.toString().startsWith("user.login"))
  35.  
  36.                         {
  37.  
  38.                                 return true;
  39.  
  40.                         }
  41.  
  42.  
  43.  
  44.                 }
  45.  
  46.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


plz help me! I really need help!
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 2 guests