android - "the type new View.OnClickListener(){} must implement the inherited abstract method View.OnClickListener.OnClick(View) -


I am going through an introductory tutorial for Android Dev and I do not understand this error.

The error is on the line "callButton.setOnClickListener" (New OnClickListener () {"

Yes I know that the code has been written badly and is a bit confusing,

I am trying to add a button that opens the contact list and allows you to call .com.example.contactpicker;

< Pre> import android.os.bundle; import android .app.activity; import android.view.Menu; import android.content.ContentUris; import android.content.Intent; import android.database.Cursor; Import android.net.Uri; In android.os.Bundle; Import android provider. Contact, Import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract; import android.view.MenuInflater; import android.view.View; Import Android.view.View.OnClickListener; Import android.widget.button; Import. Lecture View; Public Category Expansion of ContactPickerTester Activity {Public Stable FINAL End PICK_CONTACT = 1; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.activity_contact_picker_tester); Button Button = (Button) Find VVBIID (R.B. button 1); Button.setOnClickListener (New OnClickListener) Click on Public Zero (see _view) {intent = new intent (Intent.ACTION_PICK, Uri. Similarities ("Content: // contact /"); startActivityForResult (intent, PICK_CONTACT) ;}}); Button insertContactButton = (button) findViewById (R.id.button2); InsertContactButton.setOnClickListener (New OnClickListener () {@Override Click Public Zero (see V) {insertContactWithIntent ();}}); } Private Zero InclusionControl Power () {// Intention of intentions / intentions to enter a new contact using intestines (Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI); StartActivity; Button call button = (button) Find VVBIID (R.B.ton3); CallButton.setOnClickListener (New OnClickListener) {@Override Click Public Zero (see V) {intent to myIntent = new intent (Intent.ACTION_DIAL, Uri.parse ("Content: // Contact /")); StartActivity (myIntent);}}); } @ Override public empty onactive results (intrecord, int res, intent data) {super. Nactivity Result (Records, Rescodes, Data); Switch (Rickcode) {case (PICK_CONTACT): {if (resCode == Activity. RESULT_OK) {Uri contactData = data.getData (); Cursor c = managed query (contact data, empty, null, empty, zero); C.moveToFirst (); String name = C.getString (c .getColumnIndexOrThrow (contact contact.DISPLAY_NAME)); TextView TV = (TextView) findViewById (R.id.selected_contact_textview); Tv.setText (name); } break; }}}}}

It's very easy, that's because you wrote OnClick with the upper case on "o" and This is a small case.

Then you have to change the line

  Public Zero onClick (see V) { 

by

 Click  Zero (see V) { 

Pay attention to the capital change.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -