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.
Related
I am developing an Android app (It doesn't matter though) using RxJava2, and in some singleton there are some PublishProcessors.
And there are a lot of .onNext() calls on these PublishProcessors all over the project.
Now in order to debug, I need to know, on every .onNext() called, which line in my project invoked this .onNext().
Is there a way in RxJava(2) that I can achieve this?
I think you can use Frames tab in Debug menu.
For example, in this case, MainActivity line 18 trigger onNext
Ah, thanks to #PhanVanLinh, I found a solution that worked for me.
(Actually it has pretty much nothing to do with RxJava...)
You just need to print the stacktrace using Thread.currentThread.stackTrace and print it to your own string inside doOnNext(), but remember to do it before .observeOn() so that the thread won't switch, it must stay at the original thread that called .onNext(), otherwise you won't get meaningful information.
Then you will know which line that called .onNext().
I need to update several visual components in my app during a timeconsuming function, instead my app seems to hang during this function call, rather than update the visual components on the screen. When the function exit, I see only the last changes to the components.
Is there a simple way to do the updates, or do I need to create a parallel process and have a 'timer' to read the data simultaniously (using semaphores) and present them in the timer call ?
Any suggestions ?
I asked the same question yesterday here. Like mh taqia said you can use Application->ProcessMessages() but you have to be careful with it. For my application, it worked but look at some posts about the function first.
I tried following:
MainForm->Invalidate();
MyControlRoot->Repaint();
MyControlRoot is a control containing somewhat 50-60 different other controls
But MyControlRoot wouldn't repaint with this method. ..
Despite the warnings from you Remy, I tried Application->ProcessMessages();
...works for now...
By the way... I cannot see any warnings in Docwiki on using ProcessMessages... what could I expect?
RG
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.
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
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