Android: PHP / Java
wissem81
Messages postés
7
Statut
Membre
-
wissem81 Messages postés 7 Statut Membre -
wissem81 Messages postés 7 Statut Membre -
Bonjour,
j'essaye d'executer ce code
je dois récuperer des informations de la bdd mysql
en cliquant sur un item je passe sa position a la deuxième activity et cette derniere l'envoi au fichier php
voila mn code php
l'émulateur n'affiche rien
voici mon logcat
04-25 17:21:31.413: E/Zygote(33): setreuid() failed. errno: 2
04-25 17:21:43.044: E/Zygote(33): setreuid() failed. errno: 17
04-25 17:21:45.084: E/BatteryService(72): usbOnlinePath not found
04-25 17:21:45.084: E/BatteryService(72): batteryVoltagePath not found
04-25 17:21:45.084: E/BatteryService(72): batteryTemperaturePath not found
04-25 17:21:45.154: E/SurfaceFlinger(72): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
04-25 17:21:45.439: E/SensorService(72): couldn't open device for module sensors (Invalid argument)
04-25 17:21:52.183: E/System(72): Failure starting core service
04-25 17:21:52.183: E/System(72): java.lang.SecurityException
04-25 17:21:52.183: E/System(72):at android.os.BinderProxy.transact(Native Method)
04-25 17:21:52.183: E/System(72):at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-25 17:21:52.183: E/System(72):at android.os.ServiceManager.addService(ServiceManager.java:72)
04-25 17:21:52.183: E/System(72):at com.android.server.ServerThread.run(SystemServer.java:206)
04-25 17:21:52.223: E/EventHub(72): could not get driver version for /dev/input/mouse0, Not a typewriter
04-25 17:21:52.223: E/EventHub(72): could not get driver version for /dev/input/mice, Not a typewriter
04-25 17:21:52.964: E/SoundPool(72): error loading /system/media/audio/ui/Effect_Tick.ogg
04-25 17:21:52.973: E/SoundPool(72): error loading /system/media/audio/ui/KeypressStandard.ogg
04-25 17:21:52.983: E/SoundPool(72): error loading /system/media/audio/ui/KeypressSpacebar.ogg
04-25 17:21:52.993: E/SoundPool(72): error loading /system/media/audio/ui/KeypressDelete.ogg
04-25 17:21:53.013: E/SoundPool(72): error loading /system/media/audio/ui/KeypressReturn.ogg
04-25 17:21:53.065: E/UsbObserver(72): java.lang.NullPointerException
04-25 17:21:53.065: E/UsbObserver(72):at com.android.server.UsbObserver.init(UsbObserver.java:131)
04-25 17:21:53.065: E/UsbObserver(72):at com.android.server.UsbObserver.<init>(UsbObserver.java:65)
04-25 17:21:53.065: E/UsbObserver(72):at com.android.server.ServerThread.run(SystemServer.java:402)
04-25 17:21:53.803: E/ThrottleService(72): Could not open GPS configuration file /etc/gps.conf
04-25 17:21:55.593: E/logwrapper(165): executing /system/bin/tc failed: No such file or directory
04-25 17:21:55.653: E/logwrapper(166): executing /system/bin/tc failed: No such file or directory
04-25 17:21:55.693: E/logwrapper(167): executing /system/bin/tc failed: No such file or directory
et merci pour votre aide
j'essaye d'executer ce code
je dois récuperer des informations de la bdd mysql
en cliquant sur un item je passe sa position a la deuxième activity et cette derniere l'envoi au fichier php
voila mn code php
<?php
// array for JSON response
$response = array();
require_once __DIR__ . '/db_connect.php';
$db = new DB_CONNECT();
if (isset($_GET["id"])) {
//$id = $_GET['id'];
$result = mysql_query("SELECT *FROM modele WHERE id like '".$_GET["id"]."%'");
//$result = mysql_query("SELECT *FROM modele WHERE id =$id");
while($row=mysql_fetch_assoc($result))
$response[]=$row;
if (!empty($result)) {
// check for empty result
if (mysql_num_rows($result) > 0) {
$result = mysql_fetch_array($result);
$product = array();
$product["id"] = $result["id"];
$product["nom"] = $result["nom"];
$response["success"] = 1;
//$response["product"] = array();
//array_push($response["product"], $product);
echo json_encode($response);
package com.android.carousel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
public class vehicules extends ListActivity {
private ProgressDialog pDialog;
JSONParser jParser = new JSONParser();
ArrayList<HashMap<String, String>> vehiculesList;
private static String url_all_vehicule = "http://192.168.1.3/model/vehicule.php";
private static final String TAG_SUCCESS = "success";
private static final String TAG_MODELE = "modele";
private static final String TAG_ID = "id";
private static final String TAG_NOM = "nom";
JSONArray vehicules = null;
Intent i;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
vehiculesList = new ArrayList<HashMap<String, String>>();
ListView lv = getListView();
process();
}
private void process() {
Intent intent = getIntent();
String pid = intent.getStringExtra(TAG_ID);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair(TAG_ID, pid));
JSONObject json = jParser.makeHttpRequest(url_all_vehicule, "GET",
params);
Log.d("Allvehicules: ", json.toString());
try {
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
vehicules = json.getJSONArray(TAG_MODELE);
for (int i = 0; i < vehicules.length(); i++) {
JSONObject c = vehicules.getJSONObject(i);
String id1 = c.getString(TAG_ID);
String name = c.getString(TAG_NOM);
HashMap<String, String> map = new HashMap<String, String>();
map.put(TAG_ID, id1);
map.put(TAG_NOM, name);
vehiculesList.add(map);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
runOnUiThread(new Runnable() {
public void run() {
ListAdapter adapter = new SimpleAdapter(vehicules.this,
vehiculesList, R.layout.list_item, new String[] {
TAG_ID, TAG_NOM }, new int[] { R.id.pid,
R.id.name });
setListAdapter(adapter);
}
});
}
}
l'émulateur n'affiche rien
voici mon logcat
04-25 17:21:31.413: E/Zygote(33): setreuid() failed. errno: 2
04-25 17:21:43.044: E/Zygote(33): setreuid() failed. errno: 17
04-25 17:21:45.084: E/BatteryService(72): usbOnlinePath not found
04-25 17:21:45.084: E/BatteryService(72): batteryVoltagePath not found
04-25 17:21:45.084: E/BatteryService(72): batteryTemperaturePath not found
04-25 17:21:45.154: E/SurfaceFlinger(72): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
04-25 17:21:45.439: E/SensorService(72): couldn't open device for module sensors (Invalid argument)
04-25 17:21:52.183: E/System(72): Failure starting core service
04-25 17:21:52.183: E/System(72): java.lang.SecurityException
04-25 17:21:52.183: E/System(72):at android.os.BinderProxy.transact(Native Method)
04-25 17:21:52.183: E/System(72):at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-25 17:21:52.183: E/System(72):at android.os.ServiceManager.addService(ServiceManager.java:72)
04-25 17:21:52.183: E/System(72):at com.android.server.ServerThread.run(SystemServer.java:206)
04-25 17:21:52.223: E/EventHub(72): could not get driver version for /dev/input/mouse0, Not a typewriter
04-25 17:21:52.223: E/EventHub(72): could not get driver version for /dev/input/mice, Not a typewriter
04-25 17:21:52.964: E/SoundPool(72): error loading /system/media/audio/ui/Effect_Tick.ogg
04-25 17:21:52.973: E/SoundPool(72): error loading /system/media/audio/ui/KeypressStandard.ogg
04-25 17:21:52.983: E/SoundPool(72): error loading /system/media/audio/ui/KeypressSpacebar.ogg
04-25 17:21:52.993: E/SoundPool(72): error loading /system/media/audio/ui/KeypressDelete.ogg
04-25 17:21:53.013: E/SoundPool(72): error loading /system/media/audio/ui/KeypressReturn.ogg
04-25 17:21:53.065: E/UsbObserver(72): java.lang.NullPointerException
04-25 17:21:53.065: E/UsbObserver(72):at com.android.server.UsbObserver.init(UsbObserver.java:131)
04-25 17:21:53.065: E/UsbObserver(72):at com.android.server.UsbObserver.<init>(UsbObserver.java:65)
04-25 17:21:53.065: E/UsbObserver(72):at com.android.server.ServerThread.run(SystemServer.java:402)
04-25 17:21:53.803: E/ThrottleService(72): Could not open GPS configuration file /etc/gps.conf
04-25 17:21:55.593: E/logwrapper(165): executing /system/bin/tc failed: No such file or directory
04-25 17:21:55.653: E/logwrapper(166): executing /system/bin/tc failed: No such file or directory
04-25 17:21:55.693: E/logwrapper(167): executing /system/bin/tc failed: No such file or directory
et merci pour votre aide
A voir également:
- Android: PHP / Java
- Android recovery - Guide
- Begone android - Accueil - Protection
- Presse papier android - Guide
- À quoi sert google drive sur android - Guide
- Emulateur pokemon android - Guide
2 réponses
'lut, merci à toi d'avoir pensé à mettre ton code entre balises <code>, mais il y a quand même quelque chose qui cloche...
Le logcat que tu nous donnes n'évoque en rien un message provenant de ton application; si tu utilises Eclipse, utilise le filtre de log qui est créé automatiquement pour ton application pour sortir les bonnes infos.
Le logcat que tu nous donnes n'évoque en rien un message provenant de ton application; si tu utilises Eclipse, utilise le filtre de log qui est créé automatiquement pour ton application pour sortir les bonnes infos.