Questa è la richiesta POST:
codice:private void getData(){ String Nbusta = eTSearch.getText().toString().trim(); if (Nbusta.equals("")) { Toast.makeText(this,"Inserire Numero Busta",Toast.LENGTH_LONG).show(); return; } pdLoading = ProgressDialog.show(this,"Attendere","Caricamento",false,false); //Usiamo le preferenze ActivityPreferences SharedPreferences preferenze = PreferenceManager.getDefaultSharedPreferences(this); String ip= preferenze.getString("edit_text_InserisciIP","edit_text_InserisciIP"); String DATA_URLCASA = "http://"+ip+"/riparazioni/Get_un_prodotto.php?Nbusta="; String url = DATA_URLCASA + eTSearch.getText().toString().trim(); Log.d("Controllo_URL.....", url); final StringRequest stringRequest = new StringRequest(url, new Response.Listener<String>() { @Override public void onResponse(String response) { pdLoading.dismiss(); showJSON(response); Log.d("MYAPP", response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(MainActivity.this,error.getMessage().toString(),Toast.LENGTH_LONG).show(); } }); MySingleton.getInstance(this).addToRequestQueue(stringRequest); } private void showJSON(String response) { try { // response.replaceFirst("\\r\\n1",""); JSONObject jsonObject = new JSONObject(response); JSONArray result = jsonObject.getJSONArray(JSON_ARRAY); JSONObject collegaData = result.getJSONObject(0); String nBusta = collegaData.getString(KEY_NBUSTA); String costo = Servizi.lireToEuro(collegaData.getString(KEY_COSTO)); String pVendita = Servizi.lireToEuro(collegaData.getString(KEY_PVENDITA)); String pronto = collegaData.getString(KEY_BOOL_PRONTA); Log.d("e Prontaa",pronto); tVCodice.setText(nBusta); eTCosto.setText(costo); eTPVendita.setText(pVendita); //controllo per impostare checBok Pronta o No if(pronto == "true") { cBpronta.setChecked(true); }else { cBpronta.setChecked(false); }
Il Manifest:
codice:<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.paolo.myapplication"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Preferences" android:screenOrientation="portrait"></activity> </application> </manifest>

Rispondi quotando