Original Poster Posted February 23, 2013 Share Posted February 23, 2013 I have this bit of code and I am trying to get it working ... can you help me with the issues I have? which is to do with the R.layout... also point out any tips or hints on where to improve? I am just playing around at the moment getting used to it package com.example.webu;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import android.os.Bundle;import android.app.Activity;import android.content.Context;import android.view.Menu;import android.widget.ListView;import android.widget.SimpleAdapter;import android.widget.TextView;import android.net.ConnectivityManager;import android.net.NetworkInfo;import android.net.wifi.ScanResult;import android.net.wifi.WifiManager;public class MainActivity extends Activity {SimpleAdapter adapter;ArrayList<HashMap<String, String>> arraylist = new ArrayList<HashMap<String, String>>();@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); NetworkInfo at = cm.getActiveNetworkInfo(); final TextView tni = (TextView)findViewById(R.id.textView1); ListView lv = (ListView)findViewById(R.id.listView1); WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); if(wifi.isWifiEnabled()) { List<ScanResult> scanResults = wifi.getScanResults(); for(ScanResult scanRes : scanResults) { this.adapter = new SimpleAdapter(MainActivity.this, arraylist, R.layout.rowLayout, new String[] { ITEM_KEY }, new int[] { R.id.list_value }); lv.setAdapter(this.adapter); //tni.setText(scanRes.toString()); } } //tni.setText(at.toString());}@Overridepublic boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true;}}[/CODE] Link to comment Share on other sites More sharing options...
0 Hardcore Til I Die Posted March 6, 2013 Share Posted March 6, 2013 You want help with a problem, but you haven't said what the problem is. I'm at a loss.... :( Link to comment Share on other sites More sharing options...
0 Detection Posted March 6, 2013 Share Posted March 6, 2013 Doesn't Eclipse highlight and hint on the problem ? Link to comment Share on other sites More sharing options...
0 Original Poster Posted March 28, 2013 Author Share Posted March 28, 2013 Doesn't Eclipse highlight and hint on the problem ? nope lol I fixed this issue so long ago I have actually forgotten what the problem was :p Detection 1 Share Link to comment Share on other sites More sharing options...
Question
Original Poster
I have this bit of code and I am trying to get it working ... can you help me with the issues I have? which is to do with the R.layout... also point out any tips or hints on where to improve? I am just playing around at the moment getting used to it
Link to comment
Share on other sites
3 answers to this question
Recommended Posts