android studio - How can I disable PICK_CONTACT_REQUEST -



android studio - How can I disable PICK_CONTACT_REQUEST -

i working on branding pre-packaged application, , has contact selector alternative need disable since serves no purpose us. it's single user search using personal address. have found article on how add together here: http://apiminer.org/doc/guide/components/activities.html

they listed code this:

private void pickcontact() { // create intent "pick" contact, defined content provider uri intent intent = new intent(intent.action_pick, contacts.content_uri); startactivityforresult(intent, pick_contact_request); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // if request went (ok) , request pick_contact_request if (resultcode == activity.result_ok && requestcode == pick_contact_request) { // perform query contact's content provider contact's name cursor cursor = getcontentresolver().query(data.getdata(), new string[] {contacts.display_name}, null, null, null); if (cursor.movetofirst()) { // true if cursor not empty int columnindex = cursor.getcolumnindex(contacts.display_name); string name = cursor.getstring(columnindex); // selected contact's name... } } }

i want disable this. can remove images folder calling them from, still leaves active corner. poor usability leave way. have tried commenting , deleting these mentions code, , throws 2-3 errors.

this homeactivity.java file displays code:

package com.votinginfoproject.votinginformationproject.activities; import android.app.loadermanager; import android.content.cursorloader; import android.content.intent; import android.content.loader; import android.database.cursor; import android.net.uri; import android.os.bundle; import android.provider.contactscontract; import android.support.v4.app.fragmentactivity; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.edittext; import com.google.android.gms.analytics.googleanalytics; import com.votinginfoproject.votinginformationproject.r; import com.votinginfoproject.votinginformationproject.fragments.homefragment; import com.votinginfoproject.votinginformationproject.models.vipapp; import com.votinginfoproject.votinginformationproject.models.vipappcontext; import com.votinginfoproject.votinginformationproject.models.voterinfo; public class homeactivity extends fragmentactivity implements homefragment.oninteractionlistener, loadermanager.loadercallbacks<cursor> { static final int pick_contact_request = 1; vipapp app; uri contacturi; edittext addressview; loadermanager loadermanager; public string getselectedparty() { homecoming selectedparty; } public void setselectedparty(string selectedparty) { this.selectedparty = selectedparty; app.setselectedparty(selectedparty); } string selectedparty; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); app = new vipappcontext((vipapp) getapplicationcontext()).getvipapp(); loadermanager = getloadermanager(); selectedparty = ""; contacturi = null; addressview = (edittext)findviewbyid(r.id.home_edittext_address); // analytics tracker (should auto-report) app.gettracker(vipapp.trackername.app_tracker); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.home, menu); homecoming true; } @override protected void onstop() { super.onstop(); //stop analytics tracking googleanalytics.getinstance(this).reportactivitystop(this); } @override protected void onstart() { super.onstart(); //get analytics tracker study app starts, uncaught exceptions, etc. googleanalytics.getinstance(this).reportactivitystart(this); } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); homecoming id == r.id.action_settings || super.onoptionsitemselected(item); } public void ongobuttonpressed(view view) { intent intent = new intent(this, viptabbaractivity.class); startactivity(intent); } public void onselectcontactbuttonpressed(view view) { // contact picker intent homecoming address; show contacts have address intent intent = new intent(intent.action_pick, contactscontract.commondatakinds.structuredpostal.content_uri); startactivityforresult(intent, pick_contact_request); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // check request we're responding if (requestcode == pick_contact_request) { // create sure request successful if (resultcode == result_ok) { // user picked contact. // intent's info uri identifies contact selected. // uri points selected contact contacturi = data.getdata(); // restart loader, if contact selected loadermanager.destroyloader(pick_contact_request); // start async query contact info loadermanager.initloader(pick_contact_request, null, this); } else { // pass (user didn't pick address) } } } public void searchedaddress(voterinfo voterinfo) { // set voterinfo object on app singleton app.setvoterinfo(voterinfo, selectedparty); } @override public loader<cursor> oncreateloader(int id, bundle args) { if (contacturi == null) { homecoming null; } string[] projection = { contactscontract.commondatakinds.structuredpostal.formatted_address }; homecoming new cursorloader(this, contacturi, projection, null, null, null); } @override public void onloadfinished(loader<cursor> loader, cursor data) { if (data.getcount() > 0) { data.movetofirst(); // result single column, named data1 string address = data.getstring(0); log.d("homeactivity", "got cursor result: " + address); // set address found in view addressview.settext(address); // initate search new address homefragment myfragment = (homefragment)getsupportfragmentmanager().findfragmentbyid(r.id.home_fragment); myfragment.makeelectionquery(); } else { log.e("homeactivity", "cursor got no results!"); } } @override public void onloaderreset(loader<cursor> loader) { // pass } }

does have solution this?

android-studio android

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -