我想将多维数组传递给活动
多维数组:
double[][][] speed = new double[][][]
{
{
{ 15, 10 },
{ 16, 12 }
},
{
{ 14, 50 },
{ 18, 51 }
}
};
Bundle mBundle = new Bundle();
mBundle.putSerializable("speed", speed);
Intent myIntent = new Intent(getActivity(), LineChart.class);
myIntent.putExtra("speed", mBundle);
startActivity(myIntent);
并在另一个类(线图类)中接收它,我使用:
private double[][][] _speed;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get ALL the data!!!
Bundle extras = getIntent().getExtras();
if (extras != null) {
this._speed = extras.getSerializable("speed");
}
setContentView(showLineChart());
}
我收到以下错误:
Type mismatch: cannot convert from Serializable to double[][][]
有人可以解释如何做到这一点吗?