App crashes when opening a questionnaire

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
Post Reply
Don
Posts: 55
Joined: February 15th, 2013, 1:28 pm
Location: Barbados

App crashes when opening a questionnaire

Post by Don »

My app crashes on android whenever I try to open a questionnaire from my menu program. Running the pff file directly from the tablet's file explorer works fine, but trying from the menu app gives the error "Unfortunately, CSEntry has stopped".

The thing is, it works fine on both windows and on my other Samsung Galaxy Tab E tablets that are running Android 7.

I'm using a Samsung Galaxy Note 10.1, 2014 edition. It is running Android 5.1.1. I sent a crash report from bimsurvey1[at]gmail.com. This issue also does not seem to affect all the Samsung Galaxy Notes, but I have been getting a report of it happening every few days. I've tried restarting the tablet, clearing app data, uninstalling and reinstalling the app, making sure it's the latest version. The only thing that works is transferring csentry folder to a Samsung Galaxy Tab E.

I've included a packed application. The only data is in the assignments.csdb file which stores the enumeration districts that each person is assigned to. You can replicate the crash by doing the following:
  1. Enter the username Vtaylor
  2. Enter the user ID 11
  3. Select Round 5
  4. Select ED 548
  5. Select the Enumerator Menu
  6. Select Fill Control Sheet
The app crashes at this point. I find that it also crashes if I select "Change ED" in the main menu.
Attachments
Menu.zip
(93.14 KiB) Downloaded 356 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: App crashes when opening a questionnaire

Post by josh »

I think I see your crash report. We don't see the email addresses on those reports but there are a couple of reports from yesterday with Samsung Galaxy Note 10.1 2014 Edition running Android 5.1 that occur in code that gets called when an application is stopped. That fits with the steps you gave us since your menu application is being stopped in order to launch the control sheet. We will look into the crash and try to fix it for the next release. Unfortunately I don't have a workaround for you at this point other than not using that particular tablet. My guess is that is a latent timing or memory issue and you are just unlucky that it occurs with that model tablet and not others.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: App crashes when opening a questionnaire

Post by josh »

I was just looking a little closer at your application and had one idea to try. If you modify the logic in the onfocus of the interviewer to remove the call to setvalueset() does it still crash? The crash is happening in code that has to do with cleaning up value sets so maybe it is related to that call.
Don
Posts: 55
Joined: February 15th, 2013, 1:28 pm
Location: Barbados

Re: App crashes when opening a questionnaire

Post by Don »

When I remove the calls to setvalueset() and type in the questionnaire ID, it still crashes. The part that I mentioned about it crashing when I try to change ED is fixed when I remove the setvalueset line in that proc.

I'm not sure that the problem is only with the setvalueset() statement because if I look at the pff file afterwards, it contains information relating to the questionnaire that I'm trying to open. Wouldn't that mean that it got past the setvalueset call and successfully wrote to the file before crashing?

I sent a feedback report with the app crashing with the setvalueset statements removed.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: App crashes when opening a questionnaire

Post by josh »

I see a new crash report in the same value set code so maybe your call to setvalueset is not the problem.
Don
Posts: 55
Joined: February 15th, 2013, 1:28 pm
Location: Barbados

Re: App crashes when opening a questionnaire

Post by Don »

Any ideas on what it could be? Is there anything I can do for a workaround?
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: App crashes when opening a questionnaire

Post by josh »

I spent some time running your application in the debugger and stepping through the code but I didn't see anything suspicious. I was never able to get the crash in the value set cleanup code to happen but that code has already changed a bit with initial work for the 7.3 release (still a long ways away) so it may be that it won't happen anymore. I did get the crash that happens in the logic array code to happen once but couldn't get it to happen again. That crash is happening when cleaning up the arrays you declare in the onfocus of PROC ME_ED but I don't see why it would be a problem. You could try putting those array declarations into the proc global instead of in PROC ME_ED and see if it helps.
Don
Posts: 55
Joined: February 15th, 2013, 1:28 pm
Location: Barbados

Re: App crashes when opening a questionnaire

Post by Don »

I found a strange workaround. if I place an errmsg statement just before the vsEDCode(nextEntry) = notappl; like this

Code: Select all

		nextEntry = 1;
		uid = maketext("%V",USERID);
		if loadcase(ALLOCATION_DICT,uid) then
			while nextEntry <= count(AED) do
				if AROUND = ME_ROUND then
					vsEDCode(nextEntry) = AED(nextEntry);
					vsLabel(nextEntry) = maketext("%v",AED(nextEntry));
				endif;
				inc(nextEntry);
			enddo;
		endif;
		errmsg("Choose an ED");	//display a message
		vsEDCode(nextEntry) = notappl;

		setvalueset(ME_ED, vsEDCode, vsLabel);
It seems to work just fine. However, the message being displayed whenever starting up the app or changing the ED is kind of annoying. I also tried using a warning statement instead to minimize the messages but that doesn't seem to work.
Post Reply