Hi i need to create a list view to display all the contacts which are stored in a text file. To add a contact the user must enter the details himself and so these will be saved in a text file. Now I need to create a list view to display these contacts in a list and also for every a contact a button would be shown. As for now what my code does is simply show the contact in a Toast.
public void ViewContacts(View v)
{
    //reading contacts from textfile
    try{
        FileInputStream fileIn=openFileInput("mytextfile.txt");
        InputStreamReader InputRead=new InputStreamReader(fileIn);
        char[] inputBuffer=new char[READ_BLOCK_SIZE];
        String s="";
        int charRead;
        while((charRead=InputRead.read(inputBuffer))>0)
        {
            //char to string conversion
            String readstring=String.copyValueOf(inputBuffer,0,charRead);
            s+=readstring;
        }
        InputRead.close();
        Toast.makeText(getBaseContext(),s,Toast.LENGTH_SHORT).show();
    } catch(Exception e)
    {
        e.printStackTrace();
    }
}
 
     
    