How to passing data from a website to Android Application

Quickly share your Android Code Snippets here...

How to passing data from a website to Android Application

Postby mona2010 » Sun Jan 10, 2010 8:03 am

Hi,

I could not find anything about this in Android Sdk. I would like to know is there a way to pass values from my website(php based) to an Android application????

for example: if x=2 , is my variable and its data and if I want to pass x from my website to my android app...


Please guide me in this regard, any tutorial or article that can help.....
mona2010
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Jan 10, 2010 7:34 am

Top

Postby Draffodx » Mon Jan 11, 2010 3:28 pm

most books on Android have a section about communicating through HTTP check one of them out
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby Johan Degraeve » Mon Jan 11, 2010 3:38 pm

You could first define an xml layout for example

<result><x>5</x></result>

on your php server you have a page called mypage.php

with contents

<?php
$x = ... you assign a value to x ..;

echo "<result><x>" .$x."</x></result>";
?>

your android app makes a call to http://domain-name/mypage.php

and gets as result "<result><x>5</x></result>"
parse the result and you have the value of x in your app


or if your php page is generating HTML (ie a page which is normally displayed via a browser) you can do the same but then you'll have the parse the HTML and search for the specific values you're looking for
regards,

Johan
Johan Degraeve
Experienced Developer
Experienced Developer
 
Posts: 55
Joined: Tue Oct 27, 2009 1:50 pm
Location: Belgium

Hi

Postby prazannag » Sat Feb 06, 2010 8:30 am

You should refer some concepts related to "Web Services". through which you can transfer the data between the applications over web.

Regards,

Praz
Praz
User avatar
prazannag
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Feb 05, 2010 7:34 pm
Location: India

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 7 guests