android - Class reference after orientation change -


i wrote public class, handle ethernet communication, has thread update variables.

the main activity interact class getting variables or send messages. after orientation change thread running want main activity can not datas "ethernet class".

how declare class in main activity:

ethip = new ethip(tot_in, tot_out, ip , port, false);

start thread in ethip class

thank hlep...

when orientation changed activity should have recreated , new ethernet class instance created. have avoid activity recreate. change manifest as...

    <activity android:name=".activity.mainactivity"         android:configchanges="keyboardhidden|orientation|screensize">     </activity> 

and override onconfigurationchanged() in activity ...

@override public void onconfigurationchanged(configuration newconfig) {     super.onconfigurationchanged(newconfig); } 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -