android listener value into a variable
Is there a way to run a android listener and to write its value dynamically into a variable used in onCreate of the mainActivity
something like this
public MainActivity(){
public void onCreate(...){
...
int i;
i=Listener.getvalue();
//or
i=Listener.vlaue;
}
}
protected void init(NodeMainExecutor nodeMainExecutor){
listener =new Listener;
...
nodeMainExecutor.execute(listener.nodeConfiguration);
}
}
i can see the log of the value (int) of the listener in my android studio
One Problem is that the init is ran after the onCreate and so the app throws a nullpointerexception since the object Listener does not exist. Is there a way to handle this(e.g. a loop)
the value of i should change dynamically depending on the message of the Listener
Thanks