DSC
DSC

Reputation: 9

Android - Issue with method findViewByID(int)

I am working on a simple conversion android application while following a somewhat antiquated youtube video (https://www.youtube.com/watch?v=3Nv6TV4cyFY), in the video the code that he creates works. However when I try to do the same I receive an error that states "cannot resolve method 'findViewByID(int)'. Below I have listed my code, any help would be greatly appreciated.

package converter.dschuele.com.converter;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final EditText editCent = (EditText) findViewByID(R.id.editCent);

    final EditText editInch = (EditText) findViewByID(R.id.editInches);

    Button buttonConvert = (Button)findViewById(R.id.buttonCalculate);

    buttonConvert.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
           double cent = Double.valueOf(editCent.getText().toString());
           double inch = cent * 0.393700787;
            editInch.setText(String.valueOf(inch));
        }
    });
}



}

Upvotes: 0

Views: 58

Answers (1)

Valentino
Valentino

Reputation: 2135

Try to replace findViewByID with findViewById

Upvotes: 1

Related Questions