Can I initialize an Array list from data specified in xml resource file?

by Videoguy » Mon, 09 Mar 2009 23:24:10 GMT

Sponsored Links
 Is is possible to specify data in xml resource file and initialize
ArrayList from it?
I am looking for a way to use the ArrayList with a SimpleAdapter to
bind to a ListView.
I am wondering if there is a way to specify my data in xml resource
file and init ArrayList from it.


Other Threads

1. how to measure video file size?

I have a video player application and would like to display an
approximate size of the running video. Is there a way to calculate the
video file size from the given Video player API set?




2. how to handle the Dpad event in headview/footview of listview?

i have add a footview in listview with this code:

and also Register a callback to be invoked when this mFootView is clicked
with code below:

mFootView.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
              // my code

after this, when i press down dpad, there is no response, so i Register a
callback to be invoked when a key is pressed in this mFootView. with code

          mHiddenFolders.setOnKeyListener(new OnKeyListener(){

            public boolean onKey(View v, int keyCode, KeyEvent event) {
                // my code
               Log.v("onKey", "test");
                return  true;


unfortunately, still nothing happened :(

After some attempt, i found this ugly way:

    public void onItemClick(AdapterView<?> parent, View view, int position,
            long id) {
        // TODO Auto-generated method stub

        if (id == -1) {
            if (position == 0) {
               * // when click a header view*
            } else {
               *// when click a footer view*
        } else {
           * // when click other normal row*

finally, it works, but i'm wondering if there is a smart way to do this?


3. onDraw being called - is that correct?

4. Any alternative of iphone's searchable list in Android?

5. About maintaining the state of the activity on orientation change

6. TelephonyManager.getLine1Number() returning null?

7. Debugging surfaceflinger and gralloc library code