When I run this program I get this error . I don't know how to solve . Help me finding it Please.
This is my json_encode php code api.
$i=0;
while ($row = $result->fetch_assoc())
{
$array[$i]=array(
"news_id" => $row["news_id"],
"news_title" => $row["news_title"],
"news_abstract" => $row["news_abstract"],
"news_content" => $row["news_content"],
"news_date" => $row["news_date"],
"news_link" => $row["news_link"],
"news_image_link" => $row["news_image_link"],
"sources_name" => $row["sources_name"],
"category_name" => $row["category_name"],
"news_visible" => $row["news_visible"]
);
$i++;
}
$json=json_encode($array, JSON_HEX_TAG|JSON_HEX_APOS);
and my JsonArrayRequest of Android Volley JsonArrayRequest.
JsonArrayRequest newsRequest = new JsonArrayRequest( Url.getUrlJson(), new Response.Listener<JSONArray>(){
@Override
public void onResponse( JSONArray response ){
Log.d( TAG, response.toString() );
hidePDialog();
// Parsing json
for( int i = 0; i < response.length(); i++ ){
try{
JSONObject obj = response.getJSONObject( i );
News news = new News();
if( "1".equals( obj.getString( "news_visible" )) ){
news.setNews_id( obj.getString( "news_id" ) );
news.setNews_title( obj.getString( "news_title" ) );
news.setNews_abstract( obj.getString( "news_abstract" ) );
news.setNews_content( obj.getString( "news_content" ) );
news.setNews_date( obj.getString( "news_date" ) );
news.setNews_link( obj.getString( "news_link" ) );
news.setNews_image_link( obj.getString( "news_image_link" ));
news.setSources_name( obj.getString( "sources_name" ) );
news.setCategory_name( obj.getString( "category_name" ) );
}
newsList.add( news );
}
catch( JSONException e ){
e.printStackTrace();
}