package com.example.yangguoying;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.TabHost;
import android.widget.Toast;
import com.example.yangguoying.SqLiteDatabase.GetDatabase;
import com.example.yangguoying.adapter.StudentInfoAdapter;
import com.example.yangguoying.adapter.ViewPagerAdapter;
import com.example.yangguoying.datasource.DataSource;
import com.example.yangguoying.entity.StudentInfo;
import com.example.yangguoying.util.JDBC.JDBCAPI.JDBCUtilImpl;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class MainActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener{
ImageButton edit_button;
SharedPreferences.Editor dataEdit;
SharedPreferences getDataEdit;
Button main_add_student_info;
ListView main_student_info_list;
StudentInfoAdapter studentInfoAdapter;
List<StudentInfo> list;
DataSource dataSource;
JDBCUtilImpl jdbcUtil;
GetDatabase database;
SQLiteDatabase sqLiteDatabase;
Cursor cursor;
StudentInfo studentInfo;
ContentValues contentValues;
ProgressDialog progressDialog;
Button view_one_button;
Button view_tow_button;
LinearLayout view_one_line;
LinearLayout view_tow_line;
Button cloud_view_button;
List<StudentInfo> cloud_list;
ListView cloud_view_list;
StudentInfoAdapter cloudStudentInfoAdapter;
private LayoutInflater layoutInflater;
private ViewPager viewPager;
private ViewPagerAdapter viewPagerAdapter;
private List<View> viewList;
private View viewOne;
private View viewTow;
private int curIndex = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
setView();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode){
case 1:
onLoadStudentInfo();
break;
case 2:
case 4:
case 6:
studentInfoAdapter.notifyDataSetChanged();
break;
}
}
private void initView() {
edit_button = findViewById(R.id.edit_button);
dataEdit = getSharedPreferences("user_data",MODE_PRIVATE).edit();
getDataEdit = getSharedPreferences("user_data",MODE_PRIVATE);
main_add_student_info = findViewById(R.id.main_add_student_info);
// main_student_info_list = findViewById(R.id.main_student_info_list);
dataSource = new DataSource();
jdbcUtil = new JDBCUtilImpl(dataSource.getConnectionUrl(),dataSource.getDatabaseUser(),dataSource.getDatabasePassword(),"com.mysql.jdbc.Driver");
database = new GetDatabase();
sqLiteDatabase = database.getDatabase(this).getWritableDatabase();
contentValues = new ContentValues();
progressDialog = new ProgressDialog(MainActivity.this);
view_one_button = findViewById(R.id.view_one_button);
view_tow_button = findViewById(R.id.view_tow_button);
view_one_line = findViewById(R.id.view_one_line);
view_tow_line = findViewById(R.id.view_tow_line);
layoutInflater = LayoutInflater.from(this);
viewList = new ArrayList<>();
viewPager = findViewById(R.id.view_pager);
viewOne = layoutInflater.inflate(R.layout.local_database_view,null);
viewTow = layoutInflater.inflate(R.layout.cloud_database_view,null);
viewList.add(viewOne);
viewList.add(viewTow);
viewPagerAdapter = new ViewPagerAdapter(viewList);
viewPager.setAdapter(viewPagerAdapter);
viewPager.setCurrentItem(curIndex);
viewPager.setOffscreenPageLimit(2);
viewPager.addOnPageChangeListener(this);
main_student_info_list =viewOne.findViewById(R.id.main_student_info_list);
onLoadStudentInfo();
cloud_view_button = viewTow.findViewById(R.id.cloud_view_button);
cloud_view_list = viewTow.findViewById(R.id.cloud_view_list);
cloudStudentInfoAdapter = new StudentInfoAdapter(MainActivity.this,cloud_list);
}
private void setView() {
main_student_info_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(MainActivity.this,ShowStudentInfoActivity.class);
intent.putExtra("id",list.get(position).getId());
intent.putExtra("isCloud",false);
startActivityForResult(intent,2);
}
});
main_add_student_info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, AddStudentInfoActivity.class);
startActivityForResult(intent, 1);
finish();
}
});
main_student_info_list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("提示");
builder.setMessage("确认删除学生信息");
builder.setPositiveButton("删除", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//TODO 删除本地数据
sqLiteDatabase.delete("student_info","student_info_id = ?",new String[]{String.valueOf(list.get(position).getId())});
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
AlertDialog.Builder builder_delete_cloud = new AlertDialog.Builder(MainActivity.this);
builder_delete_cloud.setTitle("提示");
builder_delete_cloud.setMessage("是否删除云数据信息");
builder_delete_cloud.setPositiveButton("删除", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//TODO 删除云数据
new Thread(new Runnable() {
@Override
public void run() {
jdbcUtil.deleteData("DELETE FROM `student_info` WHERE `student_info_id` = ?",new Object[]{list.get(position).getId()});
deleteBefore(position);
}
没有合适的资源?快使用搜索试试~ 我知道了~
Android Studio实现学生信息管理系统源码.zip
共124个文件
xml:45个
png:45个
java:17个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 3 下载量 170 浏览量
2022-12-23
16:46:57
上传
评论 2
收藏 11.15MB ZIP 举报
温馨提示
Android Studio实现学生信息管理系统源码.zip 连接阿里云数据库实现对学生信息的增删改查,登录密码也采用了MD5加密的方式,更加注重用户隐私安全。该学生信息管理系统具有添加学生信息的功能、删除学生信息的功能、修改学生信息功能和查询学生信息的功能。 Android Studio实现学生信息管理系统源码.zip 连接阿里云数据库实现对学生信息的增删改查,登录密码也采用了MD5加密的方式,更加注重用户隐私安全。该学生信息管理系统具有添加学生信息的功能、删除学生信息的功能、修改学生信息功能和查询学生信息的功能。 Android Studio实现学生信息管理系统源码.zip 连接阿里云数据库实现对学生信息的增删改查,登录密码也采用了MD5加密的方式,更加注重用户隐私安全。该学生信息管理系统具有添加学生信息的功能、删除学生信息的功能、修改学生信息功能和查询学生信息的功能。 Android Studio实现学生信息管理系统源码.zip 连接阿里云数据库实现对学生信息的增删改查,登录密码也采用了MD5加密的方式,更加注重用户隐私安全。该学生信息管理系统具有添加学生信息的功能、删除学
资源推荐
资源详情
资源评论
收起资源包目录
Android Studio实现学生信息管理系统源码.zip (124个子文件)
gradlew.bat 2KB
.gitignore 208B
.gitignore 6B
build.gradle 1KB
build.gradle 530B
settings.gradle 47B
gradlew 5KB
mysql-connector-java-5.1.48.jar 983KB
gradle-wrapper.jar 53KB
MainActivity.java 24KB
ModifyInfoActivity.java 12KB
AddStudentInfoActivity.java 8KB
LoginActivity.java 8KB
ShowStudentInfoActivity.java 8KB
JDBCUtilImpl.java 6KB
RegisterActivity.java 5KB
StudentInfo.java 4KB
StudentInfoAdapter.java 4KB
JDBCUtil.java 3KB
SolveEditTextScrollClash.java 2KB
StudentInfoDatabase.java 1KB
ViewPagerAdapter.java 1KB
DataSource.java 765B
ExampleInstrumentedTest.java 760B
ExampleUnitTest.java 384B
GetDatabase.java 258B
zanwu.jpg 30.61MB
register.jpg 186KB
login_background.jpg 171KB
avatar.jpg 6KB
.name 11B
appicon.png 21KB
ic_launcher_round.png 16KB
avatarlist.png 14KB
upload_icon-playstore.png 13KB
noupload_icon-playstore.png 12KB
ic_launcher_round.png 12KB
no_upload_icon-playstore.png 12KB
upload_icon_round.png 11KB
noupload_icon_round.png 11KB
ic_launcher.png 10KB
edit_icon-playstore.png 10KB
upload_icon_round.png 8KB
upload_icon.png 8KB
ic_launcher.png 8KB
ic_launcher_round.png 7KB
noupload_icon_round.png 7KB
no_upload_icon.png 7KB
ic_launcher_round.png 5KB
upload_icon_round.png 5KB
ic_launcher.png 5KB
noupload_icon_round.png 5KB
upload_icon.png 5KB
phone.png 4KB
noupload_icon.png 4KB
ic_launcher.png 4KB
upload_icon_round.png 4KB
upload_icon.png 3KB
ic_launcher_round.png 3KB
noupload_icon_round.png 3KB
add_data.png 3KB
noupload_icon.png 3KB
edit_icon.png 3KB
password.png 3KB
account.png 3KB
ic_launcher.png 3KB
left_back_write.png 3KB
upload_icon.png 2KB
upload_icon_round.png 2KB
noupload_icon_round.png 2KB
noupload_icon.png 2KB
edit.png 2KB
upload_icon.png 2KB
noupload_icon.png 2KB
upload_icon.png 1KB
noupload_icon.png 1KB
proguard-rules.pro 750B
gradle.properties 1KB
gradle-wrapper.properties 232B
activity_modify_info_activity.xml 12KB
activity_add_student_info.xml 12KB
activity_show_student_info.xml 11KB
ic_launcher_background.xml 5KB
activity_login.xml 4KB
Project.xml 3KB
activity_main.xml 3KB
student_info_item.xml 3KB
activity_register.xml 3KB
ic_launcher_foreground.xml 2KB
AndroidManifest.xml 1KB
jarRepositories.xml 1KB
nav_bar_main.xml 1003B
nav_bar_modifyinfo.xml 995B
nav_bar_addinfo.xml 995B
nav_bar_show.xml 987B
nav_bar_register.xml 982B
cloud_database_view.xml 813B
gradle.xml 796B
border_line.xml 743B
upload_icon_foreground.xml 677B
共 124 条
- 1
- 2
程序员张小妍
- 粉丝: 1w+
- 资源: 3474
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页