I have a class in android (java) I forced to create that class every second (new className() ) because variable is final . this use a lot of memory . I can not change the class because it is implemented in a library
I want : when at first create className and OS allocates a memory place, when I create my class again , it replace to that place which allocated at the first time. Or How I can change final variable?
I solved my problem:
By this code:
Field modifierslatitude = className.class.getDeclaredField("latitude");
modifierslatitude.setAccessible(true);
modifierslatitude.set(classNameObjectThatFirstCreate, location.getLatitude() + MainActivity.y * 0.0002);
in fact I changed final variable without create new class again and again