GreyWang1
GreyWang1
2017-11-03 00:03

Android开发 eclipse ...cannot be resolved

  • android
  • eclipse

Android 新人
[code=java]package com.example.ex03_01;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.Button;

public class MainActivity extends Activity {
private TextView txt;
private EditText edit;
private Button myButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt= (TextView)findViewById(R.id.textView1);
edit= (EditText)findViewById(R.id.editText1);
myButton= (Button)findViewById(R.id.button1);
myButton.setOnClickListener(new mClick());
}
}
class mClick implements OnClickListener{
public void onClick(View v){
String inputStr;
inputStr=edit.getText().toString();
txt.setTxt(inputStr);
}
}[/code]
报错: edit cannot be resolved ; txt cannot be resolved;
warning: The value of the field MainActivity.edit (txt) is not used.
res中并没有相关报错。。网上没找着对应的原因和解决方法 应该不是版本问题
图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐

换一换