Hi,
I m create a list-view sample.i have one problem.i want to display item in
list view...my code is given below....
public class Sliding_listview extends ListActivity
{
private static final String[] items={"lorem", "ipsum", "dolor",
"sit", "amet","consectetuer", "adipiscing", "elit", "morbi",
"vel",
"ligula", "vitae", "arcu", "aliquet", "mollis",
"etiam", "vel", "erat", "placerat", "ante",
"porttitor", "sodales", "pellentesque", "augue", "purus"};
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setListAdapter(new IconicAdapter()); // Till here working fine....But i
want to display this items into my listview how can i do .......
ListView l=(ListView)findViewById(R.id.listView1);// This is my
list-view i want to display the items in this list only
}
class IconicAdapter extends ArrayAdapter<String> {
IconicAdapter() {
super(Sliding_listview.this, R.layout.sliding_listview, R.id.label,
items);
}
@Override
public View getView(int position, View convertView,ViewGroup parent)
{
View row=super.getView(position, convertView, parent);
ImageView icon=(ImageView)row.findViewById(R.id.icon);
icon.setImageResource(R.drawable.ok);
return(row);
}
}
}
My Layout file is :
<?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/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="2dip"
android:src="@drawable/ic_launcher"
android:contentDescription="icon"/>
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</ListView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
pls help me fast i need it very urgent for my project
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.