1
내 Wi-Fi를 따르기 위해 브로드 캐스트 수신기를 만들었습니다. LogCat에서 normaly 정보를 얻었지만 ListView에 데이터를 넣을 수 없습니다. 는 내가 onReceive
방법을 테스트하는리스트 뷰 예제를 넣어하지만 난 작동하지 않았다, 나는이 오류가 있어요 :Android : ListView의 BroadcastReceiver 표시
public class Wifi extends Activity implements OnClickListener{
/** Called when the activity is first created. */
WifiManager wifi;
Button enab;
String resultsString ;
String[] myStringArray;
public class Receiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
}
ListView listView ;
// Get ListView object from xml
listView = (ListView) findViewById(R.id.listView1);
// Defined Array values to show in ListView
String[] values = new String[] { "Android List View",
"Adapter implementation",
"Simple List View In Android",
"Create List View Android",
"Android Example",
"List View Source Code",
"List View Array Adapter",
};
//getting this error : The constructor ArrayAdapter<String>(Wifi.Receiver, int, int, //String[]) is undefined
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, android.R.id.text1, values);
listView.setAdapter(adapter);
}
}
PS :이 내 코드입니다
The constructor ArrayAdapter(Wifi.Receiver, int, int, String[]) is undefined
을 때 나는 그것이 정상적으로 작동 onCreate
메서드에 ListView의 코드를 넣어,하지만 난 onReceive
메서드에서 그것을 원한다.
감사합니다! 당신은 내 생명을 구했어. :) 효과가있어 : D – Amina
@Amina 나는 7 가지 질문을 받아들이지 않았다. 대답 옆에있는 체크를 클릭하여 답을 수락하십시오. http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Raghunandan
설명을 주셔서 감사합니다. – Amina