I'm working in the android Studio,2.1.2.
I have a mysterious cast Exception between two activity.
In the First Activity i have this ArrayList:
ArrayList<riparazione> nuovo = notizia.get_Elenco();
I insert the arraylist ( parcellable ) in a bundle for send at another activity:
Intent intent = new Intent(prenota_mostra_cellulari.this, prenota_mostra_dettagli.class);
Bundle spedizione = new Bundle();
spedizione.putString("Nome",notizia.get_Marca());
spedizione.putString("Foto",notizia.get_Foto());
spedizione.putString("Marca",notizia.get_Nome());
spedizione.putParcelableArrayList("Riparazioni",nuovo);
intent.putExtras(spedizione);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
In second activity i use this for recover ArrayList
ArrayList<riparazione> nuovo = new ArrayList<>();
Intent intent = getIntent();
if (null != intent) {
dati_cel = intent.getExtras();
nuovo = dati_cel.getParcelableArrayList("Riparazioni");
Log.d("Dati", String.valueOf(dati_cel.size()));
Log.d("Dati arraylist", String.valueOf(dati_cel.size()));
riparazione dads = nuovo.get(9);
}
NOW in line of riparazione dads = nuovo.get(9);
i get an Cast error :
Caused by: java.lang.ClassCastException: com.example.luca.ireplace.orario cannot be cast to com.example.luca.ireplace.riparazione
I have tried everything , with and without Bundle for sending, the class output end output are the same why this casting? And How do I solve??
Thanks for any Help