• Register
search
Log In
0 votes
63 views

Problem :

While executing Android code getting below error 
java.lang.illegalstateexception could not execute method of the activity
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

36.1k points
edited by

Related questions

0 votes
1 answer 85 views
85 views
Problem : I am getting bellow error while learning android and trying to make a semi-useful app. java.lang.illegalstateexception: could not execute method for android:onclick
asked Oct 19, 2019 peterlaw 6.9k points
0 votes
1 answer 23 views
23 views
Problem : Now a days I am learning Android Programming. I am facing below error message while trying to implement the logout functionality for the Google Sign-In for the Android: “Caused by: java.lang.IllegalStateException: GoogleApiClient is not ... .getInstance().getClient(); Auth.GoogleSignInApi.signOut(myGoogleApiClient); } I am struggling to find solution on it since yesterday.
asked Feb 27 mphil 2.3k points
0 votes
1 answer 128 views
128 views
Problem : I am trying to learn Android programming also I am trying to develop a very basic weather app. My code works perfectly if I try to enter any valid city name. But I want to use the toast and it shows me the error and also to the ... .nextCleanInternal(JSONTokener.java:116) at org.json.JSONTokener.nextValue(JSONTokener.java:94) at org.json.JSONObject. How can I fix the above error?
asked Feb 14 mphil 2.3k points
1 vote
1 answer 14 views
14 views
Problem: I kept on getting this error when building for Android (shadow demo): Building DEX Failed! G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M -Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/" -jar "G:/AndroidSDK/android- ... initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. How to solve this?
asked Mar 27 LizzyM 5.7k points
1 vote
1 answer 12 views
12 views
Problem: I am getting this error when I tried to build shadow demo for android: Building DEX Failed! G:\Unity\JavaPluginSample\Temp/StagingArea> java -Xmx1024M -Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/" -jar "G:/AndroidSDK/android- ... reserve enough space for object heap Could not create the Java virtual machine. Can anybody help to fix or explain me this error
asked Mar 24 LizzyM 5.7k points