Please see the xml code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:text="@+id/TextView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/label1"
android:textSize="50px"></TextView>
<TextView android:text="TextView"
android:id="@+id/label2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
also see the java code
class IconicAdapter extends ArrayAdapter<String>{
IconicAdapter(){
super(NewOrderActivity.this,R.layout.rowlayout,R.id.label1,ordersId);
}// end of the constrcutor
public View getView(int position,View convertView,ViewGroup parent){
View row=super.getView(position, convertView, parent);
TextView t=(TextView)row.findViewById(R.id.label1);
TextView t1=(TextView)row.findViewById(R.id.label2);
OrdersData d=(OrdersData)dataVector.elementAt(position);
t.setText(d.order_id);
t.setText(d.orderdate);
return (row);
}
}
I want to add two textview where i can set text but application crashes when i am retrieving these texview using findviewById
Please help how can I set two textviews in a row of ListActivity
Change your
getView()method. You are doing wrong there..