我想在其他活动中显示 wifi 扫描的扫描结果,但是我这样做的方式使我的应用程序崩溃,谁能帮我在其他活动中显示扫描结果?// 这是我想要显示扫描结果的活动的代码
package com.example.wizerv1;
import java.util.ArrayList;
import android.net.wifi.ScanResult;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
public class AP_list extends Activity {
Wizer wifi;
CustomReceiver rcv;
TextView t1;
ListView list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ap_list);
t1=(TextView)findViewById(R.id.textView1);
list = (ListView) findViewById(R.id.listView1);
ArrayList<String> AP=new ArrayList<String>();
for (ScanResult result : rcv.results)
{
AP.add("AP :"+result.SSID);
}
ArrayAdapter<String> adp = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,AP);
list.setAdapter(adp);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_ap_list, menu);
return true;
}
}