How to access array with object?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sajid shamshad
    New Member
    • Oct 2010
    • 2

    How to access array with object?

    hi i have two classes in android and in one class i have write an array and i want to access it in the main class but the error is give me that "force closed" here is my code

    [code=java]
    package com.semanticnot ion.DAO;

    import android.app.Act ivity;
    import android.content .Intent;
    import android.os.Bund le;
    import android.view.Vi ew;
    import android.widget. Button;

    public class DAO extends Activity
    {
    public void onCreate(Bundle savedInstanceSt ate)
    {
    super.onCreate( savedInstanceSt ate);
    setContentView( R.layout.main);

    WordsDAO DAO = new WordsDAO(new String[]{"Arte","Arquit ectura","Famili a","Moda","Coti lleos","Cine"," Libros","Histor ia","Pintura"," Musica","Tenden cies","Modernim so","Pop art","Masteiali smo","realities ","filosofia"," moda","fotograf ia","religion"} );

    Button next = (Button) findViewById(R. id.Button01);
    next.setOnClick Listener(new View.OnClickLis tener()
    {
    public void onClick(View view)
    {
    Intent myIntent = new Intent(view.get Context(), WordsDAO.class) ;
    startActivity(m yIntent);
    }
    });
    }
    }
    [/code]
    and the second class code is

    [code=java]
    package com.semanticnot ion.DAO;

    public class WordsDAO
    {
    String[] words = new String[]{"Arte","Arquit ectura","Famili a","Moda","Coti lleos","Cine"," Libros","Histor ia","Pintura"," Musica","Tenden cies","Modernim so","Pop art","Masteiali smo","realities ","filosofia"," moda","fotograf ia","religion"} ;

    public WordsDAO(String[] words )
    {
    this.words=word s;
    }
    }
    [/code]

    please any one tell what well be the error in this code thaks
    Last edited by Plater; Oct 22 '10, 07:29 PM. Reason: code tags, formatting
Working...