I'm creating an editor in Android
and for every type of ImageView
i'm creating a .class
The types of the ImageViews
are the following:
private Class<?> popups[] = {
Clock_pop_up.class, TV_kitchen_pop_up.class, Thermometer_pop_up.class, CoffeeMachine_pop_up.class, Fridge_pop_up.class, Oven_pop_up.class, Air_pop_up.class, TV_livingroom_pop_up.class
};
I have modified these classes with a <style>
that for every Intent
it's shown as a pop-up dialog
The problem is this:
Intent intent = new Intent(getApplicationContext(), (Class<?>) popups[finalI]);
startActivity(intent);
It shows the pop-up correctly, although if a .class
repeats it self on the grid then i have the same "settings" for every two or more same classes
For Example
Let's say i add a Clock_pop_up.class
and i set the "settings", Hour to 06 and Minutes to 05
Then i'll add a Thermometer_pop_up.class
and set the "settings"
The Problem: If i add another
Clock_pop_up.class
orThermometer_pop_up.class
, i'll get the previous set "settings"
I've already tried this:
- Create new instance using
Class<?>
, but it didn't work for me.
Is there any other way i can create instances
of a .class
every time i put the ImageView
on the grid? Is there any other workaround?
Edit: I have to mention i'm using static
fields in .class