Questions tagged «illegalstateexception»

30
IllegalStateException:使用ViewPager在onSaveInstanceState之后无法执行此操作
我从市场上的应用程序中获取用户报告,但出现以下异常: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1109) at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:399) at android.app.Activity.onBackPressed(Activity.java:2066) at android.app.Activity.onKeyUp(Activity.java:2044) at android.view.KeyEvent.dispatch(KeyEvent.java:2529) at android.app.Activity.dispatchKeyEvent(Activity.java:2274) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1803) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1855) at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1277) at android.app.Activity.dispatchKeyEvent(Activity.java:2269) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1803) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.widget.TabHost.dispatchKeyEvent(TabHost.java:297) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at …

30
正在获取异常“ IllegalStateException:onSaveInstanceState之后无法执行此操作”
我有一个Live Android应用程序,从市场上我收到了以下堆栈跟踪信息,我不知道为什么它发生在应用程序代码中而不是发生,而是由应用程序中的某些或其他事件引起的(假设) 我没有使用Fragments,但仍然有FragmentManager的引用。如果有人可以对某些隐藏的事实有所了解,以避免此类问题: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1109) at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:399) at android.app.Activity.onBackPressed(Activity.java:2066) at android.app.Activity.onKeyDown(Activity.java:1962) at android.view.KeyEvent.dispatch(KeyEvent.java:2482) at android.app.Activity.dispatchKeyEvent(Activity.java:2274) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1668) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1720) at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1258) at android.app.Activity.dispatchKeyEvent(Activity.java:2269) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1668) at android.view.ViewRoot.deliverKeyEventPostIme(ViewRoot.java:2851) at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2824) at …

18
java.lang.IllegalStateException:onSaveInstanceState之后无法执行此操作
我正在为我的应用程序使用支持库。在我的FragmentActivity中,我使用AsyncTask从互联网下载数据。在onPreExecute()方法中,我添加一个片段,在onPostExecute()方法中,我再次将其删除。当方向在这两者之间改变时,出现上述异常。请看一下详细信息: private class onFriendAddedAsyncTask extends AsyncTask<String, Void, String> { DummyFragment dummyFragment; FragmentManager fm; FragmentTransaction ft; @Override protected void onPreExecute() { Log.v("MyFragmentActivity", "onFriendAddedAsyncTask/onPreExecute"); dummyFragment = DummyFragment.newInstance(); fm = getSupportFragmentManager(); ft = fm.beginTransaction(); ft.add(dummyFragment, "dummy_fragment"); ft.commit(); } @Override protected void onPostExecute(String result) { Log.v("MyFragmentActivity", "onFriendAddedAsyncTask/onPostExecute"); ft = fm.beginTransaction(); ft.remove(dummyFragment); ft.commit(); } @Override …

8
java.lang.IllegalStateException:提交响应后无法(转发| sendRedirect |创建会话)
该方法抛出 java.lang.IllegalStateException:提交响应后无法转发 我无法发现问题。有什么帮助吗? int noOfRows = Integer.parseInt(request.getParameter("noOfRows")); String chkboxVal = ""; // String FormatId=null; Vector vRow = new Vector(); Vector vRow1 = new Vector(); String GroupId = ""; String GroupDesc = ""; for (int i = 0; i < noOfRows; i++) { if ((request.getParameter("chk_select" + i)) == null) { chkboxVal …

6
IllegalStateException的预期用途是什么?
今天在与同事的讨论中提出了这一点。 Javadocs for JavaIllegalStateException指出: 表示已在非法或不适当的时间调用了方法。换句话说,对于所请求的操作,Java环境或Java应用程序没有处于适当的状态。 而有效的Java说(第248页的第60项): 另一个通常重用的异常是IllegalStateException。如果由于接收对象的状态而调用是非法的,通常会抛出异常。例如,如果调用者在正确初始化某个对象之前尝试使用该对象,则将引发异常。 似乎这里有些差异。javadocs的第二句话听起来像是异常可以描述关于Java执行状态的非常广泛的条件,但是Effective Java中的描述听起来像是它用于特定于对象状态的条件,该对象的状态方法已被调用。 我在JDK(例如collections Matcher)和Guava中看到的用法肯定似乎属于Effective Java所谈论的类别(“此对象处于无法调用此方法的状态”)。这似乎也与IllegalStateException的兄弟姐妹一致IllegalArgumentException。 IllegalStateExceptionJDK中是否有任何与“ Java环境”或“ Java应用程序”相关的合法用法?还是有任何最佳实践指南倡导将其用于更广泛的执行状态?如果不是这样,为什么javadocs这样写呢?;)

11
Spring / Java错误:JDK 1.5及更高版本上的名称空间元素'annotation-config'…
我有使用Compiler兼容级别1.5编译的Spring / Java App 。 我有一个新的Linux设置,我在其中下载了Apache Tomcat 8.0.8。 我下载了JDK 8u5。 我在bash中设置路径,如下所示: PATH=$PATH:$HOME/jdk1.8.0_05/bin export PATH Java版本报告: java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) 并在setnenv.sh中设置(对于Tomcat): JDK_HOME=/home/userid/jdk1.8.0_05 部署WAR文件时,出现以下错误。我认为Tomcat似乎没有使用我安装的Java。我已按照安装说明进行操作。PS:我还尝试了JRE而不是JDK,并且遇到了同样的问题。 22-May-2014 11:34:54.070 INFO [http-nio-8080-exec-4] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext 22-May-2014 11:34:54.512 SEVERE [http-nio-8080-exec-4] org.apache.catalina.core.StandardContext.listenerStart …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.