Android-dev.it Community

 
Annunci

:arrow: Benvenuto!, se non sei ancora un utente registrato: puoi registrati qui, oppure effettua il login
:arrow: Apri un forum sul tuo nuovo smartphone Android e collabora con noi! (dettagli)

www.agendadigitale.org
Image


Sponsor
It is currently Tue May 22, 2012 8:08 am

All times are UTC + 1 hour


 Topics   Replies   Views   Last post 
No new posts На интернет-витрине

by popowahgjfghjoiuyt on Sat May 19, 2012 2:25 pm in Amministrazione

0

12

Sat May 19, 2012 2:25 pm

popowahgjfghjoiuyt

No new posts Apri un forum sul tuo nuovo smartphone Android!

[ Go to page: 1, 2, 3 ]

by ReattileGar on Fri May 18, 2012 5:27 pm in Amministrazione

27

12514

Fri May 18, 2012 5:27 pm

ReattileGar

No new posts Новый: базы для хрумера - профессиональный софт для СЕО.

by Renatafe on Fri May 18, 2012 3:14 pm in Amministrazione

0

17

Fri May 18, 2012 3:14 pm

Renatafe

No new posts Pace is undoubtedly the vital affordable Jerseys Wholesale d

by barnettmmolive2012 on Wed May 16, 2012 7:36 am in Amministrazione

1

47

Wed May 16, 2012 7:36 am

barnettmmolive2012

No new posts Problema di compatibilità app

by deran on Tue May 15, 2012 10:44 am in Sviluppo e programmazione in Android

4

200

Tue May 15, 2012 10:44 am

deran




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Connessione HTTP di tipo Post
PostPosted: Mon May 10, 2010 1:10 pm 
Offline
User avatar

Joined: Tue Apr 20, 2010 10:20 am
Posts: 5
Cellulare Android: HTC Tattoo
Operatore: Wind
Punti Android: ?
Salve,
devo fare una connessione http in android e passare dei parametri con il metodo POST....come si fa???? HELP :help:


Top
 Profile  
 
 Post subject: Re: Connessione HTTP di tipo Post
PostPosted: Mon May 10, 2010 1:25 pm 
Offline
Moderatore
User avatar

Joined: Thu Jan 15, 2009 12:53 pm
Posts: 4653
Location: Valli di Lisciano!! (Ascoli Piceno)
Cellulare Android: HTC Desire
Operatore: Wind
Punti Android: 5239
putroppo io non posso aiutarti!ti consiglio nel caso non ti risponda nessuno,ti contattare verix,l'altro mod magari via PM!

_________________
HTC DESIRE ROOTED (no s-off)
Clockwork recovery
InsertCoin



MOTOROLA FLIPOUT ROOTED
No recovery (ancora per poco)
Rom original deblur 1.14.2



HTC G1 U.S.A ROOTED
Caution 2.2
SPL 1.33.2005
Recovery AmonRa



***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***

***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
 Post subject: Re: Connessione HTTP di tipo Post
PostPosted: Mon Jun 28, 2010 12:03 pm 
Offline
Moderatore
User avatar

Joined: Thu Dec 27, 2007 3:51 pm
Posts: 986
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 1320
drzoidberg83 wrote:
Salve,
devo fare una connessione http in android e passare dei parametri con il metodo POST....come si fa???? HELP :help:


Dalla tua richiesta, non ho ben capito se parti da zero oppure ti sei bloccato su qualche aspetto che non ti è chiaro...
Cmq, se ti serve un esempio, puoi partire da questo snippet di codice, forse ti è utile [***URLs are hidden from guests, please register and login to view the hyperlink***].
Code:
public void postData() {
    // Create a new HttpClient and Post Header
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://www.yoursite.com/script.php");

    try {
        // Add your data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("id", "12345"));
        nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);
       
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
    } catch (IOException e) {
        // TODO Auto-generated catch block
    }
}


Top
 Profile  
 
 Post subject: Re: Connessione HTTP di tipo Post
PostPosted: Thu May 26, 2011 3:30 pm 
Offline
User avatar

Joined: Fri May 20, 2011 2:54 pm
Posts: 2
Punti Android: ?
Anche io ho lo stesso problema,cioe non ho capito esattamente cosa significano le righe:

ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("year","1980"));

//http post
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://example.com/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
.......

Che classe è esattamente la classe NameValuePair?? e la classe UrlEncodedFormatEntity??
Grazie a tutti quelli che vorranno rispondermi!!


Top
 Profile  
 
 Post subject: Re: Connessione HTTP di tipo Post
PostPosted: Mon Jun 20, 2011 2:16 pm 
Offline
Moderatore
User avatar

Joined: Thu Dec 27, 2007 3:51 pm
Posts: 986
Cellulare Android: HTC Dream
Operatore: TIM
Punti Android: 1320
- NameValuePair non è una classe ma un nome (arbitrario) dell'oggetto di tipo ArrayList
- le info sulla classe UrlEncodedFormatEntity le trovi in: ***URLs are hidden from guests, please register and login to view the hyperlink***


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

Topic Tags

http, POST, snippet


All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
phpBB SEO

All trademarks and logos used in this site are of properties of their respective owners.