Chrisbane PullToRefreshListView IllegalStateException - android

I had to implement iOS like pull to refresh list in my Android app. I decided to go for this library. It's pull to refresh performance is awesome. But I'm facing one random exception which leads to app crash. It happens sometime that IllegalStateException is thrown pointing to this line in PullToRefreshListView.java in InternalListView class code.
return super.dispatchTouchEvent(ev);
I'm unable to understand this issue. Can any body guide me to solve this issue please.

Please check, you might be calling notifyDataSetChanged() too often in short intervals.
You can go through this link.Chrisbane PullToRefreshListView IllegalStateException

Actually I was missing notifyDataSetChanged() in one of the callbacks. Adding resolved the issue. Thanks everyone who spared time to reply to this question.

Related

CodenameOne: Getting Error while click on Menu Item

I have developed app using codename one.It was working fine initially.but since 3-4 days getting issues.When I clicked on Menu Item it giving below error
an internal application error occurred:java.lang.NullPointerException:Attempt to invoke virtual method'void com.codename1.o.al.bj() on null object refference
Iniially every thing was working fine but since 3-4 days it giving issues like that.
Please help me to solve this issue?
Thanks in advance.
I have submited an issue last Friday. This is due to the last update and will be fixed on the next update (next Friday). You can workaround it by disabling the on top side menu for now with: yourForm.getToolbar().setOnTopSideMenu(false);
We can not analyse what went wrong, because error is a generic "Null Pointer Exception". We need to know complete functionality and what different behaviour happened. Please provide us with some more details if possible.

How to fix error java.util.ConcurrentModificationException?

I have some problem with java.util.ConcurrentModificationException. When I deleted one characater or more in my autocompletetext I got force close. Anybody knows what happen with that ? and what is the solution for that problem ?
Thank You.
It looks like you are adding and deleting something from your collection at same point of time. By doing this, you are structurally modifying the collections more than once at single point of time. Hence you are getting java.util.ConcurrentModificationException, which is the result of "Fail-Fast" iterators being used in your collections.
You can have a look at this link which explains fail-safe and fail-fast iterators.
what-is-fail-safe-fail-fast-iterators-in-java-how-they-are-implemented and checkout the answer written by Stephen C.

Is the querylist in the asyncSession working?

i am currently stuck in a problem with the asyncSession. I tried to not just make a list, i wanted to call asyncSession.queryList().
I don't have the log-file rightnow, but it basically said that the query wasn't build in the currentThreat. (I am building it one line above)
So i tried to add .forCurrentThread(), but i got the same error.
Is this feature basically working?
Otherwise i will bring some more information tomorrow.
I ran into the same problem and came to the conclusion this was a bug. I ended up changing the method executeOperation() in AsyncOperationExecutor.java:
case QueryList:
operation.result = ((Query) operation.parameter).forCurrentThread().list();
break;
case QueryUnique:
operation.result = ((Query) operation.parameter).forCurrentThread().unique();
break;
Adding in the call to forCurrentThread() changes the owning thread of the Query to the thread of the ExecutorService. This made it work for me, I wonder if there is a better solution though.

Cannot call 'SetContentView' on new activity - Android Mono

I've had a search for this problem but nothing seems to help me to solve this particular error I am getting.
I am writing my first Android app and am coming across a java.lang.RuntimeException whenever I call SetContentView on a new activity.
There is nothing in the logcat which helps (an activity idle timeout is all because it falters on the call).
My activity Login has a layout set during OnCreate which works fine, but any subsequent calls fall over. Here's some code ;)
[Activity(Label = "Usage")]
public class Usage : TabActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
//**FALLS OVER HERE**
SetContentView(Resource.Layout.Usage);
The Resource.Designer.cs has a record of my layout:
// aapt resource value: 0x7f030002
public const int Usage = 2130903042;
...and when I reference that layout by it's int value it falls back to the previous activity without hitting any breakpoints in the Usage activity.
Anyone got any thoughts or can point me in the direction of a similar post?
Legends!
UPDATE
I tried a whole stack of fixes I found on forums etc but nothing would fix this. I put the whole thing on the backburner while I worked on something else, came back to it and now it works...wish I could say what it was that made it work to help others out but I can't explain it! COULD have been an update to a new version of MonoDroid?
As stated in my comment to Stuart's answer, this problem appears to have resolved itself. I revisited the project all this time later and think that it might have just been a case of cleaning the project and rebuilding all. I have not had this problem since.
Sorry that this is not a detailed answer, I would suggest trying the ol' clean and rebuild.
I've recently had some issues when working in VS2010 where the resource ids are being not kept perfectly in-sync with the resource files and the java ids.
To resolve these, I generally find the quickest way is to add a new id to one of the layout xml files - this then causes a regeneration or the resources.cs file which then means the app works again.
If that doesn't help, then please post more info about what the message inside the RuntimeException is,
Although it's very late response, but someone who might be getting this sort of error. Wrap it with try-catch and it gives more details about the exception. I spent few hours before figuring out to do that

Can't find the source of a DatabaseObjectNotClosedException error

I'm having a hard time figuring out what my problem is here. I'm receiving this error in my program, but it does not cause a crash or anything like that. I have an update I'd like to release, but I don't want to release it with this error being thrown at certain times. I've read all related posts on this error, but none apply to my situation.
I've made sure that I am closing my DatabaseHelper and SQLiteDatabase objects. I've also made sure that I'm closing all of my cursors. This error is pointing toward my method getActiveScheduleInfo, which returns a Cursor object. I've made sure that whenever I call this method, the returned cursor is closed in a Finally block.
Is this incorrect to do it this way? In my methods that call getActiveScheduleInfo, I have multiple return statements in them, based on certain conditions. So, instead of closing the cursor before each return line, I surround the condition testing with a Try, and close everything down in my Finally.
Everything looks like it should be working, so I'd really appreciate any help!
Thanks a lot!
Paul
I was able to figure this out! I hope that this helps someone else out there having the same problem.
I wasn't doing anything inherently incorrect here, but was rather taking too long to close some of my cursors. To give you a very brief background, I could not use a Managed Query or use startManagingCursor, since this code was in a custom class, not an activity. I am building against Android 2.0 (API level 5) so I am not using the new CursorLoader object.
I was taking the following steps:
Opening the database.
Creating a new Cursor and performing my query.
Iterating through the cursor and performing the needed tasks
Performing some other logic
Closing the Cursor and Database in a Finally block.
I found out that my step 4, performing some other logic, coming before closing my Cursor, was causing it to, for lack of a better term, timeout and cause this error. From now on, I read the necessary data from the Cursor, and not ONE LINE OF CODE FURTHER, I close the Cursor. :) This has completely eliminated these random errors, and I have clean-running code again.
I hope that helps others having the same problem! Take care,
Paul

Categories

Resources