创建项目,先把主界面搞出来
package com.example.helloworld;import static com.example.helloworld.util.DateUtil.getTime;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private TextView result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView result=findViewById(R.id.result);
Button checkallbill=findViewById(R.id.checkAllBill);
Button addbill=findViewById(R.id.addBill);
Button over=findViewById(R.id.over);
over.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this, CreateData.class);
startActivity(intent);
}
});
addbill.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,AddBill.class);
startActivity(intent);
}
});
checkallbill.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,CheckAllBill.class);
startActivity(intent);
}
});
}
@Override
public void onClick(View v) {
}
}
功能够简洁,也够用了(正经家庭谁记账啊
标签:安卓,new,Intent,应用,import,Override,intent,日记,View From: https://www.cnblogs.com/dddjm/p/18029440