我是android编程的新手,自从我完成任何Java编程以来已经有好几年了.
我在XML strings.xml中声明了一个字符串数组:
<string-array name="questionSet1_array">
<item>Question Introduction</item>
<item> Question1</item>
<item>Question 2</item>
</string-array>
Run Code Online (Sandbox Code Playgroud)
然后我开始调用一个Activity Coastal.然后,我通过按下按钮开始第二个活动,开始活动Foreshore.
在活动中Foreshore,我做了以下声明:
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Foreshore extends Activity {
//globally declare parameters
private TextView text;
private EditText answerEntry;
private Button next;
Resources res = getResources();
String [] theQuestions = res.getStringArray(R.array.questionSet1_array);
//private String theAnswers[];
//private String answerPasser;
private int length;
private int i=0;
Run Code Online (Sandbox Code Playgroud)
线条Resources res ...,String[] ... …