我想向我的微调器添加提示。
我从数据库中获取了微调器,并且在选择微调器中的微调器显示提示之前需要。如何在微调器中添加提示?
这是我的代码:
spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String name = spinner1.getSelectedItem().toString()
//edittext1.setText(name)
spin1 = spinner1.getSelectedItem().toString().trim()
String idnya = spin1.substring(0,spin1.indexOf('-'))
Log.e("spin",""+spin1)
setSpinner2(idnya)
spinner2.setVisibility(View.VISIBLE)
// set spinner pertama (1)
public void setSpinner1(String koddeee) {
connect = CONN(un, passwords, db, ip)
String query1 = "select id,namabarang from Jenis_Barang where nomorjenis = '"+koddeee+"' "
Log.e("query",""+query1)
try {
connect = CONN(un, passwords, db, ip)
stmt = connect.prepareStatement(query1)
rs = stmt.executeQuery()
ArrayList<String> data = new ArrayList<String>();
while (rs.next()) {
id = rs.getString(1)
String nama = rs.getString(2)
data.add(id+"-"+nama)
}
String[] array = data.toArray(new String[0])
ArrayAdapter NoCoreAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, data)
spinner1.setAdapter(NoCoreAdapter);
} catch (Exception e) {
e.printStackTrace()
Log.e("errora",""+e.getMessage())