parent
0e0e404192
commit
5d7b70b487
@ -0,0 +1,99 @@
|
||||
package edu.hzuapps.shudongapp;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class MainActivity extends AppCompatActivity{
|
||||
|
||||
static final int REQUEST_IMAGE_CAPTURE = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
MySQLiteOpenHelper dbHelper; //在软件一开始运行就实现好数据库的建立和表的创建
|
||||
dbHelper = new MySQLiteOpenHelper(this);
|
||||
dbHelper.getWritableDatabase();
|
||||
final MainActivity thisActivity = this;
|
||||
Button funcBtn1 = findViewById(R.id.button_func1);
|
||||
Button funcBtn2 = findViewById(R.id.button_func2);
|
||||
Button funcBtn3 = findViewById(R.id.button_func3);
|
||||
Button funcBtn4 = findViewById(R.id.button_func4);
|
||||
Button funcBtn5 = findViewById(R.id.button_func5);
|
||||
Button funcBtn6 = findViewById(R.id.buttonx);
|
||||
funcBtn1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(thisActivity, dongtai.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
funcBtn2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(thisActivity, chakan.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
funcBtn3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(thisActivity, delete.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
funcBtn4.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(thisActivity, internetdata.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
funcBtn5.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
|
||||
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
|
||||
}
|
||||
}
|
||||
});
|
||||
funcBtn6.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(thisActivity, niming.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
public void insertNameData (View view){
|
||||
Intent intent = new Intent(this, dongtai.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void queryData (View view){
|
||||
Intent intent = new Intent(this, chakan.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
public void deleteData (View view){
|
||||
Intent intent = new Intent(this, delete.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
protected void onActivityResult ( int requestCode, int resultCode, Intent data){
|
||||
ImageView funcBtn6 = findViewById(R.id.image_func6);
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
|
||||
Bundle extras = data.getExtras();
|
||||
Bitmap imageBitmap = (Bitmap) extras.get("data");
|
||||
funcBtn6.setImageBitmap(imageBitmap);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue