hold everything you intend to put in there?
Doug
On Feb 2, 8:54 am, sisko <adeod...@gmail.com> wrote:
> Hi guys,
>
> I am experimenting with locations and listviews. I am getting location
> results back and I am trying to create a listview of my locations
> results using the following code:
>
> ListView locationList = (ListView)findViewById(R.id.ListView01);
> String[] items = new String[]{};
>
> try {
> Geocoder geocoder = new Geocoder(this, Locale.getDefault());
> List<Address> addresses = geocoder.getFromLocation(LATITUDE,
> LONGITUDE, 5);
> address_textview.setText( ""+addresses );
>
> Address[] addresses_array = new Address[addresses.size()];
> addresses.toArray(addresses_array);
>
> for( int i = 0; i < addresses_array.length; i++ ){
> items[i] = addresses_array[i].getPostalCode();
> }
>
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
> R.layout.list_item, items);
> locationList.setAdapter(adapter);
>
> My problem is, when I try to write into my items array ( items[i] =
> addresses_array[i].getPostalCode(); ) in the forloop, my application
> crashes.
>
> Can anyone please help. I am stuck at this point.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment