Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/384.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android eclipse错误TextView和EditView_Java_Android_Eclipse - Fatal编程技术网

Java Android eclipse错误TextView和EditView

Java Android eclipse错误TextView和EditView,java,android,eclipse,Java,Android,Eclipse,我叫马瑞克。 我来自波兰 我的项目有问题 java.lang.ClassCastException: android.widget.TextView cannot be cast andoid.widget.EditView 它在虚拟设备和我的设备上不起作用 对于我的学习发展来说,这是一个简单的项目 对不起我的英语 爪哇: xml: 请帮帮我 cylindr = (EditText)findViewById(R.id.cylindr); 应该是: cylindr = (EditText)

我叫马瑞克。 我来自波兰

我的项目有问题

java.lang.ClassCastException: android.widget.TextView cannot be cast andoid.widget.EditView
它在虚拟设备和我的设备上不起作用

对于我的学习发展来说,这是一个简单的项目

对不起我的英语

爪哇:

xml:


请帮帮我

cylindr = (EditText)findViewById(R.id.cylindr);
应该是:

cylindr = (EditText)findViewById(R.id.cylindry);

您当前使用了两次
R.id.cylindr
,同时使用了一个重复变量。你应使用:

cylindr = (TextView)findViewById(R.id.cylindr);
na = (TextView)findViewById(R.id.na);
litry = (TextView)findViewById(R.id.litry);
spalanie = (TextView)findViewById(R.id.spalanie);
obrot = (TextView)findViewById(R.id.obrot);
ok = (Button)findViewById(R.id.ok);
cylindry = (EditText)findViewById(R.id.cylindry); //this is the line that was wrong
obroty = (EditText)findViewById(R.id.obroty);
paliwo = (EditText)findViewById(R.id.paliwo);

不能同时使用
(TextView)findViewById(R.id.cylindr)
(EditText)findViewById(R.id.cylindr)
。这是哪种类型的?很高兴听到,欢迎来到SO!如果你的问题已经得到回答,请回答。另外,作为一个新用户,您可以自由地了解更多!
cylindr = (EditText)findViewById(R.id.cylindry);
cylindr = (TextView)findViewById(R.id.cylindr);
na = (TextView)findViewById(R.id.na);
litry = (TextView)findViewById(R.id.litry);
spalanie = (TextView)findViewById(R.id.spalanie);
obrot = (TextView)findViewById(R.id.obrot);
ok = (Button)findViewById(R.id.ok);
cylindry = (EditText)findViewById(R.id.cylindry); //this is the line that was wrong
obroty = (EditText)findViewById(R.id.obroty);
paliwo = (EditText)findViewById(R.id.paliwo);