Re: [android-developers] Re: Best way to populate ListView on runtime.

2010-08-16 Thread Aravindh M.D
First for every row in the list you need create a separate  xml file which
describes layout  text view for displaying the run-time data.

Also change ArrayAdapter to SimpleCursorAdapter that works well. In this
change R.id.list as R.layout.text.xml i think it will work
 lv.setAdapter(new ArrayAdapterString(HelloWorld.this, R.id.list, arr));

For references check ContactsManager Application Android Developers site
under resource tab.

On Fri, Aug 13, 2010 at 1:45 AM, Warrior ranjeetsinghdhi...@gmail.comwrote:

 My bad.. there is another text.xml in the layout folder...

 ?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

 ListView
android:id=@+id/list
 android:layout_width=wrap_content
android:layout_height=wrap_content
 /
 /LinearLayout

 On Aug 12, 3:22 pm, Erik R ejwrobert...@gmail.com wrote:
  On the line:
  lv = (ListView) findViewById(R.id.list);
 
  You are trying to get a handle on a ListView that does not exist in
  the XML that you are showing.
 
  On Aug 12, 1:34 pm, Warrior ranjeetsinghdhi...@gmail.com wrote:
 
   can anyone tell me whats wrong or suggest the best way to populate a
   ListView on runtime from one screen to another.
   Please see my code below
   1. the list always ends up empty
   2. I get a invalid resource error in the end.
 
   ?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:layout_width=fill_parent
   android:layout_height=wrap_content android:text=@string/hello /
   EditText
   android:id=@+id/entry android:layout_width=fill_parent
   android:layout_height=wrap_content
   android:background=@android:drawable/editbox_background/
   Button android:id=@+id/ok
   android:layout_width=wrap_content
   android:layout_height=wrap_content   android:layout_below=@id/
   entryandroid:layout_alignParentRight=true
   android:layout_marginLeft=10dipandroid:text=Add to List /
   Button   android:id=@+id/viewlist
   android:layout_width=wrap_content
   android:layout_height=wrap_content
   android:layout_below=@id/ok
   android:layout_alignParentRight=true
   android:layout_marginLeft=10dip
   android:text=View List /
   /LinearLayout
 
   public class HelloWorld extends Activity {
 
   /** Called when the activity is first created. */
 
   public ListView lv;
   public ArrayListString arr = new ArrayListString();
 
   @Override
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
 
   Button okButton = (Button) findViewById(R.id.ok);
   okButton.setOnClickListener(new View.OnClickListener() {
   public void onClick(View v) {
   EditText et = (EditText) findViewById(R.id.entry);
   arr.add(et.getText().toString());
   Toast.makeText(HelloWorld.this, Added:  +
 et.getText(),
   Toast.LENGTH_SHORT).show();
   et.bringToFront();
   }
   });
 
   Button viewListButton = (Button) findViewById(R.id.viewlist);
   viewListButton.setOnClickListener(new View.OnClickListener() {
   public void onClick(View v) {
   setContentView(R.layout.text);
   lv = (ListView) findViewById(R.id.list);
   lv.setAdapter(new
   ArrayAdapterString(HelloWorld.this, R.id.list, arr));
   }
   });
   }
 
   }

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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: Eclair install choked with errors about locks and died horribly leaving corrupted install

2009-11-05 Thread M.D.
so looking through the .xml you can manually find the download
locations for each file, example...
sdk:nameGoogle APIs/sdk:name
sdk:api-level4/sdk:api-level
sdk:vendorGoogle Inc./sdk:vendor
sdk:revision01/sdk:revision
sdk:descriptionAndroid + Google APIs/sdk:description
sdk:desc-urlhttp://d.android.com//sdk:desc-url
sdk:uses-license ref=android-sdk-license/
-
sdk:archives
-
sdk:archive os=any
sdk:size41858003/sdk:size
sdk:checksum type=sha1e687a15e70a96bcb5acc2f6a99af8791f9421804/
sdk:checksum
sdk:urlgoogle_apis-4-r01.zip/sdk:url

as you can see google_apis-4-r01.zip is what you put after http://
dl-ssl.google.com/android/repository/ if you want to download that
specific file, so the 1.6 SDK download for windows is

http://dl-ssl.google.com/android/repository/android-1.6_r01-windows.zip

-- 
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