Tag Archives: android

How to decode JSON values in my Android Aplication?

Questions: Hello guys I’m trying to decode a JSON value into my Android Application, But I’m not really sure What Am I doing wrong in my code… This is my PHP file: <?php … echo json_encode($mostrar_player); … ?> Which Will return me something like this: [“1″,”Admin”,”123″,”Adm”,”messages”,”0″] in my Android Application I need to put that… Read More »

How to return JSON Object from PHP to read from Android App

Questions: I have the following MySQL table. I need to send the dealer name from android app and send all matching rows to the app.I dont know how to set the php output.I know i should encode using json_encode(array(‘stuff’)); But i dont know how to format the data.Been checking http://www.w3schools.com/json/ It shows an example {“employees”:[… Read More »

can use httpClient in Android Studio?

Questions: i use httpClient to send data to php file like this php <?php echo $_POST[‘My_Data’]; ?> and i add <uses-permission android:name=”android.permission.INTERNET” /> to AndroidManifest.xml for connect internet. this is my main Activity SendActivity.java public class SendActivity extends ActionBarActivity { String myJSON; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_send); SendData(); } public void SendData(){… Read More »

Post values and upload Image to php server in android

Questions: I am trying to upload image from android phone to php server with additional values,the method is post my php file look like this if($_POST[‘val1’]){ if($_POST[‘val2’]){ if($_FILE[‘image’]){ …… } } }else{ echo “Value not found”; } I am doing is URL url=new URL(“http://www/……../myfile.php”); HttpURLConnection con=(HttpURLConnection) url.openConnection(); con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestMethod(“POST”);//Enable http POST con.setRequestProperty(“Connection”, “Keep-Alive”);… Read More »

Upload doc, pdf,xls etc, from android application to php server

Questions: I get stuck at that place and unable to send doc file to php server. I am using this code. Here is PHP code. if($_SERVER[‘REQUEST_METHOD’]==’POST’){ $image = $_POST[‘image’]; $name = $_POST[‘name’]; require_once(‘dbConnect.php’); $sql =”SELECT id FROM volleyupload ORDER BY id ASC”; $res = mysqli_query($con,$sql); $id = 0; while($row = mysqli_fetch_array($res)){ $id = $row[‘id’]; }… Read More »

Is there anyway to write android applications in PHP?

Questions: Is there anyway to write android applications in PHP? This page clearly mentions that Android apps should be written in Java. Just wondering if there is another way… http://developer.android.com/guide/topics/fundamentals.html Answers:

encoding/decoding of data between php/java for android

Questions: I have to decode a base64 encoded data received from a php server. The server uses ‘base64_encode’ to encode the data. In my android app, I use android.utils.Base64 class to do the decoding. original encrypted data = “†+Ü]M(‡=ñö” Base64 encoding data in php gives…… – “hisP3F1NBCgIAocQCD3x9g==” Base64 encoding data in android gives – “4oCgKw/DnF1NBCgIAuKAoRAIPcOxw7Y=”… Read More »