get value from database

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

get value from database

Postby rmeph » Mon Dec 24, 2007 3:12 pm

plz help to get value from database
i want "work" address in contacts application to my application..........i used PACKAGE:->com.google.android.providers.contacts
TABLE:->contacts_methods
and table fields is (_id INTEGER PRIMARY KEY,person INTEGER ,kind INTEGER,data TEXT,aur_data TEXT, type INTEGER,label TEXT) in that table i want only "work" address.and "work" address stroed in data field
how to write that query???? :?: :(
IN coding im write query
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.   locationText=(EditText) findViewById(R.id.location);
  2.          Location = locationText.getText().toString();
  3.          Cursor managedCursor = managedQuery(android.provider.Contacts.ContactMethods.CONTENT_URI,null, android.provider.Contacts.ContactMethods.DATA=Location,null);          
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


but that show error........
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby hugopicado » Tue Dec 25, 2007 3:39 am

Hi.

I guess you are saying something but your code is saying something else:
Do you want the people that have a given work address or you just want a list of work addresses ?

For the first case you should write something like:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Cursor managedCursor = managedQuery(
  3.  
  4.      android.provider.Contacts.ContactMethods.CONTENT_URI,
  5.  
  6.      null,
  7.  
  8.      "data LIKE '" + Location + "'",
  9.  
  10.      null);
  11.  
  12.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


On the second case, the code become something like:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Cursor managedCursor = managedQuery(
  3.  
  4.      android.provider.Contacts.ContactMethods.CONTENT_URI,
  5.  
  6.      new String[] {"data"},
  7.  
  8.      null,
  9.  
  10.      null);
  11.  
  12.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


Hope to be helpful.

Regards,
Hugo.
hugopicado
Freshman
Freshman
 
Posts: 8
Joined: Fri Dec 14, 2007 2:31 am

Postby rmeph » Tue Dec 25, 2007 8:25 am

u see in contacts application .it's have different address home address,work address..........all is stored in Table(contacts_methods) in different _id,person and kind ......i want only work address...how to get that?
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 22 guests