Android emulator 使用对象访问数组

Android emulator 使用对象访问数组,android-emulator,Android Emulator,嗨,我在android中有两个类,在一个类中我写了一个数组,我想在主类中访问它,但错误是给我,这里的强制关闭是我的代码 package com.semanticnotion.DAO; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class

嗨,我在android中有两个类,在一个类中我写了一个数组,我想在主类中访问它,但错误是给我,这里的强制关闭是我的代码

package com.semanticnotion.DAO;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

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

        WordsDAO DAO = new WordsDAO(new String[] "Arte","Arquitectura","Familia","Moda","Cotilleos","Cine","Libros","Historia","Pintura","Musica","Tendencies","Modernimso","Pop art","Masteialismo","realities","filosofia","moda","fotografia","religion"});


        Button next = (Button) findViewById(R.id.Button01);
        next.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Intent myIntent = new Intent(view.getContext(), WordsDAO.class);
                startActivity(myIntent);
            }
        });
    }
}
第二类代码是

package com.semanticnotion.DAO;

public class WordsDAO  
{
    String[] words = new String[] "Arte","Arquitectura","Familia","Moda","Cotilleos","Cine","Libros","Historia","Pintura","Musica","Tendencies","Modernimso","Pop art","Masteialismo","realities","filosofia","moda","fotografia","religion"};


    public  WordsDAO(String[] words ) 
    {
        this.words=words;
    }
}

请告诉任何人这段代码中的错误是什么thaks首先:第二个类中的构造函数不会被使用。将参数传递给另一个活动的方法是在调用另一个活动的代码中以及在您的另一个活动中使用Intent.putExtra

Bundle extras = getIntent().getExtras(); 
if(extras !=null)
{
    String value = extras.getString("keyName");
}
获取onCreate中的数据

也就是说,我猜问题来自于您的第二个类没有提供显式的无参数构造函数