Today !!! Yes, that's today. Well, I finally switched my cell phone to La la, and the four sons got it... although it is a second-hand goods, but his father also does not sell, can only buy second-hand goods, five son that convex camera and the price is a bit difficult to swallow. Well... the new machine is a must. First, it is necessary to restore the factory settings and brush the machine. It is android4.4.2. It is said that the cut card is a variety of egg pain, plug in did not respond, with the roommate's MX3 SIM is also inserted in, no response. Then, Baidu Google, the answer is that the card was cut because the magnetic stripe was too large, and the metal on both sides of the card was hit.Solution:The two metal strips of the SIM card can be pressed on both sides of the card tray and pasted with tape. It must be accurate and should not be too small. This is a meticulous activity .... well, it's very meticulous. It took just an hour ....
Okay, let's startQuestion:
I have encountered a problem.Delete more than 200 contacts from the SIM cardWhy ??? The android native version does not seem to support managing SIM card contacts. You only have the option to export contacts from the SIM card.
I don't seem to like software very much, except for the necessary software. Today, QQ is inexplicably stolen, and I am panic. The software is even more difficult (although it should not be a problem with the mobile Phone software, but before playing on Windows Phone 8, what is the tricky version of the pixel bird, the result accidentally clicked the advertisement, two minutes later, a friend called and sent a message. :( Well, the formal entry into the subject:Solution: Write a small tool for managing contacts.No.
Then Baidu Google began to look for information, as shown below:Http://blog.csdn.net/voiceofnet/article/details/7760323
Http://blog.csdn.net/qq435757399/article/details/7947847
The two links must be used together.
First, add the permission:This is very important. I always forget it. As a result, I always report errors and have two permissions: "read permission and write permission":
I operate under Fragment, so the code is slightly different:
Second, the xml layout file:
Java file:
@ Override public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {// inflate the layout View view = inflater. inflate (R. layout. fragment_text, null); textView = (TextView) view. findViewById (R. id. textView); btnSelect = (Button) view. findViewById (R. id. btnSelect); btnDelete = (Button) view. findViewById (R. id. btnDelect); btnSelect. setOnClickListener (new View. onC LickListener () {@ Override public void onClick (View v) {// I found that opening a thread still blocks the UI thread. I don't know why, do I? Do I need to use AsyncTask? Or Handler. // Because I am busy playing with my new mobile phone, I will not go into details for the moment. Haha, I 've been thinking about it for more than a year. New Thread (new Runnable () {@ Override public void run () {SimQuery (); // execute the query operation }}). start (); textView. setText (messageString) ;}}); btnDelete. setOnClickListener (new View. onClickListener () {@ Override public void onClick (View v) {new Thread (new Runnable () {@ Override public void run () {SimDelete (); // perform the delete operation }}). start (); textView. setText ("deleted successfully! ") ;}}); Return view ;}
Query and delete contacts:
Private void SimQuery () {// The provider of SIM is IccProvider, And the Uri of IccProvider is content: // icc/adn Uri = uri. parse ("content: // icc/adn"); Cursor cursor = getActivity (). getContentResolver (). query (uri, null, null); Log. v ("MAIN", "-----------" + cursor. getCount (); while (cursor. moveToNext () {String id = cursor. getString (cursor. getColumnIndex (People. _ ID); String name = cursor. getString (cursor. getColumnIndex (People. NAME); String phoneNumber = cursor. getString (cursor. getColumnIndex (People. NUMBER); messageString + = "id:" + id + "name:" + name + "phoneNumber:" + phoneNumber + "\ n \ r"; Log. v ("MAIN", "--- >>>> _ id:" + id + "--- >>>> name:" + name + "--- >>> phone number: "+ phoneNumber +" \ n \ r ");} cursor. close (); // be sure to close} private void SimDelete () {Uri uri = Uri. parse ("content: // icc/adn"); Cursor cursor = getActivity (). getContentResolver (). query (uri, null, null); Log. v ("MAIN", "------------- >>>>" + cursor. getCount (); while (cursor. moveToNext () {String name = cursor. getString (cursor. getColumnIndex (People. NAME); String phoneNumber = cursor. getString (cursor. getColumnIndex (People. NUMBER); String where = "tag = '" + name + "'"; where + = "AND number = '" + phoneNumber + "'"; getActivity (). getContentResolver (). delete (uri, where, null);} cursor. close (); // be sure to close}
About
Modify contacts and insert contactsFor more information, see the step-by-step link. If you need this, I will write it. However
Who needs it?... Unless you change to a function machine with a black or white screen, you will need to use a SIM card contact. Otherwise, on the smart machine, we will back up the backup for you everywhere. It's also Google backup and pods, what is QQ synchronization assistant? People back up pictures, and SIM does not support portraits. It sets a contact profile for a long time and does not work in the SIM card, and a name corresponds to a number. If there are multiple numbers under a name, copy and paste them .... well... no more. Keep a good mood.
We can finally see our house over the weekend.
SisterNow, I am very happy. The best thing about the bubble library. I haven't told her about the purchase of a mobile phone yet, and she will be scolded.
Oh, let's add a new one. Today, I got SlidingMenu, which is quite interesting. I plan to use this as my second application. It is called "Mr. Fu ".
Http://my.eoe.cn/kris/archive/1605.html http://my.eoe.cn/kris/archive/1688.html
Recently read books: Android programming is a little difficult... especially for Java. Is Java so difficult?... a little worried.
PS: I'm very happy. I went to the home page and had a picture showing the truth:
Give link to: http://blog.csdn.net/fu222cs98/article/details/21053491
Mr. Fu: Study Notes
Thank you for your reprinting.