开发者

How to Retrieve the data from the server

After the successful connection to the server(my local host),i want to retrieve the data that server sends to me. Can anyone pleas开发者_如何学Ce suggest me what should i do for this? After receiving that data, i have to store it into an Array and then have to fetch it one by one into the dropdown list.

Thanks


Sheetal i have not worked with any application with server,but i retrieved data locally and then placed it in an array and showed in the spinner, this might help u

Cursor c = db.fetchAllReminders();
            startManagingCursor(c); 

            // Create an array to specify the fields we want (only the TITLE)
            String[] from = new String[]{DataManager.NAME}; 
            // and an array of the fields we want to bind in the view
            int[] to=new int[] { android.R.id.text1 };
//         to[0]=android.R.id.text1;

             final Spinner spinner = (Spinner) this.findViewById(R.id.spins);


            // Now create a simple cursor adapter and set it to display
            final SimpleCursorAdapter reminders =new SimpleCursorAdapter(this,
                    android.R.layout.simple_spinner_item, c, from, to); 
            spinner.setAdapter(reminders);  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜