I want to show names of people on the listview in android through json

I am using asynctask through which i want to get json array of names and want to show in listview .
Here is my php code:

    $con=mysqli_connect("localhost","root","","raheel");

    $id=intval($_POST['id']);

   $mysqli_qry="select* from name where Name_id='$id'; ";


   $result=mysqli_query($con,$mysqli_qry)or die("Error Occur in Connection" . mysqli_error($con));

  $rowcount=mysqli_num_rows($result);

    $arr=Array();

    if($rowcount>0)
{

   while($row=mysqli_fetch_assoc($result))
   {


        $arr=$row;

    }



}
header('Content-Type: application/json');
echo json_encode($arr); 
mysqli_close($con

?>

The problem am facing is that how i will get the json array in asynctask mode and assign the data(names) to the listview
this is my Home.java code:
package com.example.raheel.bank;

public class Home extends AppCompatActivity implements HomeCallBack {

ListView listView;
private ListAdapter mAdapter;

 p public ArrayList<String > info;

@Override
 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);




    listView=(ListView)findViewById(R.id.Listview);


    int id=0;










}
BackgroundHome home=new BackgroundHome(Home.this, (Callback)Home. this);
@Override
public void processData(JSONArray data)
{

            if(data!=null)
            {
                info=new ArrayList<>();
                try
                {


                    for(int i=0;i<data.length();i++)
                    {

                        JSONObject js=data.getJSONObject(i);
                    }




                } catch (JSONException e) {
                    e.printStackTrace();
                }

            }
    mAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,info);
    listView.setAdapter(mAdapter);



}

}

 class BackgroundHome extends AsyncTask<Integer,Integer,JSONArray>{



Context c;
Callback callback;

public BackgroundHome(Context c, Callback callback) {
    this.c = c;
    this.callback = callback;
}

@Override
protected JSONArray doInBackground(Integer...params) {

    JSONArray js=null;

    String url=c.getString(R.string.url) +"Home.php";

    try {
        HttpRequest httpRequest = new HttpRequest(url);
        HashMap<String, String> values = new HashMap<>();
        values.put("id", Integer.toString(params[0]));
        js = httpRequest.prepare(HttpRequest.Method.POST).withData(values).sendAndReadJSONArray();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return js;
}

protected void onPostExecute(JSONArray jsonArray){

    HomeCallBack.processData(jsonArray);
}







}


interface HomeCallBack{

public void processData(JSONArray data);

 }

This the Home.java file but i dnt know how to get the json array of names from the php file.

You have to add data to the array like this. Modifying $arr = $row to $arr[] = .. will give you as result array with key/value data. json_encode later in your code will convert to json array needed by application.

while($row=mysqli_fetch_assoc($result))
       {
            $arr[] = array('name' => $row["Name"], 'id' => $row["Name_id"]);

       }

you have an error in last line of code , you didn’t close parenthesis

mysqli_close($con); // in your code => mysqli_close($con

and update your while loop like below:

$arr[] = $row;