This line is throwing anNPE, producing an IllegalStateException in the exception chain:

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

as you don’t initialize stopPort (or startPort) in your onCreate method. You should have something like:

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

The statement

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

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *