• Register
0 votes
78 views

Problem :

While executing Android code getting below error 
java.lang.illegalstateexception could not execute method of the activity
6 5 3
6,930 points

Please log in or register to answer this question.

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

9 7 4
38,600 points

Related questions

0 votes
1 answer 137 views
137 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 10 views
10 views
Any suggestions?
asked Jan 4 TeamScript 13.5k points
0 votes
1 answer 50 views
50 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, 2020 mphil 2.3k points
0 votes
1 answer 7 views
7 views
problem java.lang.illegalstateexception: already managing a googleapiclient with id 0
asked Feb 9 charles mathews 3.8k points
0 votes
1 answer 11 views
11 views
Problem: java.lang.IllegalStateException: Not allowed to start service Intent.
asked Feb 12 Shovo210 2.1k points
0 votes
1 answer 906 views
906 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, 2020 mphil 2.3k points
0 votes
1 answer 7 views
0 votes
1 answer 18 views
18 views
Problem: could not identify launch activity: default activity not found error while launching activity
asked 4 days ago Lucky Guy 1.4k points
0 votes
1 answer 511 views
511 views
Problem: I am completely new to the android and recently I have encountered the problem. My console showed me below error: "Could not identify launch activity: Default Activity not found". I have added below code in my manifests file. <intent-filter>             <action ... intent-filter>     </Activity> </application> </manifest> I am looking for support from Android expert to fix my above error.
asked Aug 1, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 72 views
72 views
Problem : I am getting bellow error while trying to run my android code. java.lang.runtimeexception: unable to start activity componentinfo
asked Nov 2, 2019 peterlaw 6.9k points