package com.example.sub_find;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.WindowDecorActionBar;
import com.example.sub_find.Utils.JDBCUtils;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
public class line extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
ArrayList<String> queryResults = new ArrayList<>();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_line);
Button button1 = findViewById(R.id.button1);
Button button2 = findViewById(R.id.button2);
Button button3 = findViewById(R.id.button3);
Button button4 = findViewById(R.id.button4);
Button button5 = findViewById(R.id.button5);
Button button6 = findViewById(R.id.button6);
Button button7 = findViewById(R.id.button7);
Button button8 = findViewById(R.id.button8);
Button button9 = findViewById(R.id.button9);
Button button10 = findViewById(R.id.button10);
Button button11 = findViewById(R.id.button11);
Button button12 = findViewById(R.id.button12);
Button button13 = findViewById(R.id.button13);
Button button14 = findViewById(R.id.button14);
Button button15 = findViewById(R.id.button15);
Button button16 = findViewById(R.id.button16);
Button button17 = findViewById(R.id.button17);
Button button18 = findViewById(R.id.button18);
Button button19 = findViewById(R.id.button19);
Button button20 = findViewById(R.id.button20);
Button button21 = findViewById(R.id.button21);
Button button22 = findViewById(R.id.button22);
Button button23 = findViewById(R.id.button23);
Button button24 = findViewById(R.id.button24);
// 为每个按钮设置点击事件
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 1");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 2");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
// 添加更多按钮的点击事件处理,以此类推
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 3");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 4");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 5");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 6");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 7");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button8.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 8");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button9.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 9");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button10.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 10");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button11.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 11");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button12.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 12");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button13.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 13");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button14.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 14");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button15.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 15");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button16.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 16");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button17.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 17");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button18.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 18");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button19.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 19");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button20.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 20");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button21.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 21");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button22.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 22");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button23.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 23");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
button24.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new Runnable() {
@Override
public void run() {
performLineQuery("SELECT site FROM sub_find WHERE line = 24");
}
}).start();
Intent intent = new Intent();
//前一个(MainActivity.this)是目前页面,后面一个是要跳转的下一个页面
intent.setClass(line.this, cout_res.class);
startActivity(intent);
}
});
}