在我的活动中,我有一个 TextView 和两个按钮校准和 wifi。这两个按钮都将转到扫描活动以获得一些结果。不同之处在于校准按钮会将结果保存到读数表,而 wifi 按钮会将结果保存到 wifi 表。但是这两个按钮都只能将其插入阅读表。
下面是活动课
calibrate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(db.getFriendlyWifis(building).isEmpty()) {
Context context = getApplicationContext();
CharSequence text = "Select one or more Friendly WiFi";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
else {
Intent intent = new Intent(getApplicationContext(), Scan.class);
intent.putExtra("POSITION_NAME", positionName.getText().toString());
intent.putExtra("isLearning", isLearning);
intent.putExtra("NUMBER_OF_SECONDS", readingCount);
startActivityForResult(intent, SCAN_REQUEST);
}
}
});
wifi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(db.getFriendlyWifis(building).isEmpty()) {
Context context = getApplicationContext();
CharSequence text = "Select one or more Friendly WiFi";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
else {
Intent intent = new Intent(getApplicationContext(), Scan.class);
intent.putExtra("POSITION_NAME", positionName.getText().toString());
intent.putExtra("isLearning", isLearning);
intent.putExtra("NUMBER_OF_SECONDS", readingCount);
startActivityForResult(intent, SCAN_REQUEST);
}
}
});
当年话下
相关分类