Questions tagged [illegalstateexception]

About java.lang.IllegalStateException, a general-purpose exception defined in the Java API.

A java.lang.IllegalStateException is a Java RuntimeException that:

Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.

In particular, this exception is often used when the object the method is invoked on is currently in a state where this method should not be called. For instance, Effective Java writes (Item 60, page 248):

Another commonly reused exception is IllegalStateException. This is generally the exception to throw if the invocation is illegal because of the state of the receiving object. For example, this would be the exception to throw if the caller attempted to use some object before it had been properly initialized.

1120 questions
-1
votes
1 answer

IllegalStateException when using JavaFX Alert in init() because not on FX application thread

Using this approach I am trying to implement an application preloader for my JavaFX application. I want to load some heavy stuff in init() which may throw an exception and then continue with start(). To handle the exceptions I am showing an alert…
Zoffin
  • 3
  • 4
-1
votes
2 answers

IllegalStateException: Fragment already added not caught with try-catch

So I have this wonderful function: public static MenuPictureFragment newMenuPictureFragment(FragmentActivity fragmentActivity, String userIdParam, int containerId){ MenuPictureFragment menuPictureFragment = (MenuPictureFragment)…
murkr
  • 634
  • 5
  • 27
-1
votes
1 answer

Taking an edittext field and displaying in a TextView

I am relatively new to coding but have some experience in Java and Android. I have a really basic problem that I have done over and over again but for some reason, this occurrence doesn't work! I have an edittext field which is populated by the…
-1
votes
1 answer

java.lang.IllegalStateException:Could not execute method for android:onClick

I receive this error in crash report of just some users, but I don't understand it! The app works perfectly on almost all user devices! This is not a duplicate question, because app works always, but crashes some times! part of my code, shows the…
AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
-1
votes
1 answer

Error bringing up hourly weather forecast datar: java.lang.IllegalStateException: Could not execute method for android:onClick

I have a runtime issue with my Android studio project. It is a weather app that's trying to bring up hourly forecast data from an API. The intent to bring up the main activity keeps bringing up an IllegalStateException. It looks like there's no…
-1
votes
1 answer

IllegalStateExeption when using JavaFX webEngine.print() function

I've tried everything I can think of, I'm hoping someone out there might have some knowledge I don't. I'm trying to print an HTML document loaded into a JavaFX webview control, and I keep getting an IllegalStateException violation(Even though it…
-1
votes
1 answer

IllegalStateException: Cannot get a NUMERIC value from a STRING cell

I am creating a java program for converting .xlsx files to .Json. I have verified the cell data format to be numeric using the following condition. else if (rw.getCell(j).getCellType() == Cell.CELL_TYPE_NUMERIC) { key = ""…
-1
votes
1 answer

Fixing IllegalStateException

try { Response response = client.newCall(request).execute(); getStockInfoFromJSON(response.body().string()); } catch (IOException | JSONException | IllegalStateException e) { Log.i("GraphAsyncTask", e.toString()); …
Joel J.
  • 425
  • 1
  • 5
  • 14
-1
votes
1 answer

Why am I getting thread exiting with uncaught exception?

I am trying to open another activity according to the sap number entered by the user. But even before the next activity gets opened I get an exception, illegal state exception and thread exiting with uncaught exception. This is the java file from…
boolean
  • 1
  • 3
-1
votes
1 answer

IllegalStateException on AsyncTask

I'm getting a following error when trying to replace a fragment upon receiving a response from AsyncTask: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState The thing is, I get this error randomly upon restarting…
norbert23
  • 73
  • 2
  • 7
-1
votes
1 answer

java.lang.IllegalStateException: The driver executable does not exist - Selenium Webdriver

I get an IllegalStateException while trying to run a basic test code with Selenium Webdriver. This is my code written in eclipse : { ... System.setProperty("webdriver.ie.driver","/IEDriverServer.exe"); WebDriver driver=new…
-1
votes
2 answers

Throwing Null Pointer Exception when finding the current co ordinates of the device

Hey guys I am trying to find the co ordinates of the current device using the GPS and Network based. I am testing this code for API 23. But this code is returning a NullPointerException. The Code is given below: public class AndroidLocationActivity…
-1
votes
3 answers

IlegalStateException when onItemClick after restart

To reproduce, get the SSCCE Android Project on Github and : Touch the hamburger to display navigation menu Select Employees Select an Employee Touch the back button Touch the Overview button Select the application from the list Touch the hamburger…
Al Lelopath
  • 6,448
  • 13
  • 82
  • 139
-1
votes
1 answer

Error: Illegal start of expression static char[][] spielfeld = new char[arraylaenge][arraybreite];

I´m implementing a Sokoban game in Java. I read a game field (Spielfeld) from a .txt file. Now I´m trying to create a char Array after I get the dimensions from the .txt file. The problem is that I get the following error when…
-1
votes
2 answers

How to deserialize a json data using GSON?

[{"contacts": [ { "name": "Ramesh Sippi", "email": "ramesh.sippi@gmail.com", "phone": 9972366543, "officePhone": 80012345676, "latitude": 18.5204, "longitude":…
rozer
  • 131
  • 15