Proxy for ContentProvider

Last Updated:

  1. Kammerer

    Kammerer New Member This Topic's Starter

    Mar 26, 2010
    Likes Received:
    Problem: I want to add automatic phone number formatting. It means: when user insert new phone number, or change existing number "1122334455" Android should save in database formated value "(112) 233-44-55" (like in the iPhone ;) ).
    As I read in Android Documentation has two fields "NUMBER" and "NUMBER_KEY". NUMBER means formated phone number to display in "Contacts" application while NUMBER_KEY contains only numbers.
    I can write an application which would iterate over all phones in the contacts database and reformat phone numbers. But I'd like to have automatic formating. For this purpose my application should handle write requests to Contacts database. And when some phone number is changed/inserted application should apply phone formating.
    I think this could be done using some sort of proxy for a Contacts ContentProvider. This proxy should pass regular requests to default Contacts ContentProvider and do some work on writing/inserting requests. Is there such a thing at android platform?

    Another solution is to rewrite existing class But this class differres for differrent Android versions. And some system update could brake my rewrited ContactsProvider.

    P.S. Sorry for my English. I hope idea is clear for you.


Share This Page