My issue is quite simple I think :
I would like to be able to add a contact to the contact list by a simple click on a button (and be able to test it on the emulator). The data of this contact would be stored in the source code of the application.
is there an easy way of doing that?
thank you for your answers
The only easy way to insert a contact is to use an INSERT action, where you supply some of the data and start up an activity for the user to provide the rest and confirm adding it to the contacts list. Here is a sample project demonstrating this.
Related
I have a contact picker in my application that keeps crashing when a facebook contact is selected. I won't have the code I'm using to open the picker in front of me, but I believe I'm accessing the contacts through a call similar to this:
new Intent(Intent.ACTION_PICK, People.CONTENT_URI)
Does anyone have experience with this?
i wish i had an answer for you but i posted 2 similar questions without any good answers. seems like a totally reasonable question and easy to do in most other dev environments (im actually a c# developer) but android has got me stuck on this. i think i may just have to write my "own contact picker" so that i can test for the fact that the contact has a number before adding them to the picker list programmatically.
anyways, my questions are here:
How do get the android sdk contact picker to give me just phone results and not all my twitter followers
how do i get startActivityForResult() to bring up just a list of telephone contacts (like when i click on the "People" icon) using the android sdk?
in my app i am testing that the phone gets returned from the picked contact before trying to send it a message (so mine doesnt crash), but i dont want the user to have to see a "that contact doesnt have a number" message if they dont have to.
i found this too:
http://mobile.dzone.com/news/contacts-api-20-and-above
while it DOESNT show you how to filter the contact list, it does show how to programmatically create a list that has only contacts with numbers. write back on my questions if you find anything that could be useful, thanks!
I am trying to add these functionality in my Android app:
1) Get A list of suggested contacts from a Web Service and Display them in a list view
- This I have implemented and working fine
2) When User selects any of these contacts I want to present them in Native Contact View. My fried who is iPhone developer was able to do this with help of ABPerson class which provides feature to display the contact in native contact view page without adding the contact to contact list. I am not able to find any such API in Andoid. Please suggest.
3) When User want to edit any contact in the above list, I am able to present Edit Contact activity from native Phone Book app. This is working fine, but I am not able to remove the Done and Revert button. Unfortunately due to this, if user click on Done that contact is added to phone, however, what I want to do here is that, user can modify the data and I will keep it in the memory till the export process starts. During the export process I will insert these records in the Phone Book.
Please suggest me how can I do this.
I would advise you look over the BusinessCard sample and ContactManager sample posted on the Android developer site.
Reading carefully through both of these is what helped me understand exactly what's going on in the contacts API.
i am trying to develop a simple application. i want to create a simple message and want to save it. now, i want to select message from list of messages which i have created and stored.
can any one please suggest me or give an idea for developing the same.
Thanks in Advance
If you substitute the word "message" for "note", you are describing something really similar to the notepad example.
It runs you step by step trough the code you need to make an application that has notes (messages) you can add, and open.
If you are new to Android development you should go trough all the excersises, because it's a really good help, but if you're not you can just download the sollution and use that.
I feel you should go like this:
Have your application store Contacts in a database (I guess you're already doing this)
Have your application store messages in another database (I guess you're already doing this too)
In the UI, display all the messages inside a ListView, by querying them from your message database.
When user clicks on any message, have another screen that loads this message in full, and lets the user select the recipients
Send the text message to the selected recipients now
I just wanted to point out the flow of the app, since the storage and retrieval process os pretty straight forward. I am not sure if this was what you were looking for.
Do let me know.
If you will store little amount of data you can use sharedpreferences
http://developer.android.com/reference/android/content/SharedPreferences.html
If you want a real solution that is sqlite database that comes with android.
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
so I'm a very new to the android development so please bear with me. I am attempting to create an app that will connect with a database of course listings for students and allow them to select their degree and choose their required courses and which semesters to take them in.
I would like to know how to allow a user to select an ImageButton (which is essentially a course), have it call another activity where they can edit the course information based off of information from the database, and have it return to the original activity with the information for that button stored into it. If anyone can help regarding how I can even approach this that would be great. Thanks in advance!
Use setOnClickListener to bind a click listener to your button. Use startActivityForResult/setResult/onActivityResult to start the next activity/return data/handle data. Here's an older tutorial about doing that.
I'm pretty sure it's not viable to do what I'd like to based on some initial research, but I figured it couldn't hurt to ask the community of experts here in case someone knows a way.
I'd like to create a custom field for contacts that the user is able to edit from the main Contacts app; however, the user should only be allowed to select from a list of four specific values. A short list of string values would be ideal, but an int with a min/max range would suffice.
I'm interested in knowing if it's possible either way, but also wondering if it make sense to go this route performance wise. More specifically, would it be better to look up a contact (based on a phone number) each time a call or SMS message is received or better to store my own set of data (consisting of name, numbers, and the custom field) and just syncing contact info in a thread every so often? Or syncing contacts the first time the app is run and then registering for changes using ContentObserver?
Here is a similar question with an answer that explains how to add a custom field to a contact.
Thanks in advance.
I don't see the purpose to have your own set of data against contacts stored in your separate database, as you obviously will run into sync issues. You can use the mimetype and store whatever you want against the contact, in the manner you linked.
Whenever you want to looup contacts you can do that by using your custom mimetype. You get the contact id (from ContactsContract.Data.CONTENT_URI), and then you run another query to get the contact details (from ContactsContract.Contacts.CONTENT_URI). Please note these are different tables.
I'd like to create a custom field for contacts that the user is able to edit from the main Contacts app
I don't see that possible, editable from the main app, when you use your custom mimetypes, and you don't have much options here. The main contact app will display only the fields that are in SDK. You can store details against contacts but they won't show up in the inbuilt edit contact screen.