I know how to retrieve, edit, or delet a contact from native contact list in android. I have certain task for each contact. I want when i click on the contact I want to know what is the task assigned to the object. Is there any way to assign any object to any contact. like we do setTag() and get Tag() for buttons or ImageView.
I didnt find any way to assign the object to the contact.
Thanks
You can't assign a plain object to a Contact but you can set custom data fields. This is done by creating a new Mime Type. Check out this answer for the specifics: How to add custom data/field in contacts in android 2.0?
Once you've created you're custom Mime Type, you can add and retrieve data associated with this type for any of your contacts.
And you can store any data in own database and use the LOOKUP KEY as foreign key to contacts database.
Related
Lets assume I have a List of String (ex: List<String>). I want to match all the Strings in the List to a particular attribute already present in the Firebase Database. How do I achieve this, as the equalTo() query only accepts a single String. I also don't want to generate as many queries as the List size. Any help would be much appreciated.
I would like to show my users a list of their contacts with a phone number. I tried to create a filtered list using the getAll method, but I found it too slow.
So I would like to allow the user to search for a name, and then I would return the contacts who name match the query. Is this possible in smartface?
Yes, it is possible.
You can use a repeatbox object in order to list contacts, and use a dataset for binding of that repeatbox. And when you write the appropriate sql statement(select) into that dataset, it will work for search.
Or you can search google for some search algorithms and use one of them. For example, you can use an editbox object, or a searchbar objects, and when its text is changed you can call your search function.
I am looking for some help to find a powerfull way to allow selection of different List items.
My case is that i have for exemple a List profiles, List teams ... and i'd like to have an autocomplete input that will show, for exemple if i type Al, all Teams and Profiles objects having there member variable name begining by Al.
The result would be that i could get from the activity, on submit click performed, a List & a List containing all the objects who have been selected through the autocomplete form.
Also i'd like that the list offered to the user that match the chars he typed show the name and a picture (facebook like tag selection).
Obviously i am not asking for some code but at least some guidelines from experienced Android devs who know what to do and not to do to create this kind of thing.
Thanks
Loader are one of the best way to filter list. You init a loader which take the String constraint used for filter, the each time the user type, you update the constraint and restart your Loader.
If I suppose that all your object are cached in a SQLite database you can use a CursorAdapter, Cursor and CursorLoader.
You create the needed CursorLoader by filter the query with the content of the EditText.
If you're not familiar with CursorLoader there is the AsyncTaskLoader, with this you won't have the need of DB and to code a provider which can accept raw query. Your object in ListA, ListB, etc must inherits of common class (hum... DataThing maybe :-)), you concatenate the objects in a list then you can filter the list : What is the best way to filter a Java Collection?
That's for the data filtering. Now in order to display the data the way you want, you can display of list below the EditText field or create a custom component if you want a more advanced look.
In my project I am getting the employee id values and employee names from the database. I am displaying the names of employees in listview. When I click on the name(here the name textview is a hyperlink) in the listview all the details of that particular employee will be displayed. Based on the employee id when we click on the name that employee details should display. Please help me how to do this in android.
For ex: In general we give like this ----http://sample.com?id=1
How to do that in android?
So based on your question and follow-up comment, what you're gonna want to do is as follows:
Grab the employee name and id as you have already done.
Make an Object that will hold both the employee name and id. Make a toString() method that will return the employee name as a String. The reason for this is because when the ListView is inflated, it defaults to calling the toString() method of its objects (each list entry). Make sure to also have a way to get the employee id from the Object via either a public getter or making the id a public variable itself.
Make the ListView's ArrayList use this Object and set it accordingly.
Then you must use onItemClick to query the site you were referencing in your question. However, when you do query this site, make sure to concatenate the employee id to the end of the URL. Do what you will once you query the site.
I have list of contacts with custom fields. I can display them in ListView sorting them
with respect to Displayname, which is not a custom field.
I need to display those contacts ordered/sorted by Company name which is a custom field.
I want to know if it is possible through androids API or should I go with my own manual sorting approach?
Contact tables format for Company field is:
MIMETYPE as INFO_BASIC, and column is Data.DATA4
Thanks in advance.
If you have to do it yourself, which I think you may, I suggest a Schwartzian Transformation.