[android-developers] Re: How to display an arraylist
Thanks again for your help Yusuf I can't say where it crashes because the logcat don't give me this information. For the tutorials i've done two of them. One with xml file and on without it. But i'm using a parsing XML to populate my listview and no one speak about it ... So i've done a mix with a tutorial of display arraylist without XML and a tutorial which teach to parse XML file from the net and return a table. But it's not work and i don't understand why. So if anyone see anythings wrong in the previous code i would like to know this Thanks a lot Sweet --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
Thanks Yusuf it's answer my question for a part. Now i've change type of ArrayListArraylist to ArrayListString and i nearly understand how display this in the theory but eclipse don't accepte your code. I don't understand why you wrote list in list.setAdapter and why you wrote this.android.R.layout.list_item, array_list instead of R.layout.list_item. Thanks again for your attention Sweet On 9 sep, 19:02, Yusuf Saib (T-Mobile USA) yusuf.s...@t-mobile.com wrote: I'm not sure how you want to display a list of lists. For that you might want some kind of tree widget, not a list view. But if you want to display a list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
Thanks Yusuf it's answer my question for a part. Now i've change type of ArrayListArraylist to ArrayListString and i nearly understand how display this in the theory but eclipse don't accepte your code. I don't understand why you wrote list in list.setAdapter and why you wrote this.android.R.layout.list_item, array_list instead of R.layout.list_item. Thanks again for your attention Sweet On 9 sep, 19:02, Yusuf Saib (T-Mobile USA) yusuf.s...@t-mobile.com wrote: I'm not sure how you want to display a list of lists. For that you might want some kind of tree widget, not a list view. But if you want to display a list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
It's good but i've to write your code differently: ArrayListString array_list = renvoi_liste_recette_xml(); list.setAdapter(new ArrayAdapterString(this, R.layout.liste,array_list)); But an error stay in the part list.setAdapter (list cannot be resolve) I've an other question in my XML file (which name is liste.xml here) what i've to put for display my array ? A text view or nothing ? Thanks again Sweet On 9 sep, 19:02, Yusuf Saib (T-Mobile USA) yusuf.s...@t-mobile.com wrote: I'm not sure how you want to display a list of lists. For that you might want some kind of tree widget, not a list view. But if you want to display a list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
It's good but i've to write your code differently: ArrayListString array_list = renvoi_liste_recette_xml(); list.setAdapter(new ArrayAdapterString(this, R.layout.liste,array_list)); But an error stay in the part list.setAdapter (list cannot be resolve) I've an other question in my XML file (which name is liste.xml here) what i've to put for display my array ? A text view or nothing ? Thanks again Sweet On 9 sep, 19:02, Yusuf Saib (T-Mobile USA) yusuf.s...@t-mobile.com wrote: I'm not sure how you want to display a list of lists. For that you might want some kind of tree widget, not a list view. But if you want to display a list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
It's good but i've to write your code differently: ArrayListString array_list = renvoi_liste_recette_xml(); list.setAdapter(new ArrayAdapterString(this, R.layout.liste,array_list)); But an error stay in the part list.setAdapter (list cannot be resolve) I've an other question in my XML file (which name is liste.xml here) what i've to put for display my array ? A text view or nothing ? Thanks again Sweet On 9 sep, 19:02, Yusuf Saib (T-Mobile USA) yusuf.s...@t-mobile.com wrote: I'm not sure how you want to display a list of lists. For that you might want some kind of tree widget, not a list view. But if you want to display a list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
It's good but i've to write your code differently: ArrayListString array_list = renvoi_liste_recette_xml(); list.setAdapter(new ArrayAdapterString(this, R.layout.liste,array_list)); But an error stay in the part list.setAdapter (list cannot be resolve) I've an other question in my XML file (which name is liste.xml here) what i've to put for display my array ? A text view or nothing ? Thanks again Sweet On 9 sep, 19:02, Yusuf Saib (T-Mobile USA) yusuf.s...@t-mobile.com wrote: I'm not sure how you want to display a list of lists. For that you might want some kind of tree widget, not a list view. But if you want to display a list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
I've done some modifications to my code and eclipse don't find any error but the emulator force my application to quit: java class: import java.net.URL; import java.util.ArrayList; import java.util.Collection; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class Xml extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { ArrayListString array_list = null; try { array_list = renvoi_liste_recette_xml(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapterString(this, R.layout.liste,array_list)); } @SuppressWarnings(unchecked) public ArrayListString renvoi_liste_recette_xml() throws Exception { ArrayListString aTableRetour = new ArrayListString(); URL myURL = new URL(http://benji.roullet.free.fr/testXml.xml;); DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance (); DocumentBuilder constructeur = fabrique.newDocumentBuilder(); Document document = constructeur.parse(myURL.openStream()); Element racine = document.getDocumentElement(); NodeList liste = racine.getElementsByTagName(Contact); for(int i=0; iliste.getLength(); i++){ ArrayListString aTableauTmp = new ArrayListString(); Element E1= (Element) liste.item(i); aTableauTmp.addAll((Collection? extends String) E1.getElementsByTagName(nom)); aTableRetour.addAll(aTableauTmp); } return aTableRetour; } } Xml file: ?xml version=1.0 encoding=utf-8? TextView android:layout_width=wrap_content android:layout_height=wrap_content xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/text /TextView Do you see anythings wrong ? On 9 sep, 19:02, Yusuf Saib (T-Mobile USA) yusuf.s...@t-mobile.com wrote: I'm not sure how you want todisplaya list of lists. For that you might want some kind of tree widget, not a list view. But if you want todisplaya list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
Do you see anythings wrong ? No, but can you tell me where it crashes? I don't understand why you wrote list in list.setAdapter and why you wrote this.android.R.layout.list_item, array_list instead of R.layout.list_item. Sorry, my post had a typo. It should be this: listAdapter = new ArrayAdapterString( this, R.layout.your_list_row, R.id.row_text, your_array_list_of_strings); listView.setAdapter(listAdapter); // or, if you're using a ListActivity instead of a ListView, just say this.setAdapter (listAdapter); For the layout your_list_row.xml, put this: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+android:id/row_text android:layout_width=wrap_content android:layout_height=50.0sp / /LinearLayout There are a number of tutorials for using ArrrayAdapter, they may also help. Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
Nobody can help me ? On 9 sep, 09:30, sweet brou...@gmail.com wrote: Hello i'm new to android developping and i've done a function which return an arraylist type ArrayListArrayList. I would like to display this array list for see if my function work. Can you help me ? Thanks Sweet --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
You can always log the content and use LogCat to view the ouput. Or you could create a test Intent for the purpose: public class DumpArray extends ListActivity{ public void onCreate(Bundle savedInstance){ super.onCreate(savedInstance); setListAdapter( new ArrayAdapterString(this, android.R.layout.simple_list_item_1, myArray); } } /Casper On 9 Sep., 16:18, sweet brou...@gmail.com wrote: Nobody can help me ? On 9 sep, 09:30, sweet brou...@gmail.com wrote: Hello i'm new to android developping and i've done a function which return an arraylist type ArrayListArrayList. I would like to display this array list for see if my function work. Can you help me ? Thanks Sweet --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
Oops, that should say Activity rather than Intent: Or you could create a test Intent for the purpose: Double oops, I did not see you wanted to display ArrayListArrayList? . --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
Thank a lot for your help Casper yes i want to display this ArrayList: public ArrayListArrayList renvoi_liste_recette_xml() throws Exception{ ArrayListArrayList aTableRetour = new ArrayListArrayList(); URL myURL = new URL(http://benji.roullet.free.fr/testXml.xml;); DocumentBuilderFactory fabrique = DocumentBuilderFactory.newInstance (); DocumentBuilder constructeur = fabrique.newDocumentBuilder(); Document document = constructeur.parse(myURL.openStream()); Element racine = document.getDocumentElement(); NodeList liste = racine.getElementsByTagName(Contact); for(int i=0; iliste.getLength(); i++){ ArrayListString aTableauTmp = new ArrayListString(); Element E1= (Element) liste.item(i); aTableauTmp.addAll((Collection? extends String) E1.getElementsByTagName(nom)); aTableRetour.add(aTableauTmp); } return aTableRetour; } On 9 sep, 16:37, Casper Bang casper.b...@gmail.com wrote: Oops, that should say Activity rather than Intent: Or you could create a test Intent for the purpose: Double oops, I did not see you wanted to display ArrayListArrayList? . --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to display an arraylist
I'm not sure how you want to display a list of lists. For that you might want some kind of tree widget, not a list view. But if you want to display a list of string, use setAdapter(): list.setAdapter(new ArrayAdapterString(this, android.R.layout.list_item, array_list)); Does that answer your question or did you have something else in mind? Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---