how to open text files in listview in android
<p>I am using a listView to make a list of files which get content from Editor(editText).This listview is updated from a database whenever i make a new files and .but when i click on a file in listview i dont get the content in a editText in new activity.I want to open the content in Editor(editText).</p>

<p>code for onlistItemClickListener();</p>

<pre><code>public void onListItemClick(ListView parent, View v, int position, long id)
{   
    long post=getSelectedItemId();
    String st=dm.selectContent()[position];  **// this line gives error**
    Intent next=new Intent(ListFiles.this,Editor.class);
    next.putExtra("ID",post);
    Bundle extras = new Bundle();
    extras.putString("Name",st); // key - value pair
    next.putExtras(extras); // putExtras() - used to add the bundle object into intent. getExtraxs()
    startActivityForResult(next);
    }
</code></pre>

<p>code in Editor class</p>

<pre><code>//display the content
      Bundle extras = getIntent().getExtras();
    if (extras!=null)
    {
    defaultName = extras.getString("Name"); // defaultName used to show hint in the textBox
    }      
    et.setText(defaultName);
</code></pre>

<p>this is my database class where content name and Id of content is stored</p>

<pre><code>private static final String INSERT = "insert into " + TABLE_NAME + " (name,content) values (?,?)";
public DataManipulator(Context context) {
    DataManipulator.context = context;
    OpenHelper openHelper = new OpenHelper(DataManipulator.context);
    DataManipulator.db = openHelper.getWritableDatabase();
    this.insertStmt = DataManipulator.db.compileStatement(INSERT);
}
public long insert(String name,String content) {
    this.insertStmt.bindString(1,name);
    this.insertStmt.bindString(2,content);
    return this.insertStmt.executeInsert();
}

public List&lt;String[]&gt; selectName()
{
    List&lt;String[]&gt; listView1 = new ArrayList&lt;String[]&gt;();
    Cursor cursor = db.query(TABLE_NAME, new String[] {"id","name","content"}, null, null, null, null,null); 
    int x=0;
    if (cursor.moveToFirst()) {
       do {
            String[] b1=new String[]{cursor.getString(0),cursor.getString(1),cursor.getString(2)};
            listView1.add(b1);
            x=x+1;
       } while (cursor.moveToNext());
    }
    if (cursor != null &amp;&amp; !cursor.isClosed()) {
       cursor.close();
    } 
    cursor.close();
    return listView1;
</code></pre>

<p>}</p>

<pre><code>public String[] selectContent()
{
    Cursor cursor1 = db.query(TABLE_NAME, new String[] {"id","name","content"}, null, null, null, null,null); 

    string[]  b2 = new String[]{cursor1.getString(2)};**//this line also shows error **

        if (cursor1 != null &amp;&amp; !cursor1.isClosed())
            cursor1.close();                

        return b2;


}



private static class OpenHelper extends SQLiteOpenHelper {
    OpenHelper(Context context) {
         super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
         db.execSQL("CREATE TABLE " + TABLE_NAME + " (id INTEGER PRIMARY KEY, name TEXT,content TEXT)");
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) 
    {
         db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
         onCreate(db);
    } }}
</code></pre>
