私はアクティビティクラスとアクティビティクラス以外があります。アクティビティフォームのメソッドを非アクティビティクラスで呼び出す方法
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
DataClass dc = new DataClass();
dc.show();
}
public void call(ArrayList<String> arr) {
// Some code...
}
}
public class DataClass {
public void show(ArrayList<String> array) {
// Here I want to send this ArrayList values into the call
// method in activity class.
MainActivity act = new MainActivity();
act.call(array);
}
}
参照からそれを使用することができ、またhttp://stackoverflow.com/questions/19666572/how-to-call-a-method-in-another-activity-from-activityて、http: //stackoverflow.com/questions/16653867/android-call-method-from-an-other-activity – RenniePet