亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

跟老師的一模一樣,但是使用this指針提示錯誤,麻煩大神解決一下


package com.example.calculate;




import android.app.Activity;

import android.content.DialogInterface;

import android.content.DialogInterface.OnClickListener;

import android.os.Bundle;

import android.view.Menu;

import android.view.MenuItem;

import android.widget.Button;

import android.widget.EditText;


public class MainActivity ?extends Activity implements OnClickListener{

? ? Button bt1;

? ? Button bt2;

? ? Button bt3;

? ? Button bt4;

? ? Button bt5;

? ? Button bt6;

? ? Button bt7;

? ? Button bt8;

? ? Button bt9;

? ? Button point;

? ? Button add;

? ? Button mulp;

? ? Button minus;

? ? Button divide;

? ? Button clear;

? ? Button delete;

? ? Button bt0;

? ? Button equal;

? ? EditText windows;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity2);

bt0=(Button) findViewById(R.id.bt0);

bt1=(Button) findViewById(R.id.bt1);

bt2=(Button) findViewById(R.id.bt2);

bt3=(Button) findViewById(R.id.bt3);

bt4=(Button) findViewById(R.id.bt4);

bt5=(Button) findViewById(R.id.bt5);

bt6=(Button) findViewById(R.id.bt6);

bt7=(Button) findViewById(R.id.bt7);

bt8=(Button) findViewById(R.id.bt8);

bt9=(Button) findViewById(R.id.bt9);

point=(Button) findViewById(R.id.point);

equal=(Button) findViewById(R.id.equal);

add=(Button) findViewById(R.id.add);

minus=(Button) findViewById(R.id.minus);

mulp=(Button) findViewById(R.id.mulp);

divide=(Button) findViewById(R.id.divide);

windows=(EditText)findViewById(R.id.windows);

}


private void setOnClickListener(MainActivity mainActivity) {

// TODO Auto-generated method stub

bt0.setOnClickListener(this);

bt1.setOnClickListener(this);

bt2.setOnClickListener(this);

bt2.setOnClickListener(this);

point.setOnClickListener(this);

bt3.setOnClickListener(this);

bt4.setOnClickListener(this);

bt5.setOnClickListener(this);

bt6.setOnClickListener(this);

bt7.setOnClickListener(this);

bt8.setOnClickListener(this);

bt9.setOnClickListener(this);

add.setOnClickListener(this);

minus.setOnClickListener(this);

mulp.setOnClickListener((this);

divide.setOnClickListener(this);

}


@Override

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.main, menu);

return true;

}


@Override

public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will

// automatically handle clicks on the Home/Up button, so long

// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();

if (id == R.id.action_settings) {

return true;

}

return super.onOptionsItemSelected(item);

}


@Override

public void onClick(DialogInterface dialog, int which) {

// TODO Auto-generated method stub

}

}

http://img1.sycdn.imooc.com//58a3b5390001887305970208.jpg

正在回答

2 回答

求采納!

0 回復 有任何疑惑可以回復我~

發現了,原來導錯包了

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android攻城獅的第一門課(入門篇)
  • 參與學習       312492    人
  • 解答問題       4931    個

想快速掌握Android應用開發基礎,選擇學習這門課程就對了。

進入課程

跟老師的一模一樣,但是使用this指針提示錯誤,麻煩大神解決一下

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號