如何通过一个数组列表,从一个活动到另一个没有启动它
我有一个数组列表中的活性
I have an activity which has an array list
ArrayList<String> array = new ArrayList<String>();
我想这个数组列表被传递到另一个活动在单击保存按钮时,但我不希望这样的活动启动...
i want this array list to be passed to another activity when a Save button is clicked, but i don't want that activity to start...
这通常code有助于启动一项活动
Usually this code helps in starting an activity
public void onClick(View v) {
if (v==Save)
{
Bundle bundle = new Bundle();
bundle.putStringArrayList("DONE", activeURL);
Intent myIntent = new Intent(Reader2.this, Aggregator.class);
myIntent.putExtra("reader2", activeURL);
startActivity(intent);
}
}
但我只是想通过数组并开始另一项活动。 你能帮帮我吗? 先谢谢了。
but i just want to pass the array and start another activity. Can you please help me ? Thanks in advance.
您可以声明您ArrayList中为静态的这个样子,
You can declare you ArrayList as a static one like this,
public static ArrayList<String> array = new ArrayList<String>();
这样做,你可以从任何地方通过
By doing this you can access your ArrayList from anywhere by
activity_name.array;
在这里ACTIVITY_NAME是在声明静态的ArrayList活动或类
where activity_name is the activity or class in which you declare the static ArrayList