VolleyError null dönüyor
Merhaba
Uygulamamda Volley ile veri çekmeye çalışıyorum.Sorunum URL'ye bağlanmaktan ziyade veriyi çekememek.JsonArrayRequest oluştururken hata alıyorum.Nerede hata yapıyorum?
[code]EtkinlikActivity.java
package com.monat.bitirme.anamenu;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.monat.bitirme.MySQL.AppController;
import com.monat.bitirme.MySQL.JSONParser;
import com.monat.bitirme.R;
import com.monat.bitirme.adapter.EtkinlikTakvimiAdapter;
import com.monat.bitirme.model.Etkinlik;
import com.android.volley.AuthFailureError;
import com.android.volley.Request.Method;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.JsonObjectRequest;
public class EtkinlikTakvimiActivity extends Activity {
ListView lv;
private String jsonResponse;
private ProgressDialog pDialog;
TextView tv;
ArrayList<Etkinlik> etkinlikList;
private static String url_tum_etkinlikler = "http://10.0.3.2/Bitirme/get_tum_etkinlikler.php";
// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_ETKINLIKLER = "etkinlikler";
private static final String TAG_ID = "id";
private static final String TAG_AD = "ad";
private static final String TAG_YER = "yer";
private static final String TAG_TARIH = "tarih";
private static final String TAG_BASLANGIC_SAATI = "baslangicsaati";
private static final String TAG_BITIS_SAATI = "bitissaati";
JSONArray etkinlikler = null;
private RequestQueue mRequestQueue;
String TAG;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_etkinlik_takvimi);
tv=(TextView)findViewById(R.id.textView14);
etkinlikList = new ArrayList<Etkinlik>();
lv = (ListView) findViewById(R.id.lvEtkinlikTakvimi);
pDialog = new ProgressDialog(this);
pDialog.setMessage("Please wait...");
pDialog.setCancelable(false);
makeJsonArrayRequest();
}
private void makeJsonArrayRequest() {
showpDialog();
JsonArrayRequest req = new JsonArrayRequest(url_tum_etkinlikler,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d(TAG_ETKINLIKLER, response.toString());
try {
// Parsing json array response
// loop through each json object
jsonResponse = "";
for (int i = 0; i < response.length(); i++) {
JSONObject person = (JSONObject) response
.get(i);
String _id = person.getString("_id");
String ad = person.getString("ad");
String yer = person.getString("yer");
String tarih = person.getString("tarih");
String baslangicsaati = person.getString("baslangicsaati");
String bitissaati = person.getString("bitissaati");
jsonResponse += "Name: " + _id + "\n";
jsonResponse += "Email: " + ad + "\n";
jsonResponse += "Home: " + yer + "\n";
jsonResponse += "Mobile: " + tarih + "\n";
jsonResponse += "Mobile: " + baslangicsaati + "\n";
jsonResponse += "Mobile: " + bitissaati + "\n";
}
tv.setText(jsonResponse);
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(),
"Error: " + e.getMessage(),
Toast.LENGTH_LONG).show();
}
hidepDialog();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG_ETKINLIKLER, "Error: " + error.getMessage());
Toast.makeText(getApplicationContext(),
"ee"+error.getMessage(), Toast.LENGTH_SHORT).show();
hidepDialog();
}
});
// Adding request to request queue
AppController.getInstance().addToRequestQueue(req);
}
private void showpDialog() {
if (!pDialog.isShowing())
pDialog.show();
}
private void hidepDialog() {
if (pDialog.isShowing())
pDialog.dismiss();
}
}
[/code]
AppController.java
[code]package com.monat.bitirme.MySQL;
import android.app.Application;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
public class AppController extends Application {
public static final String TAG = AppController.class.getSimpleName();
private RequestQueue mRequestQueue;
private static AppController mInstance;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized AppController getInstance() {
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}[/code]