2 つのアクティビティ間で結果を渡したいのですが、どういうわけか this.startActivity(pIntent) で何らかのループに入ってから、強制的に閉じます。最初のアクティビティのコア コードは次のとおりです。それは何かを計算し、その後 double[] passedResults 変数を渡したい:
public class DisplayMessageActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<double[]> lokal = readCsv(getApplicationContext());
ArrayList<String> collect = new ArrayList<String>();
for (double[]sor : lokal) {
mean(sor);
String row = Double.toString(mean(sor));
collect.add(row);
}
String result = "";
for (int c=0; c<collect.size(); c++)
{
String curString = collect.get(c);
result = result + curString + "\n";
}
String [] results = result.split("\n");
double[] passedResults = new double[results.length];
for(int i = 0; i < results.length; i++)
{
passedResults[i] = Double.parseDouble(results[i]);
}
//Passing?!
Intent pIntent=new Intent(this,DisplayMessageActivity.class);
pIntent.putExtra("sResults", passedResults);
this.startActivity(pIntent);
getActionBar().setDisplayHomeAsUpEnabled(true);
Intent intent = getIntent();
TextView textView = new TextView(this);
textView.setTextSize(20);
textView.setText("Results are the nexts:\n"+result);
setContentView(textView);
}
次に、この方法で別のアクティビティでキャッチしたい:
public class ScatterGraph extends DisplayMessageActivity{
public Intent getIntent(Context context) {
Bundle bundle = getIntent().getExtras();
double[] recievedResults = bundle.getDoubleArray("sResults");
}
LogCat は次のとおりです。
10-29 20:49:07.078: E/AndroidRuntime(19821): FATAL EXCEPTION: main
10-29 20:49:07.078: E/AndroidRuntime(19821): java.lang.IllegalStateException: eglMakeCurrent failed EGL_BAD_ALLOC
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.HardwareRenderer$GlRenderer.createSurface(HardwareRenderer.java:1069)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.HardwareRenderer$GlRenderer.createEglSurface(HardwareRenderer.java:961)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:787)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1502)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.Choreographer.doFrame(Choreographer.java:532)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.os.Handler.handleCallback(Handler.java:725)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.os.Handler.dispatchMessage(Handler.java:92)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.os.Looper.loop(Looper.java:137)
10-29 20:49:07.078: E/AndroidRuntime(19821): at android.app.ActivityThread.main(ActivityThread.java:5227)
10-29 20:49:07.078: E/AndroidRuntime(19821): at java.lang.reflect.Method.invokeNative(Native Method)
10-29 20:49:07.078: E/AndroidRuntime(19821): at java.lang.reflect.Method.invoke(Method.java:511)
10-29 20:49:07.078: E/AndroidRuntime(19821): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
10-29 20:49:07.078: E/AndroidRuntime(19821): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
10-29 20:49:07.078: E/AndroidRuntime(19821): at dalvik.system.NativeStart.main(Native Method)
私を助けてくれてありがとう、私は本当にこれにこだわっています。私はアンドロイド開発が初めてで、数時間後に解決策を見つけます。