How to Populate a listview with webservices (PHP/SOAP)?

Night! I'm sorry for my bad english but I wanna try to explain my question...

I have an app developed in Xamarin.Android and on this app I need to populate a listview with data from my online database, using web service created with php and nusoap. Below is the code in php and C#.

I wanna try to execute the select on my db and populate a array with data consulted, and populate my listview with this array.

Thx!

PHP:

$sql_motorista_vans_van_nome = "SELECT u.user_name FROM tb_user as u INNER JOIN tb_user_client AS c ON u.user_id = c.van_id WHERE c.user_id =           '$user_name'";
$query_user_items_list = mysql_query($sql_user_nome) or die;

            $results = array();

        while($row = mysql_fetch_assoc($query_user_items_list))
        {
                $results[] = $row;
        }


            return $results;

C#:

    ListUsers = FindViewById<ListView> (Resource.Id.lvUsers);
    ListUsersItems = new List<string>();
    string user;
    string[] item;

    user = MainActivity.user;
    int rows = Convert.ToInt32(webservicecav.cav_motorista_vans_list_rows(user));
    item = new string[rows];
    var testelist = new List<string> ();
    for (int i = 0; i < rows; i++) {
        item[i]= webservicecav.cav_motorista_vans_list_items(user);
        ListMotoristaAlunosItems.Add(item[i]);  
    }
ArrayAdapter<string> adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1, ListMotoristaAlunosItems);
ListMotoristaAlunos.Adapter = adapter;

Answers

Sign In or Register to comment.