I am new to android.... Problem to add an image in ListActivity...i took this code from
*http://commonsware.com/Android/excerpt.pdf* ..eventhough i m having problem...if i run it says The Application Stopped Unexpectedly.. try Again...i dont know the reason..can u tel anybody....pls point out the error in my code.... Thanks in advance... With Regards, Raghav.S Here is my Code: *Staticdemo.java* package image.demo; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; public class StaticDemo extends ListActivity { TextView selection; String[] items={"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing"}; ImageView android1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setListAdapter(new ArrayAdapter<String>(this,R.layout.row,R.id.label,items)); selection=(TextView)findViewById(R.id.selection); android1=(ImageView)findViewById(R.id.android1); } public void onListItemClick(ListView parent, View v, int position, long id) { selection.setText(items[position]); } } </LinearLayout> *row.xml* <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageView android:id="@+id/android1" android:layout_width="22px" android:paddingLeft="2px" android:paddingRight="2px" android:paddingTop="2px" android:layout_height="wrap_content" android:src="@drawable/images" /> <TextView android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="44sp" /> *main.xml* <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:id="@+id/selection" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---