i would like to send the values from one activity to another but i got null in the second activity please solve my problem.the first activity contains blog_info the details of that
blog is send to second activity based on these values the second activity search places .
final ArrayList<Blog> blogList = (ArrayList<Blog>) message
.getResultList("Blog");
for (Blog blog : blogList) {
int i=0;
latitude_Array[i] = Double.parseDouble(blog.getLatitude_zzs());
longitude_Array[i]=Double.parseDouble(blog.getLongitude_zzs());
i++;
}
btn = (Button) findViewById(R.id.main_top_map_list);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,
MainActivity_MapList.class);
//The method putDoubleArray(String, double[]) in the type Bundle is not applicable for the arguments (String, Double[])
bundle.putDoubleArray("latitude_Array", latitude_Array);
// intent.putExtras(bundle);
finish();
startActivity(intent);
}
});
i have used a series of method such as :
bundle.putDoubleArray(key, value)
bundle.putSparseParcelableArray(key, value)
bundle.putParcelableArray(key, value)
bundle.putSerializable(key, value)
but i just get ‘null’ or ‘0.0’ in the second activity.
first, in the code you posted, you are putting an arraylist of lists of doubles, but then casting it to an arraylist of ? extends parcelable. those aren’t the same type.
i assume you just want to pass a list (or array) of doubles. you can either use
putDoubleArray()orputSerializable(). if you want to deal with an array of doubles, you need to have your doubles in adouble[], like,to get them out on the other side,
if you want to pass your doubles in an array list, you must have your doubles in an
ArrayList<? implements Serializable>… e.g.,ArrayList<Double>. like this,to get them out of the bundle on the other side,