0
我帶wifi指紋的室內定位系統中,我要存儲在arrryList具體BSSID的水平我想這個代碼,但它似乎沒有工作如何在ArrayList中存儲WiFi的級別<Integer>?
public class calibrate2 extends AppCompatActivity {
WifiManager wifimanager2;
Button cali;
Button reset;
//EditText Tx;
//EditText Ty;
TextView textView;
TextView textView2;
List<ScanResult> list;
Integer j,x,i=0;
ArrayList<String> Ap=new ArrayList<>();;
ArrayList<Integer> si=new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calibrate2);
Ap = getIntent().getStringArrayListExtra("ap");
cali = (Button) findViewById(R.id.button);
reset = (Button) findViewById(R.id.button2);
textView= (TextView)findViewById(R.id.textView);
textView2= (TextView)findViewById(R.id.textView2);
// Tx = (EditText) findViewById(R.id.editText);
// Ty = (EditText) findViewById(R.id.editText2);
wifimanager2 = (WifiManager) getSystemService(Context.WIFI_SERVICE);
cali.setOnClickListener(
new View.OnClickListener() {
public void onClick(View view) {
wifimanager2.startScan();
list = wifimanager2.getScanResults();
for (j = 0; j < Ap.size(); j++) {
for (i = 0; i < list.size(); i++) {
if (list.get(i).BSSID == Ap.get(j)) {
si.add(list.get(i).level);
break;
}
}
for (j = 0; j < Ap.size(); j++) {
textView2.append(si.get(j).toString());
textView2.append(" /n");
}
}
}
}
);
}}
我想這個問題是在for循環的工作因爲活動是可以正常使用,但每當我點擊按鈕,它關係到父活動
你裏面的主for循環'的(加同爲環Ĵ = 0; j
是的,因爲我想要它的順序與Ap的順序完全相同 –