tags:

views:

30

answers:

0

I am using the code below. I want a text view on top of which always stays on top even while the list is scrolled, like a heading. But when I add something to my layout the program crashes.

How do I do this?


The code:

public class list extends ListActivity {
    private IArmService service;
    private ArmServiceConnection armCon;
    private String    AID = "OA00031048";
    private int     arm_res = 1;

    SimpleCursorAdapter mAdapter = null;

    String names;
    String numbers;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        /*
        if(!runService()){
            arm_res = 0;
            showDialog(0);
        }*/

        String[] projection = new String[] {
            ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
            ContactsContract.CommonDataKinds.Phone.NUMBER,
            ContactsContract.CommonDataKinds.Phone._ID
        };

        //Get the base URI for the People table in the Contacts content provider.
        Uri contacts =  ContactsContract.CommonDataKinds.Phone.CONTENT_URI;

        //Make the query.
        Cursor managedCursor = managedQuery(
          contacts,
          projection,
          null,
          null,
          ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");

        int[] names = new int[] {R.id.TextView01 ,R.id.TextView02};

        String[] from = new String[] {
            ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
            ContactsContract.CommonDataKinds.Phone.NUMBER
        };

        startManagingCursor(managedCursor);

        mAdapter = new SimpleCursorAdapter(this, R.layout.main, managedCursor, from, names);

        setListAdapter(mAdapter);
    }