主界面包括上述的功能选项
同时向用户提示你的当前用户信息
package com.example.tiwen20;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.StrictMode;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button shangbao_bt;
private Button qiehuan_bt;
private Button zhuce_bt;
private Button quanbutiwen_bt;
private Button shengchengbiao_bt;
private Button tongji_bt;
private Button MPandroid_bt,Map_bt,Map_bt1;
private Intent i,m,n,o,k,x,y,q,p;
private String name,classes;
private String str_location;
private Handler handler_location = new Handler();
private Toast toast;
private List<TiwenBean> list;
private TiwenDB tiwenDB;
private List<TiwenBean> listMPandroid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState) ;
setContentView(R.layout.activity_main);
initTiwen();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy( builder.build() );
}
}
private void initTiwen() {
shangbao_bt = (Button) this.findViewById(R.id.bt_shangbao);
qiehuan_bt = (Button) this.findViewById(R.id.bt_qiehuan);
zhuce_bt = (Button) this.findViewById(R.id.bt_zhuce);
quanbutiwen_bt = (Button) this.findViewById(R.id.bt_quanbutiwen);
shengchengbiao_bt = (Button) this.findViewById(R.id.bt_shengchengbiao);
tongji_bt = (Button) this.findViewById(R.id.bt_tongji);
MPandroid_bt = (Button) this.findViewById(R.id.bt_MPandroid);
Map_bt = (Button)this.findViewById(R.id.bt_Map);
Map_bt1 = (Button)this.findViewById(R.id.bt_Map1);
zhuce_bt.setOnClickListener(this);
shangbao_bt.setOnClickListener(this);
qiehuan_bt.setOnClickListener(this);
quanbutiwen_bt.setOnClickListener(this);
shengchengbiao_bt.setOnClickListener(this);
tongji_bt.setOnClickListener(this);
MPandroid_bt.setOnClickListener(this);
Map_bt.setOnClickListener(this);
Map_bt1.setOnClickListener(this);
}
public String getTime(){
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
Date curDate = new Date();
String str = format.format(curDate);
return str;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.bt_shangbao:
i = new Intent(this, addActivity.class);
i.putExtra("time",getTime());