sorry for disturbing u again and again......

Actuall this is my Code.. still problem.......can u pls tel me....pls......u
said that i want to use android:id="@android:id+list"..but in pdf file they
never specify about this...i m so confused.....bcoz i m new to this,,,,plz
..u correct this  code.........sorry for disturbing u again and again......

*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




On Tue, Sep 22, 2009 at 4:10 PM, Mark Murphy <[email protected]>wrote:

>
>
> > *Pls tel how to add the image in list view....
>
> This has nothing to do with adding an image in a ListView:
>
> 09-22 15:33:47.384: ERROR/AndroidRuntime(714): java.lang.RuntimeException:
> Unable to start activity ComponentInfo{image.demo/image.demo.StaticDemo}:
> java.lang.RuntimeException: Your content must have a ListView whose id
> attribute is 'android.R.id.list'
>
> If you are going to use ListActivity, you need to give the ListView in
> your layout an android:id="@android:id/list" value instead of whatever you
> have.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com
> Android App Developer Books: http://commonsware.com/books.html
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to