开发者

how to upload selected contacts into a webserver

I want to upload the selected contacts (phonebook-android)into webs开发者_高级运维erver....can any one help me...please show me the code..thanks in advance


Ok, it is really based on what you are trying to accomplish. Are you trying to stream them as an XML file? Is this being uploaded to a database? Or is this just a simple text file that is going to an ftp server? These things matter a lot in the answer. Maybe make your post a little bit more clear. If you wanted to put them in a MySql database for example. You could use the java.sql library, which you can learn more about here: http://download.oracle.com/javase/tutorial/jdbc/basics/index.html

Now as for getting a list that you can select from and put into a data structure, I would use something like this from a previous post:

   Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
List contactlist = new ArrayList();
while(people.moveToNext()) {
   contactList.Add(people.getColumnIndex(PhoneLookup.DISPLAY_NAME));
   contactList.Add(people.getString(nameFieldColumnIndex));
   contactList.Add(people.getColumnIndex(PhoneLookup.NUMBER));
   contactList.Add(people.getString(nameFieldColumnIndex));
}

people.close();

Credit: Javier Figueroa

Pretty much use a content resolver to grab the name and number put into an array list then put them into a ListView, have the person select them and then from there use the transfer method of your choice.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜