请教一个关于Android开发的问题,困扰很久了
在src文件下的MainActivity代码如下packagecom.example.sample3;importandroid.net.Uri;importandroi...
在src文件下的MainActivity代码如下
package com.example.sample3;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.*;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.*;
public class MainActivity extends Activity {
Button b;
Button b2;
EditText et;
WebView wv;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b=(Button)this.findViewById(R.id.b);
b2=(Button)this.findViewById(R.id.b2);
et=(EditText)this.findViewById(R.id.et);
wv=(WebView)this.findViewById(R.id.wv);
b.setOnClickListener(
new OnClickListener(){
public void onClick(View v){
String url=et.getText().toString();
wv.loadUrl(url);
} });
b2.setOnClickListener(
new OnClickListener(){
public void onClick(View v){
String url=et.getText().toString();
Uri uri=Uri.parse(url);
Intent intent=new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}});}}
代码中的id全部都有错误提示,
提示如下
b2 cannot be resolved or is not a field
et cannot be resolved or is not a field
wv cannot be resolved or is not a field
b cannot be resolved or is not a field
我应该怎样修改 展开
package com.example.sample3;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.*;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.*;
public class MainActivity extends Activity {
Button b;
Button b2;
EditText et;
WebView wv;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b=(Button)this.findViewById(R.id.b);
b2=(Button)this.findViewById(R.id.b2);
et=(EditText)this.findViewById(R.id.et);
wv=(WebView)this.findViewById(R.id.wv);
b.setOnClickListener(
new OnClickListener(){
public void onClick(View v){
String url=et.getText().toString();
wv.loadUrl(url);
} });
b2.setOnClickListener(
new OnClickListener(){
public void onClick(View v){
String url=et.getText().toString();
Uri uri=Uri.parse(url);
Intent intent=new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}});}}
代码中的id全部都有错误提示,
提示如下
b2 cannot be resolved or is not a field
et cannot be resolved or is not a field
wv cannot be resolved or is not a field
b cannot be resolved or is not a field
我应该怎样修改 展开
3个回答
展开全部
系统文件损坏了 重新找一个固件刷 找不到原生的文件不好改 最好找一个刷
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询