illegalstateexception

IllegalStateException when MediaCodec.configure Android

帅比萌擦擦* 提交于 2019-12-01 15:08:09
问题 I try create encoder for "audio/3gpp" and my app crash... I use this code String mMime = "audio/3gpp"; MediaCodec mMediaCodec = MediaCodec.createEncoderByType(mMime); MediaFormat mMediaFormat = MediaFormat.createAudioFormat(mMime, RECORDER_SAMPLERATE, 1); mMediaCodec.configure(mMediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); mMediaCodec.start(); Exception java.lang.IllegalStateException android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure

Robolectric: IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

筅森魡賤 提交于 2019-12-01 15:02:21
I'm new to Robolectric and instrumentation testing in general on Android. I followed along the guide for Robolectric for testing my first test. However I'm getting: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. I searched for the error, but no solution is helping. I'm including everything that could cause this error. Gradle: apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' //needed for source code generation apply plugin: 'jacoco' apply plugin: 'de.mobilej.unmock' android { compileSdkVersion 22

Robolectric: IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

半世苍凉 提交于 2019-12-01 13:54:08
问题 I'm new to Robolectric and instrumentation testing in general on Android. I followed along the guide for Robolectric for testing my first test. However I'm getting: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. I searched for the error, but no solution is helping. I'm including everything that could cause this error. Gradle: apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' //needed for source

IllegalStateException when trying to .getSessionMap() from a Session Scoped Bean

主宰稳场 提交于 2019-12-01 13:27:48
I'm new to Java and JSF. I need help with an IllegalStateException. Here's the scenario: In my current project i have this Session Scoped bean for the application menu: public final class MenuBean implements Serializable{ private MenuModel model; private FacesContext context = FacesContext.getCurrentInstance(); public MenuModel getModel() { return model; } public MenuBean() { updateMenu(); } public void updateMenu(){ Map session = (Map<String,Object>) context.getExternalContext().getSessionMap(); EUser user = (EUser) session.get(UserBean.USER_SESSION_KEY); ... } private MethodExpression

IllegalStateException when trying to .getSessionMap() from a Session Scoped Bean

别等时光非礼了梦想. 提交于 2019-12-01 09:58:55
问题 I'm new to Java and JSF. I need help with an IllegalStateException. Here's the scenario: In my current project i have this Session Scoped bean for the application menu: public final class MenuBean implements Serializable{ private MenuModel model; private FacesContext context = FacesContext.getCurrentInstance(); public MenuModel getModel() { return model; } public MenuBean() { updateMenu(); } public void updateMenu(){ Map session = (Map<String,Object>) context.getExternalContext()

SQLiteDatabase Error, unhelpful Log

▼魔方 西西 提交于 2019-12-01 09:30:44
I released an update of my app and am getting a ton of errors from users and I can't recreate it or pin-point the problem. Two errors I'm getting: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase java.lang.IllegalStateException: database not open The error is happening somewhere in the following code: public DBUserC getUser(int _id){ synchronized (DBAdapter.LOCK){ M.openDB(context); Cursor cursor = M.database.query(DBUserHelper.TABLE_USERS, VUser.allColumns, DBUserHelper.COLUMN_ID + " = '"+_id+"'", null, null, null, null); DBUserC user; if (cursor

java.lang.IllegalStateException: attempt to re-open an already-closed object

梦想与她 提交于 2019-12-01 09:05:53
I'm trying to figure out why occasionally I'm getting the IllegalStateException. I can't find any good examples that show how to load a list using a thread to query a SQLite database. I've included my code below. Most of the time it works correctly, but occasionally, I'm getting the IllegalStateException. I have also gotten a similar exception in another activity of mine that is an instance of ExpandableListActivity. That exception states "trying to requery an already closed cursor". Can somebody tell me the correct way to do this so that it doesn't cause any errors? I would prefer to use the

SQLiteDatabase Error, unhelpful Log

心不动则不痛 提交于 2019-12-01 07:44:15
问题 I released an update of my app and am getting a ton of errors from users and I can't recreate it or pin-point the problem. Two errors I'm getting: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase java.lang.IllegalStateException: database not open The error is happening somewhere in the following code: public DBUserC getUser(int _id){ synchronized (DBAdapter.LOCK){ M.openDB(context); Cursor cursor = M.database.query(DBUserHelper.TABLE_USERS, VUser

java.lang.IllegalStateException: attempt to re-open an already-closed object

霸气de小男生 提交于 2019-12-01 06:34:52
问题 I'm trying to figure out why occasionally I'm getting the IllegalStateException. I can't find any good examples that show how to load a list using a thread to query a SQLite database. I've included my code below. Most of the time it works correctly, but occasionally, I'm getting the IllegalStateException. I have also gotten a similar exception in another activity of mine that is an instance of ExpandableListActivity. That exception states "trying to requery an already closed cursor". Can

AudioTrack: play() called on uninitialized AudioTrack

99封情书 提交于 2019-12-01 03:42:15
I'm experimenting with AudioTrack class. Basically, my app has to generate a sound when the user touches a specific object on screen. I've used this example as a guide. My app seems to work as it should but usually after touching the screen for about a minute it crashes: 07-02 20:40:53.459: E/AndroidRuntime(11973): FATAL EXCEPTION: Thread-10 07-02 20:40:53.459: E/AndroidRuntime(11973): java.lang.IllegalStateException: play() called on uninitialized AudioTrack. 07-02 20:40:53.459: E/AndroidRuntime(11973): at android.media.AudioTrack.play(AudioTrack.java:824) 07-02 20:40:53.459: E/AndroidRuntime