Error: Generic Array Creation

You can’t create arrays with a generic component type. Create an array of an explicit type, like Object[], instead. You can then cast this to PCB[] if you want, but I don’t recommend it in most cases. PCB[] res = (PCB[]) new Object[list.size()]; /* Not type-safe. */ If you want type safety, use a collection like java.util.List<PCB> instead of an … Read more

How to pass an object from one activity to another on Android

One option could be letting your custom class implement the Serializable interface and then you can pass object instances in the intent extra using the putExtra(Serializable..) variant of the Intent#putExtra() method. Pseudocode: //To pass: intent.putExtra(“MyClass”, obj); // To retrieve object in second Activity getIntent().getSerializableExtra(“MyClass”); Note: Make sure each nested class of your main custom class has implemented Serializable interface to avoid … Read more