“android.view.View is deprecated” - what else to use or how to fix?

余生颓废 提交于 2019-12-24 13:33:07

问题


I have just started trying out Android Studio, following the instructions on a video tutorial.

Here is my take on what the guy tells me but I keep getting the error message View is deprecated.

How do I fix this? Or what do I use instead?

Here is my code:

public class MainActivity extends AppCompatActivity {

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

    Button sendButton0001 = (Button) findViewById(R.id.buttonSend0001);
    EditText welcomeText = (EditText) findViewById(R.id.editTextWelcome);
    sendButton0001.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });
}

回答1:


This is just a warning. I don't know why it shows up, but if it runs fine - don't take care.



来源:https://stackoverflow.com/questions/50008555/android-view-view-is-deprecated-what-else-to-use-or-how-to-fix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!