I keep getting this error:
Unable to start activity ComponentInfo{com.Nostradamus/com.Nostradamus.Contactenlijst}: java.lang.NullPointerException
And I don't know what I do wrong.
It has something to do with the last code:
lv.setAdapter(new SimpleAdapter(this, mylist, R.layout.list_item, from, to));
This is my java code:
public class Contactenlijst extends Activity {
ListView lv;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] from = new String[] {"voornaam", "achternaam", "geboortedatum", "adres", "postcode", "woonplaats", "email", "telefoon"};
int[] to = new int[]{R.id.voornaam, R.id.achternaam, R.id.geboortedatum, R.id.adres, R.id.postcode, R.id.woonplaats, R.id.email, R.id.telefoon};
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
Log.d("test","test2");
// Get the data (see above)
JSONObject json = Database
.getJSONfromURL("http://fabian.nostradamus.nu/Android/getcontactinfo.php");
Log.d("test","test3");
try {
JSONArray contactinfo = json.getJSONArray("contactlijst");
Log.d("test","test4");
// Loop the Array
for (int i = 0; i < contactinfo.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
JSONObject e = contactinfo.getJSONObject(i);
map.put("voornaam", e.getString("staff_name"));
map.put("achternaam", e.getString("staff_lastname"));
map.put("geboortedatum", e.getString("staff_dateofbirth"));
map.put("adres", e.getString("staff_address"));
map.put("postcode", e.getString("staff_address_postal"));
map.put("woonplaats", e.getString("staff_address_city"));
map.put("email", e.getString("staff_email"));
map.put("telefoon", e.getString("staff_phone"));
mylist.add(map);
Log.e("test",map.toString());
}
} catch (JSONException e) {
Log.e("log_tag", "Error parsing data " + e.toString());
}
lv = (ListView) findViewById(R.id.list);
lv.setAdapter(new SimpleAdapter(this, mylist, R.layout.list_item, from, to));
}
}
And these are my xmls:
Contactenlijst
<?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:id="#+id/voornaam"
android:layout_width="50dip"
android:layout_height="wrap_content"/>
<TextView android:id="#+id/achternaam"
android:layout_width="70dip"
android:layout_height="wrap_content" android:layout_weight="1"/>
<TextView android:id="#+id/geboortedatum"
android:layout_width="60dip"
android:layout_height="wrap_content" android:layout_weight="1"/>
<TextView android:id="#+id/adres"
android:layout_width="50dip"
android:layout_height="wrap_content"/>
<TextView android:id="#+id/postcode"
android:layout_width="70dip"
android:layout_height="wrap_content" android:layout_weight="1"/>
<TextView android:id="#+id/woonplaats"
android:layout_width="60dip"
android:layout_height="wrap_content" android:layout_weight="1"/>
<TextView android:id="#+id/email"
android:layout_width="60dip"
android:layout_height="wrap_content" android:layout_weight="1"/>
<TextView android:id="#+id/telefoon"
android:layout_width="60dip"
android:layout_height="wrap_content" android:layout_weight="1"/>
Contactview
<?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="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:drawSelectorOnTop="false"/>
<TextView android:id="#id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="No data">
</TextView>
</LinearLayout>
and Listitem
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16sp" >
</TextView>
you didn't set the layout using
setContentView(R.layout.yourlayout);
so without add layout you are using your listview that's why you getting NullPointerException.
add this above line after
super.onCreate(savedInstanceState);
or before the use listview object
You need to call setContentView(...) before lv = (ListView) findViewById(R.id.list);
setContentView(...) inflates the XML file for your layout. If you don't do this, then lv will be null.
Related
I have a problem how to hide the button in specific row in my listview with SimpleAdapter. This is my sample code.
alert_noti_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
alert_pop_list.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:id="#+id/view1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="view1"
android:textSize="20dp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/confirm"
android:layout_toStartOf="#+id/confirm" />
<TextView
android:id="#+id/view2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="10dp"
android:textStyle="bold"
android:visibility="visible"
android:layout_below="#+id/view1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/confirm"
android:layout_toStartOf="#+id/confirm" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/confirm"
android:layout_alignBottom="#+id/view2"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:background="#drawable/ic_confirm" />
</RelativeLayout>
Activity :
List<Map<String, String>> listData = new ArrayList<Map<String, String>>();
Map<String, Object> names = new HashMap<String, Object>();
names.put("First","head1");
names.put("Second", "txt1");
names.put("First","head2");
names.put("Second", "txt2");
names.put("First","head3");
names.put("Second", "txt3");
...
listData.add((HashMap) names);
ListView lv = (ListView) dialog_mail.findViewById(R.id.listView1);
// ArrayAdapter<String> adapter = new ArrayAdapter<String>(home.this,, android.R.layout.two_line_list_item, names);
SimpleAdapter adapter = new SimpleAdapter(home.this, listData,
R.layout.alert_pop_list,
new String[] {"First", "Second" },
new int[] {R.id.view1, R.id.view2});
lv.setAdapter(adapter);
how do i hide the button if the value is head2 and show to the rest of the list.
You need to custom a BaseAdapter instead of SimpleAdapter and write some code at getView() method。 just like:
public View getView(int p,View view,ViewGroup parent) {
if (view == null) {
view = LayoutInflate.xxxx;
}
Button btn = (Button) view.findViewById(R.id.btn);
DataModel d = list.get(p);
if (d.isHidden || d.data.equals("head2")) {
btn.setVisibility(View.GONE);
} else {
btn.setVisibility(View.visible);
}
return view;
}
so you need to create a DataModel to store some property.
public class DataModel {
public boolean isHidden;
public HashMap<String,String> dataMap;
//and so on.....
}
Problem is with its showing me nullpointer exception while click onshowContact button there is something wrong i cant figure it out but I m not getting the dialog box with the list view with this code
Button click of contact view
public void showContacts(View view){
//View CSV into an array
try{
Dialog dialog = new Dialog(NewMessage.this);
dialog.setContentView(R.layout.contact_view);
dialog.setTitle("Contacts");
dialog.setCancelable(true);
ListView lv = (ListView)findViewById(R.id.lv);
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
int fillarray = 0;
if(mylist.equals(null)){
fillarray = 0;
}
else{
fillarray = mylist.size();
}*/
for(int i=0;i<name.size();i++)
{
HashMap<String, String> map = new HashMap<String, String>();
map.put("name",name.get(i));
map.put("number",number.get(i));
map.put("status",status.get(i));
mylist.add(map);
}
SimpleAdapter mSchedule = new SimpleAdapter(NewMessage.this, mylist, R.layout.view_csv, new String[] {"name","number","status"}, new int[] {R.id.t1,R.id.t2,R.id.t3});
lv.setAdapter(mSchedule);
dialog.show();
}
catch(Exception e){
Toast.makeText(NewMessage.this, e.toString(), 2000).show();
}
//Viewing Finish Here
}
This my contact_view.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="fill_parent"
android:orientation="vertical" >
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<ListView
android:id="#+id/lv"
android:layout_width="wrap_content"
android:layout_height="397dp" >
</ListView>
</LinearLayout>
This my view_csv.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/t1"
android:layout_width="90dip"
android:layout_height="wrap_content"
android:text="text1"/>
<TextView
android:id="#+id/t2"
android:layout_width="90dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="text2"/>
<TextView
android:id="#+id/t3"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="text3" />
</LinearLayout>
Your ListView is comming under contact_view layout. So you have to initialize the list through your dialog. because your dialog contains the layout here dialog.setContentView(R.layout.contact_view);
So you have to initialize the list like:
ListView lv = (ListView) dialog.findViewById(R.id.lv);
I've tried to using a SimpleAdapter to fill a ListView but only to failed.
I've read many cases but still can't find a useful method.
Here is the Code. I wonder what's the problem.
ArrayList<HashMap<String,Object>> listdata=new ArrayList<HashMap<String,Object>>();
for (int i=0;i<3;i++){
HashMap<String, Object> hm = new HashMap<String, Object>();
hm.put("title", "title");
hm.put("context", "context");
listdata.add(hm);
}
String[] from = {"title", "context"};
int[] to={R.id.title,R.id.context};
SimpleAdapter adapter = new SimpleAdapter(this, listdata, R.layout.list_item, from, to);
ListView lv=(ListView)this.findViewById(R.id.listView1);
lv.setAdapter(adapter);
//code for the list_item
<LinearLayout
<ListView android:layout_height="wrap_content" android:id="#+id/listV1" android:layout_width="match_parent">
<LinearLayout>
<TextView android:layout_height="wrap_content" android:id="#+id/title" android:text="TextView" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge"></TextView>
<TextView android:text="TextView" android:id="#+id/context" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
</ListView>
I do appreciate if anyone can help!
I suspect the problem is with your Xml, try declaring a second layout file for the list item. e.g.
your_activity.xml :
<?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:layout_height="wrap_content" android:id="#+id/listView1" android:layout_width="fill_parent" />
</LinearLayout>
and list_item.xml :
<?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_height="wrap_content" android:id="#+id/title" android:text="TextView" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge"></TextView>
<TextView android:text="TextView" android:id="#+id/context" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
Your code looks ok and should work correctly if you use the above two layout files.
I have always put my list items in a seperate xml file. Maybe try putting your LinearLayout with the two TextViews in a file (maybe call it listrow.xml).
As an example:
Here is the listitem (list_stat_item.xml):
<LinearLayout android:id="#+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal" xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:text="" android:id="#+id/txtKey"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:padding="10dp" android:textSize="16sp"></TextView>
<TextView android:text="" android:id="#+id/txtValue"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:padding="10dp" android:textSize="16sp"></TextView>
</LinearLayout>
And here is the main view (view_stats.xml):
<LinearLayout android:id="#+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<ListView android:id="#android:id/list" android:layout_width="fill_parent"
android:layout_height="0dip" android:layout_weight="1"
android:transcriptMode="normal" android:divider="#drawable/list_divider"
android:dividerHeight="1px" />
</LinearLayout>
And here is the code:
Create an ArrayList, and add items to it, then bind to a custom adapter.
ArrayList<StatItem> lst = new ArrayList<StatItem>();
lst.add(new StatItem("Current Week: ", String.valueOf(currentWeek)));
lst.add(new StatItem("Weeks Left: ", String.valueOf(GeneralUtils.daysUntilBirth(this, pregnancyID) / 7)));
lst.add(new StatItem("Days Left: ", String.valueOf(GeneralUtils.daysUntilBirth(this, pregnancyID))));
lst.add(new StatItem("Current Trimester: ", String.valueOf(currentTrimester)));
lst.add(new StatItem("Posts: ", String.valueOf(blogCount)));
lst.add(new StatItem("Baby Names: ", String.valueOf(babyNamesCount)));
getListView().setSelector(android.R.color.transparent);
StatListAdapter sa = new StatListAdapter(this, R.layout.list_stat_item, lst );
setListAdapter(sa);
If you want to see the adapter code (StatListAdapter extends ArrayAdapter):
public class StatListAdapter extends ArrayAdapter<StatItem>
{
public ArrayList<StatItem> items;
public StatListAdapter(Context context, int textViewResourceId, ArrayList<StatItem> objects) {
super(context, textViewResourceId, objects);
this.items = objects;
}
public View getView(int position, View convertView, ViewGroup parent)
{
View v = convertView;
if (v == null)
{
LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = li.inflate(R.layout.list_stat_item, null);
}
StatItem i = items.get(position);
if (i != null)
{
TextView kt = (TextView)v.findViewById(R.id.txtKey);
TextView vt = (TextView)v.findViewById(R.id.txtValue);
kt.setText(i.key);
vt.setText(i.value);
}
return v;
}
}
Hello I have called a image behind the listview and listview is transparent. Each record in the list is appearing on repeating image . how i can fix this repeat ion of image . Here is the xml file
<?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"
android:padding="7dp"
android:background="#drawable/ac"
android:cacheColorHint="#00000000"
>
<TextView
android:id="#+id/item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="2dp"
android:textSize="20dp" />
<TextView
android:id="#+id/item_subtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:textSize="18dp" />
</LinearLayout>
Thanks
Now i have updated xml files like this
main xml file
<?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"
android:background="#drawable/ac"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ListView android:id="#+id/listView"
android:background="#drawable/ac"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
List xml file
<?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"
android:cacheColorHint="#00000000"
>
<TextView
android:id="#+id/item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="2dp"
android:textSize="20dp" />
<TextView
android:id="#+id/item_subtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:textSize="18dp" />
</LinearLayout>
and in the activity calling in this way
{ R.id.item_title, R.id.item_subtitle }
the whole code looks like
public class Test extends ListActivity {
Prefs myprefs = null;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listplaceholder);
this.myprefs = new Prefs(getApplicationContext());
// install handler for processing gui update messages
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
JSONObject json = JSONfunctions.getJSONfromURL("...............");
try{
JSONArray earthquakes = json.getJSONArray("services");
for(int i=0;i<earthquakes.length();i++){
HashMap<String, String> map = new HashMap<String, String>();
JSONObject e = earthquakes.getJSONObject(i);
map.put("id", e.getString("taskid"));
map.put("pic", "Service name : " + e.getString("employeepic"));
map.put("serviceinfo", "" + e.getString("employeename")+ " : "+ e.getString("starttime")
+" To " + e.getString("endtime"));
mylist.add(map);
}
}catch(JSONException e) {
Log.e("log_tag", "Error parsing data "+e.toString());
}
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.test,
new String[] { "servicename", "serviceinfo" },
new int[] { R.id.item_title, R.id.item_subtitle });
setListAdapter(adapter);
final ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
#SuppressWarnings("unchecked")
HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);
Toast.makeText(Test.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_SHORT).show();
}
});
}
I suppose you are using the above XML to populate the items in the list view (i.e) inside getView() ...
1. Remove android:background="#drawable/ac" from the above XML.
2. Add it to the ListView's XML say,
<ListView android:id="#+id/listView"
android:background="#drawable/ac"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
Explanation:
Setting Background to the layout that you are using to populate the list will produce 'repeating image' because you are setting background to the child (i.e) the listView's item and not to the List.
EDIT:
1.For your Activity, you will be loading the ListView from an Layout File(say main.xml), inside that layout file for the ListView add the background.
2. Remove the background from the LinearLayout in your above code.
Edit Again:
use the following XML,
main.xml
<?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"
android:background="#drawable/ac"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ListView android:id="#+id/listView"
android:background="#00000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
List xml file
<?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"
android:cacheColorHint="#00000000"
android:background="#00000000"
>
<TextView
android:id="#+id/item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="2dp"
android:textSize="20dp" />
<TextView
android:id="#+id/item_subtitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:textSize="18dp" />
</LinearLayout>
I need to show a football league table on my app. Like this: http://www.fuencalientedelapalma.org/sitios/Fuencaliente/VF7/PublishingImages/Clasificacion.png
As you see i need to do some kind of Android XML layout that shows 9 columns, and 10 rows, plus one more row for the name of the column.
I read all the documentation of listview on the android developers guide, but i can't find the way to do it. And also i search on google and i can't find the way to do it.
Code examples are welcome
thanks
You can use listView like this, inflating you own listlayout :
maListViewPerso = (ListView) findViewById(R.id.listviewperso);
ArrayList<HashMap<String, String>> listItem = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map;
for (int i = 0; i<statDB.getListStat().size(); i++){
Stat stat= statDB.getListStat().get(i);
listId.add(statDB.getListStat().get(i).getId()+"");
String message = " Chiffre d'affaire : "+statDB.getListFinancier(stat.getId()+"").get(0).getCaBrut()+" euros";
map = new HashMap<String, String>();
titre
map.put("titre", stat.getDate());
map.put("description", message);
map.put("img", String.valueOf(R.drawable.icon_crisalid));
map.put("stat_in",""+statDB.getListStat().get(i).getId());
listItem.add(map);
}
statDB.close();
SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.listview,
new String[] {"img", "titre", "description"}, new int[] {R.id.img, R.id.titre, R.id.description});
maListViewPerso.setAdapter(mSchedule);
maListViewPerso.setOnItemClickListener(new OnItemClickListener() {
#Override
#SuppressWarnings("unchecked")
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
HashMap<String, String> map = (HashMap<String, String>) maListViewPerso.getItemAtPosition(position);
Intent intent=new Intent().setClass(ListActivity.this, DetailActivity.class);
intent.putExtra("stat_in", map.get("stat_in") );
intent.putExtra("listId",listId);
startActivity(intent);
}
});
this is my listview code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="20px"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="10px"
android:layout_weight="1"
>
<TextView android:id="#+id/titre"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="16px"
android:textStyle="bold"
android:textColor="#color/textcol"
/>
<TextView android:id="#+id/description"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="12px"
android:textColor="#color/textcol"
android:paddingRight="10px"
/>
</LinearLayout>
and this is how I check the listview :
<?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"
android:background="#color/backgroundcolor"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:paddingTop="5px"
android:paddingBottom="5px"
android:background="#drawable/bg2"
>
<TextView
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
/>
</LinearLayout>
<ListView
android:id="#+id/listviewperso"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
you just have to adapt the listview.