Recommended reading:
An analysis of Android phone defender SIM card binding
An in-depth analysis of the Android phone defender MD5 encryption when saving passwords
Detailed Android Phone Guardian Settings Wizard page
An analysis of Android phone defender turn off automatic Updates
A brief analysis of Android phone defender custom control properties
An analysis of Android phone defender reading contacts
Invokes the Setonitemclicklistener () method of the ListView object, setting the Click event for the entry, parameters: Onitemclicklistener Object
Using anonymous inner class implementations, overriding the OnClick () method, passing in Parameters: ListView, current View,position,id
Pass the current phone number back to the index location
Invokes the Get () method of the list object, gets the map, calls the Get (key) method, and gets the phone
Call the Setresult () method, return to the data, parameters: Response code, Intent object
Get Intent object, new out
Call the Intent object's Putextra (Key,val), put the phone in
Call Finish () method to close the current page
The activity that opens this is used by Startactivityforresult ()
Rewrite the Onactivityresult () method to pass in the intent object
Determine if the intent object is null
Call the Getstringextra () method of the intent object to get the phone number
Put the phone on the edittext and save it to the SP when you click Next
Activity
Package Com.qingguow.mobilesafe;
Import android.content.Intent;
Import android.content.SharedPreferences;
Import Android.content.SharedPreferences.Editor;
Import Android.os.Bundle;
Import Android.text.TextUtils;
Import Android.view.View;
Import Android.widget.EditText;
Import Android.widget.Toast; public class Secguide3activity extends Basesecguideactivity {private edittext et_sec_phone; private Sharedpreferences SP
; @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (
R.LAYOUT.ACTIVITY_LOST_FIND3);
Et_sec_phone = (edittext) Findviewbyid (R.id.et_sec_phone);
SP = getsharedpreferences ("config", mode_private);
String phone = sp.getstring ("Secphone", "");
Et_sec_phone.settext (phone); public void NextStep (view v) {Shownext ():} public void Prestep (view v) {showpre () @Override public void Showpre ()
{Intent Intent = new Intent (this, secguide2activity.class); startactivity (Intent); Finish ();} @Override public void Shownext() {String phone = Et_sec_phone.gettext (). toString (). Trim (); if (Textutils.isempty (phone)) {Toast.maketext (this, "
Please fill in the security number ", 1". Show ();
Return
} Editor Editor = Sp.edit ();
Editor.putstring ("Secphone", phone);
Editor.commit ();
Intent Intent = new Intent (this, secguide4activity.class);
StartActivity (Intent);
Finish (); /** * Select Contact person */public void selectcontacts (View v) {Intent Intent = new Intent (this, selectcontactsactivity.class); star
Tactivityforresult (Intent, 0); @Override protected void Onactivityresult (int requestcode, int resultcode, Intent data) {//TODO auto-generated method
Stub Super.onactivityresult (Requestcode, ResultCode, data);
if (data!= null) {String phone = Data.getstringextra ("Phone"). Replace ("-", ""). Replace ("", "");
Et_sec_phone.settext (phone); }
}
}
selectcontactsactivity
Package Com.qingguow.mobilesafe;
Import java.util.List;
Import Java.util.Map;
Import android.app.Activity;
Import android.content.Intent;
Import Android.os.Bundle;
Import Android.view.View;
Import Android.widget.AdapterView;
Import Android.widget.AdapterView.OnItemClickListener;
Import Android.widget.ListView;
Import Android.widget.SimpleAdapter;
Import Com.qingguow.mobilesafe.utils.PhoneContactsUtil; /** * Select Contact * @author Taoshihan * */public class Selectcontactsactivity extends activity {private ListView Lv_select_con
Tacts;
Private list<map<string,string>> contacts; @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (
R.layout.activity_select_contacts);
Lv_select_contacts= (ListView) Findviewbyid (r.id.lv_select_contacts);
Contacts=phonecontactsutil.getcontacts (this); Lv_select_contacts.setadapter New Simpleadapter (this, contacts, R.layout.select_contacts_item, new string[]{"name", "Phone"}, new Int[]{r.id.tv_coNtact_name,r.id.tv_contact_phone})); Lv_select_contacts.setonitemclicklistener (New Onitemclicklistener () {@Override public void Onitemclick (Adapterview
<?> arg0, View arg1, int position, long arg3) {String phone=contacts.get (position). Get ("phone");
Intent data=new Intent ();
Data.putextra ("Phone", phone);
Setresult (0, data);
Finish ();
}
}); }
}