ListActivity

Put your problem here if it does not fit any of the other categories.

ListActivity

Postby smalltalk » Tue Feb 12, 2008 4:13 pm

Hello +-
I am going to rewrite a part of contact application. So i want to know more about listactivity (i read sample api in android packet but not enough).Please reply fast for me (i am hurry)
Thanks :)
smalltalk
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Feb 12, 2008 3:34 pm

Top

Postby plusminus » Tue Feb 12, 2008 4:16 pm

Hello smalltalk,

I haven't seen a question yet, but I'll try ;)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Available Contact Database

Postby smalltalk » Wed Feb 13, 2008 2:35 pm

Uhm, i'm sorry about vaguing(unclear). I see 'contact application ' has column 'work phone' and 'home phone'. But I can't get them, i only get mobile-phone. Please help me get 'work phone' and 'home phone'.Please reply fast(i'm hurry). :)
smalltalk
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Feb 12, 2008 3:34 pm

Postby plusminus » Wed Feb 13, 2008 3:15 pm

Hello smalltalk,

there is one Table: android.provider.Contacts.People which contains an Foreign key to the android.provider.Contacts.People.Phones-Table:
public static final String PREFERRED_PHONE_ID
The ID of the persons preferred phone number.

Type: INTEGER (foreign key to phones table on the _ID field)
Constant Value: "preferred_phone"


You will probably have to Join these two table or make a sub-query (two queries afterwards).

Also could find only that one number not all three :?
Perhaps if you join there will be up to three result-rows...

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby smalltalk » Wed Feb 13, 2008 3:34 pm

I'm sorry about your answer.
please tell me how to join 2 or more tables.Please reply fast(i'm hurry)
smalltalk
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Feb 12, 2008 3:34 pm

Postby plusminus » Wed Feb 13, 2008 4:07 pm

Hello smalltalk,

it works like this: :arrow: http://www.w3schools.com/sql/sql_join.asp
Should be adoptable to your problem. If you cannot get the JOIN to work, get the results from table "A" do a projection on the specific line and send the "results" as a new query.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Postby smalltalk » Thu Feb 14, 2008 1:23 pm

Thanks +-.
I want to ask more. I want insert a record into "people table"(include phone number), but I only insert into people, I can't insert anything into "phones tables". I used getContentResolver.insert(...). Please give me an advice for insert into "phones tables".(I feel database on g-phone is complicated). Please reply fast, i'm hurry :(
smalltalk
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Feb 12, 2008 3:34 pm

Postby smalltalk » Thu Feb 14, 2008 1:29 pm

I'm sorry, I forget asking one thing.
I run notepadv3 in sample, first i run ok, but i removed app afterthat, i'just 'rerun'(run again) notepadv3 but android state "Can't create database". I don't know how to solve this problem.Please reply fast(i'm hurry)
ps:
I think you should create a forum about database in g-phone, and i wonder are you student as you said(i dont believe. How old are you). :shock:
smalltalk
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Feb 12, 2008 3:34 pm

Postby plusminus » Fri Feb 15, 2008 12:42 pm

smalltalk wrote:I'm sorry, I forget asking one thing.
I run notepadv3 in sample, first i run ok, but i removed app afterthat, i'just 'rerun'(run again) notepadv3 but android state "Can't create database". I don't know how to solve this problem.Please reply fast(i'm hurry)
ps:

Many database-problems appear when "reinstalling" an application, this can be ""fixed"" by running the emulator with "-wipe-data" once.
smalltalk wrote:I think you should create a forum about database in g-phone, and i wonder are you student as you said(i dont believe. How old are you). :shock:

There haven't been many database issues yet, but we will see.
20[sup]½[/sup] years :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

error solved for updating email field

Postby kajumit » Fri Mar 28, 2008 11:03 am

hi all,

In android m5 we have to use

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ContentValues values = new ContentValues();
  2.  
  3. Uri newPerson = null;
  4.  
  5. values.put(Contacts.People.NAME, alValue.get(listsize).toString());
  6.  
  7. newPerson = getContentResolver().insert(Contacts.People.CONTENT_URI, values);
  8.  
  9. values.clear();
  10.  
  11. values.put(Contacts.ContactMethods.PERSON_ID, newPerson.getLastPathSegment());
  12.  
  13. values.put(Contacts.ContactMethods.KIND, Contacts.ContactMethods.EMAIL_KIND);
  14.  
  15.                                         values.put(Contacts.ContactMethods.TYPE,Contacts.ContactMethods.EMAIL_KIND_PRIMARY_TYPE);
  16.  
  17. values.put(Contacts.ContactMethods.DATA, alValue.get(listsize).toString());
  18.  
  19. newPerson = getContentResolver().insert(Uri.withAppendedPath(newPerson, Contacts.ContactMethods.CONTENT_URI.getLastPathSegment()), values);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4




This code will update the email field.

Hope this helps u.

Regards,
Kajumit :D
User avatar
kajumit
Freshman
Freshman
 
Posts: 2
Joined: Sun Mar 16, 2008 10:38 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 14 guests