• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
12 views

Problem :

While executing Android code getting below error 
java.lang.illegalstateexception could not execute method of the activity
by (6.9k points)  

1 Answer

0 votes

Solution :

Bellow line is throwing an Null Pointer Exception, producing an IllegalStateException in the exception chain:

int stopPortRange = Integer.parseInt(stopPort.getText().toString());

As you don't initialize stopPort in your onCreate method. 

stopPort = (EditText) findViewById(R.id.stop_port_field);

The statement

EditText stopPort;

simply declares the variable which is null by default. Only instances that have been instantiated can have their methods invoked.

Further Readings:

https://github.com/printdotio/printio-android-sdk/issues/162

by (21.9k points)  
edited by
...