A form to be shown at all times

Hi.
I want one form to be there as soon as odk collect is opened. The form
shouldn't have to be downloaded from the aggregate. The form will be
in res/raw folder and it will be downloaded along with the odk collect
software. I have been trying to figure out where and how to edit the
source code so I can accommodate this.

Any help would be greatly appreciated.
Thanks
Kartikey

probably easiest to copy the files from res/raw to the /odk/forms on
first run. we check for first run in the splashscreen activity, so
maybe spawn an async task there to do the copy.

··· On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: > Hi. > I want one form to be there as soon as odk collect is opened. The form > shouldn't have to be downloaded from the aggregate. The form will be > in res/raw folder and it will be downloaded along with the odk collect > software. I have been trying to figure out where and how to edit the > source code so I can accommodate this. > > Any help would be greatly appreciated. > Thanks > Kartikey > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

I am not sure what you mean. I am beginner in this so would appreciate
if you could clarify it.
To clarify on my end, I would like one form to be placed in either res/
raw or res/xml folder and I would like it to be visible to the client
when he/she clicks the 'start form' button. The client shouldn't have
to downloaded the form from any server.

Thanks

··· On Jul 15, 11:07 pm, Yaw Anokwa wrote: > probably easiest to copy the files from res/raw to the /odk/forms on > first run. we check for first run in the splashscreen activity, so > maybe spawn an async task there to do the copy. > > On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: > > Hi. > > I want one form to be there as soon as odk collect is opened. The form > > shouldn't have to be downloaded from the aggregate. The form will be > > in res/raw folder and it will be downloaded along with the odk collect > > software. I have been trying to figure out where and how to edit the > > source code so I can accommodate this. > > > Any help would be greatly appreciated. > > Thanks > > Kartikey > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options:http://groups.google.com/group/opendatakit?hl=en

let me try again...

the easiest way to accomplish this is to copy the files from the res
folder to the odk/forms folder the first time collect is launched. you
can insert code in the splashscreen activity
(http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/activities/SplashScreenActivity.java?repo=collect)
that runs when the first time collect is launched. that code should be
an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html)
that does the file copy. you'll likely have to also pop up some
progress dialog (see the tasks in collect for examples).

if any of that doesn't make any sense, then you should probably brush
up on some android java first before continuing.
http://developer.android.com/index.html is a good place to start.

··· On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: > I am not sure what you mean. I am beginner in this so would appreciate > if you could clarify it. > To clarify on my end, I would like one form to be placed in either res/ > raw or res/xml folder and I would like it to be visible to the client > when he/she clicks the 'start form' button. The client shouldn't have > to downloaded the form from any server. > > Thanks > > On Jul 15, 11:07 pm, Yaw Anokwa wrote: >> probably easiest to copy the files from res/raw to the /odk/forms on >> first run. we check for first run in the splashscreen activity, so >> maybe spawn an async task there to do the copy. >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: >> > Hi. >> > I want one form to be there as soon as odk collect is opened. The form >> > shouldn't have to be downloaded from the aggregate. The form will be >> > in res/raw folder and it will be downloaded along with the odk collect >> > software. I have been trying to figure out where and how to edit the >> > source code so I can accommodate this. >> >> > Any help would be greatly appreciated. >> > Thanks >> > Kartikey >> >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options:http://groups.google.com/group/opendatakit?hl=en > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

okay I get it now. Thanks a lot for your quick reply.

··· On Jul 18, 10:35 am, Yaw Anokwa wrote: > let me try again... > > the easiest way to accomplish this is to copy the files from the res > folder to the odk/forms folder the first time collect is launched. you > can insert code in the splashscreen activity > (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) > that runs when the first time collect is launched. that code should be > an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html) > that does the file copy. you'll likely have to also pop up some > progress dialog (see the tasks in collect for examples). > > if any of that doesn't make any sense, then you should probably brush > up on some android java first before continuing.http://developer.android.com/index.htmlis a good place to start. > > On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: > > I am not sure what you mean. I am beginner in this so would appreciate > > if you could clarify it. > > To clarify on my end, I would like one form to be placed in either res/ > > raw or res/xml folder and I would like it to be visible to the client > > when he/she clicks the 'start form' button. The client shouldn't have > > to downloaded the form from any server. > > > Thanks > > > On Jul 15, 11:07 pm, Yaw Anokwa wrote: > >> probably easiest to copy the files from res/raw to the /odk/forms on > >> first run. we check for first run in the splashscreen activity, so > >> maybe spawn an async task there to do the copy. > > >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: > >> > Hi. > >> > I want one form to be there as soon as odk collect is opened. The form > >> > shouldn't have to be downloaded from the aggregate. The form will be > >> > in res/raw folder and it will be downloaded along with the odk collect > >> > software. I have been trying to figure out where and how to edit the > >> > source code so I can accommodate this. > > >> > Any help would be greatly appreciated. > >> > Thanks > >> > Kartikey > > >> > -- > >> > Post: opendatakit@googlegroups.com > >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> > Options:http://groups.google.com/group/opendatakit?hl=en > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options:http://groups.google.com/group/opendatakit?hl=en

great!

if you have more developer questions, send them to
opendatakit-developers@googlegroups.com. you can also find us on irc
at #opendatakit on freenode.net

··· On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan wrote: > okay I get it now. Thanks a lot for your quick reply. > > On Jul 18, 10:35 am, Yaw Anokwa wrote: >> let me try again... >> >> the easiest way to accomplish this is to copy the files from the res >> folder to the odk/forms folder the first time collect is launched. you >> can insert code in the splashscreen activity >> (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) >> that runs when the first time collect is launched. that code should be >> an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html) >> that does the file copy. you'll likely have to also pop up some >> progress dialog (see the tasks in collect for examples). >> >> if any of that doesn't make any sense, then you should probably brush >> up on some android java first before continuing.http://developer.android.com/index.htmlis a good place to start. >> >> On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: >> > I am not sure what you mean. I am beginner in this so would appreciate >> > if you could clarify it. >> > To clarify on my end, I would like one form to be placed in either res/ >> > raw or res/xml folder and I would like it to be visible to the client >> > when he/she clicks the 'start form' button. The client shouldn't have >> > to downloaded the form from any server. >> >> > Thanks >> >> > On Jul 15, 11:07 pm, Yaw Anokwa wrote: >> >> probably easiest to copy the files from res/raw to the /odk/forms on >> >> first run. we check for first run in the splashscreen activity, so >> >> maybe spawn an async task there to do the copy. >> >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: >> >> > Hi. >> >> > I want one form to be there as soon as odk collect is opened. The form >> >> > shouldn't have to be downloaded from the aggregate. The form will be >> >> > in res/raw folder and it will be downloaded along with the odk collect >> >> > software. I have been trying to figure out where and how to edit the >> >> > source code so I can accommodate this. >> >> >> > Any help would be greatly appreciated. >> >> > Thanks >> >> > Kartikey >> >> >> > -- >> >> > Post: opendatakit@googlegroups.com >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options:http://groups.google.com/group/opendatakit?hl=en > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

One more thing. I have created the async class in splashscreen
activity.
Now I am wondering where to execute the class in splashscreen
activity, meaning where should I run this:
CopyForm form = new CopyForm();
form.execute("");

Thanks again

··· On Jul 18, 11:28 am, Yaw Anokwa wrote: > great! > > if you have more developer questions, send them to > opendatakit-developers@googlegroups.com. you can also find us on irc > at #opendatakit on freenode.net > > On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan wrote: > > okay I get it now. Thanks a lot for your quick reply. > > > On Jul 18, 10:35 am, Yaw Anokwa wrote: > >> let me try again... > > >> the easiest way to accomplish this is to copy the files from the res > >> folder to the odk/forms folder the first time collect is launched. you > >> can insert code in the splashscreen activity > >> (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) > >> that runs when the first time collect is launched. that code should be > >> an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html) > >> that does the file copy. you'll likely have to also pop up some > >> progress dialog (see the tasks in collect for examples). > > >> if any of that doesn't make any sense, then you should probably brush > >> up on some android java first before continuing.http://developer.android.com/index.htmlisa good place to start. > > >> On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: > >> > I am not sure what you mean. I am beginner in this so would appreciate > >> > if you could clarify it. > >> > To clarify on my end, I would like one form to be placed in either res/ > >> > raw or res/xml folder and I would like it to be visible to the client > >> > when he/she clicks the 'start form' button. The client shouldn't have > >> > to downloaded the form from any server. > > >> > Thanks > > >> > On Jul 15, 11:07 pm, Yaw Anokwa wrote: > >> >> probably easiest to copy the files from res/raw to the /odk/forms on > >> >> first run. we check for first run in the splashscreen activity, so > >> >> maybe spawn an async task there to do the copy. > > >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: > >> >> > Hi. > >> >> > I want one form to be there as soon as odk collect is opened. The form > >> >> > shouldn't have to be downloaded from the aggregate. The form will be > >> >> > in res/raw folder and it will be downloaded along with the odk collect > >> >> > software. I have been trying to figure out where and how to edit the > >> >> > source code so I can accommodate this. > > >> >> > Any help would be greatly appreciated. > >> >> > Thanks > >> >> > Kartikey > > >> >> > -- > >> >> > Post: opendatakit@googlegroups.com > >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> >> > Options:http://groups.google.com/group/opendatakit?hl=en > > >> > -- > >> > Post: opendatakit@googlegroups.com > >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> > Options:http://groups.google.com/group/opendatakit?hl=en > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options:http://groups.google.com/group/opendatakit?hl=en

Related question: How can you put shortcuts on the home screen that
launch individual forms? This would take some clicks out of the
process for enumerators.
I have thought of doing this with Android AnyCut or BetterCut.

Neil

··· On Jul 18, 2:28 am, Yaw Anokwa wrote: > great! > > if you have more developer questions, send them to > opendatakit-developers@googlegroups.com. you can also find us on irc > at #opendatakit on freenode.net > > On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan wrote: > > okay I get it now. Thanks a lot for your quick reply. > > > On Jul 18, 10:35 am, Yaw Anokwa wrote: > >> let me try again... > > >> the easiest way to accomplish this is to copy the files from the res > >> folder to the odk/forms folder the first time collect is launched. you > >> can insert code in the splashscreen activity > >> (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) > >> that runs when the first time collect is launched. that code should be > >> an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html) > >> that does the file copy. you'll likely have to also pop up some > >> progress dialog (see the tasks in collect for examples). > > >> if any of that doesn't make any sense, then you should probably brush > >> up on some android java first before continuing.http://developer.android.com/index.htmlisa good place to start. > > >> On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: > >> > I am not sure what you mean. I am beginner in this so would appreciate > >> > if you could clarify it. > >> > To clarify on my end, I would like one form to be placed in either res/ > >> > raw or res/xml folder and I would like it to be visible to the client > >> > when he/she clicks the 'start form' button. The client shouldn't have > >> > to downloaded the form from any server. > > >> > Thanks > > >> > On Jul 15, 11:07 pm, Yaw Anokwa wrote: > >> >> probably easiest to copy the files from res/raw to the /odk/forms on > >> >> first run. we check for first run in the splashscreen activity, so > >> >> maybe spawn an async task there to do the copy. > > >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: > >> >> > Hi. > >> >> > I want one form to be there as soon as odk collect is opened. The form > >> >> > shouldn't have to be downloaded from the aggregate. The form will be > >> >> > in res/raw folder and it will be downloaded along with the odk collect > >> >> > software. I have been trying to figure out where and how to edit the > >> >> > source code so I can accommodate this. > > >> >> > Any help would be greatly appreciated. > >> >> > Thanks > >> >> > Kartikey > > >> >> > -- > >> >> > Post: opendatakit@googlegroups.com > >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> >> > Options:http://groups.google.com/group/opendatakit?hl=en > > >> > -- > >> > Post: opendatakit@googlegroups.com > >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> > Options:http://groups.google.com/group/opendatakit?hl=en > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options:http://groups.google.com/group/opendatakit?hl=en

execute it when first run is true.
http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/activities/SplashScreenActivity.java?repo=collect#71

also, it would be a good idea for to follow how use tasks, listeners
and activities. you need to implement a listener on the relevant
activities. the disk sync task is a good place to start.
http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/?repo=collect#android%2Ftasks

··· On Mon, Jul 18, 2011 at 04:17, Kartikey Badgaiyan wrote: > One more thing. I have created the async class in splashscreen > activity. > Now I am wondering where to execute the class in splashscreen > activity, meaning where should I run this: > CopyForm form = new CopyForm(); > form.execute(""); > > Thanks again > > On Jul 18, 11:28 am, Yaw Anokwa wrote: >> great! >> >> if you have more developer questions, send them to >> opendatakit-developers@googlegroups.com. you can also find us on irc >> at #opendatakit on freenode.net >> >> On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan wrote: >> > okay I get it now. Thanks a lot for your quick reply. >> >> > On Jul 18, 10:35 am, Yaw Anokwa wrote: >> >> let me try again... >> >> >> the easiest way to accomplish this is to copy the files from the res >> >> folder to the odk/forms folder the first time collect is launched. you >> >> can insert code in the splashscreen activity >> >> (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) >> >> that runs when the first time collect is launched. that code should be >> >> an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html) >> >> that does the file copy. you'll likely have to also pop up some >> >> progress dialog (see the tasks in collect for examples). >> >> >> if any of that doesn't make any sense, then you should probably brush >> >> up on some android java first before continuing.http://developer.android.com/index.htmlisa good place to start. >> >> >> On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: >> >> > I am not sure what you mean. I am beginner in this so would appreciate >> >> > if you could clarify it. >> >> > To clarify on my end, I would like one form to be placed in either res/ >> >> > raw or res/xml folder and I would like it to be visible to the client >> >> > when he/she clicks the 'start form' button. The client shouldn't have >> >> > to downloaded the form from any server. >> >> >> > Thanks >> >> >> > On Jul 15, 11:07 pm, Yaw Anokwa wrote: >> >> >> probably easiest to copy the files from res/raw to the /odk/forms on >> >> >> first run. we check for first run in the splashscreen activity, so >> >> >> maybe spawn an async task there to do the copy. >> >> >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: >> >> >> > Hi. >> >> >> > I want one form to be there as soon as odk collect is opened. The form >> >> >> > shouldn't have to be downloaded from the aggregate. The form will be >> >> >> > in res/raw folder and it will be downloaded along with the odk collect >> >> >> > software. I have been trying to figure out where and how to edit the >> >> >> > source code so I can accommodate this. >> >> >> >> > Any help would be greatly appreciated. >> >> >> > Thanks >> >> >> > Kartikey >> >> >> >> > -- >> >> >> > Post: opendatakit@googlegroups.com >> >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> >> > -- >> >> > Post: opendatakit@googlegroups.com >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options:http://groups.google.com/group/opendatakit?hl=en > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

you can do a long press on the home screen. from there, select
shortcut, and then odk form.

··· On Mon, Jul 18, 2011 at 08:51, mojo wrote: > Related question: How can you put shortcuts on the home screen that > launch individual forms? This would take some clicks out of the > process for enumerators.

To clarify a bit, listeners are only required if you want feedback from your
asynctask and/or if bad things could happen when the screen rotates.
Progress dialogs are only necessary if the user can't continue until the
task is complete (like loading a form). In your case, since all you're
doing is checking for the existence of a file and copying that file if it
doesn't exist, you should be able to just fire off your task and be done
with it (no listeners or dialogs required).

In fact, spawning a simple thread should be fine in your case if you don't
want to bother with asynctask.
-Carl

··· On Mon, Jul 18, 2011 at 9:08 AM, Yaw Anokwa wrote:

execute it when first run is true.

http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/activities/SplashScreenActivity.java?repo=collect#71

also, it would be a good idea for to follow how use tasks, listeners
and activities. you need to implement a listener on the relevant
activities. the disk sync task is a good place to start.

http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/?repo=collect#android%2Ftasks

On Mon, Jul 18, 2011 at 04:17, Kartikey Badgaiyan kdbadgaiyan11@gmail.com wrote:

One more thing. I have created the async class in splashscreen
activity.
Now I am wondering where to execute the class in splashscreen
activity, meaning where should I run this:
CopyForm form = new CopyForm();
form.execute("");

Thanks again

On Jul 18, 11:28 am, Yaw Anokwa yano...@gmail.com wrote:

great!

if you have more developer questions, send them to
opendatakit-developers@googlegroups.com. you can also find us on irc
at #opendatakit on freenode.net

On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan kdbadgaiya...@gmail.com wrote:

okay I get it now. Thanks a lot for your quick reply.

On Jul 18, 10:35 am, Yaw Anokwa yano...@gmail.com wrote:

let me try again...

the easiest way to accomplish this is to copy the files from the res
folder to the odk/forms folder the first time collect is launched.
you
can insert code in the splashscreen activity
(
http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...)
that runs when the first time collect is launched. that code should
be
an asynctask (
http://developer.android.com/reference/android/os/AsyncTask.html)
that does the file copy. you'll likely have to also pop up some
progress dialog (see the tasks in collect for examples).

if any of that doesn't make any sense, then you should probably brush
up on some android java first before continuing.
http://developer.android.com/index.htmlisa good place to start.

On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan kdbadgaiya...@gmail.com wrote:

I am not sure what you mean. I am beginner in this so would
appreciate
if you could clarify it.
To clarify on my end, I would like one form to be placed in either
res/
raw or res/xml folder and I would like it to be visible to the
client
when he/she clicks the 'start form' button. The client shouldn't
have
to downloaded the form from any server.

Thanks

On Jul 15, 11:07 pm, Yaw Anokwa yano...@gmail.com wrote:

probably easiest to copy the files from res/raw to the /odk/forms
on
first run. we check for first run in the splashscreen activity, so
maybe spawn an async task there to do the copy.

On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan kdbadgaiya...@gmail.com wrote:

Hi.
I want one form to be there as soon as odk collect is opened.
The form
shouldn't have to be downloaded from the aggregate. The form
will be
in res/raw folder and it will be downloaded along with the odk
collect
software. I have been trying to figure out where and how to edit
the
source code so I can accommodate this.

Any help would be greatly appreciated.
Thanks
Kartikey

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options:http://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options:http://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options:http://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

i appreciate all this help. but somehow its still now copying to sd
card.
this is my async task:
class CopyForm extends AsyncTask<String, String, String> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        showDialog(FormEntryActivity.PROGRESS_DIALOG);
    }

    @Override
    protected String doInBackground(String...strings) {

       try {
   		InputStream in =

getResources().openRawResource(R.raw.problem);
OutputStream out = new
FileOutputStream(Collect.FORMS_PATH, "problem");

        	    // Transfer bytes from in to out
        	    byte[] buf = new byte[1024];
        	    int len;
        	    while ((len = in.read(buf)) > 0) {
        	        out.write(buf, 0, len);
        	    }
        	    in.close();
        	    out.close();

        }

   	 catch(IOException e){ }
	return null;
    }

    @Override
    protected void onPostExecute(String unused) {
        dismissDialog(FormEntryActivity.PROGRESS_DIALOG);
    }
}

and I executed:
CopyForm form = new CopyForm();
form.execute("");
after firstRun=true;

any help would be greatly appreciated.
thanks.

··· On Jul 18, 9:08 pm, Yaw Anokwa wrote: > execute it when first run is true.http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec... > > also, it would be a good idea for to follow how use tasks, listeners > and activities. you need to implement a listener on the relevant > activities. the disk sync task is a good place to start.http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec... > > On Mon, Jul 18, 2011 at 04:17, Kartikey Badgaiyan wrote: > > One more thing. I have created the async class in splashscreen > > activity. > > Now I am wondering where to execute the class in splashscreen > > activity, meaning where should I run this: > > CopyForm form = new CopyForm(); > > form.execute(""); > > > Thanks again > > > On Jul 18, 11:28 am, Yaw Anokwa wrote: > >> great! > > >> if you have more developer questions, send them to > >> opendatakit-developers@googlegroups.com. you can also find us on irc > >> at #opendatakit on freenode.net > > >> On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan wrote: > >> > okay I get it now. Thanks a lot for your quick reply. > > >> > On Jul 18, 10:35 am, Yaw Anokwa wrote: > >> >> let me try again... > > >> >> the easiest way to accomplish this is to copy the files from the res > >> >> folder to the odk/forms folder the first time collect is launched. you > >> >> can insert code in the splashscreen activity > >> >> (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) > >> >> that runs when the first time collect is launched. that code should be > >> >> an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html) > >> >> that does the file copy. you'll likely have to also pop up some > >> >> progress dialog (see the tasks in collect for examples). > > >> >> if any of that doesn't make any sense, then you should probably brush > >> >> up on some android java first before continuing.http://developer.android.com/index.htmlisagood place to start. > > >> >> On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: > >> >> > I am not sure what you mean. I am beginner in this so would appreciate > >> >> > if you could clarify it. > >> >> > To clarify on my end, I would like one form to be placed in either res/ > >> >> > raw or res/xml folder and I would like it to be visible to the client > >> >> > when he/she clicks the 'start form' button. The client shouldn't have > >> >> > to downloaded the form from any server. > > >> >> > Thanks > > >> >> > On Jul 15, 11:07 pm, Yaw Anokwa wrote: > >> >> >> probably easiest to copy the files from res/raw to the /odk/forms on > >> >> >> first run. we check for first run in the splashscreen activity, so > >> >> >> maybe spawn an async task there to do the copy. > > >> >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: > >> >> >> > Hi. > >> >> >> > I want one form to be there as soon as odk collect is opened. The form > >> >> >> > shouldn't have to be downloaded from the aggregate. The form will be > >> >> >> > in res/raw folder and it will be downloaded along with the odk collect > >> >> >> > software. I have been trying to figure out where and how to edit the > >> >> >> > source code so I can accommodate this. > > >> >> >> > Any help would be greatly appreciated. > >> >> >> > Thanks > >> >> >> > Kartikey > > >> >> >> > -- > >> >> >> > Post: opendatakit@googlegroups.com > >> >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> >> >> > Options:http://groups.google.com/group/opendatakit?hl=en > > >> >> > -- > >> >> > Post: opendatakit@googlegroups.com > >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> >> > Options:http://groups.google.com/group/opendatakit?hl=en > > >> > -- > >> > Post: opendatakit@googlegroups.com > >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> > Options:http://groups.google.com/group/opendatakit?hl=en > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options:http://groups.google.com/group/opendatakit?hl=en

yea, but with 1.1.7 you could be copying potentially large files. you
don't wanna show the ui until you are sure the files are there.

··· On Mon, Jul 18, 2011 at 09:29, Carl Hartung wrote: > To clarify a bit, listeners are only required if you want feedback from your > asynctask and/or if bad things could happen when the screen rotates. > Progress dialogs are only necessary if the user can't continue until the > task is complete (like loading a form). In your case, since all you're > doing is checking for the existence of a file and copying that file if it > doesn't exist, you should be able to just fire off your task and be done > with it (no listeners or dialogs required). > In fact, spawning a simple thread should be fine in your case if you don't > want to bother with asynctask. > -Carl > > > On Mon, Jul 18, 2011 at 9:08 AM, Yaw Anokwa wrote: >> >> execute it when first run is true. >> >> http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/activities/SplashScreenActivity.java?repo=collect#71 >> >> also, it would be a good idea for to follow how use tasks, listeners >> and activities. you need to implement a listener on the relevant >> activities. the disk sync task is a good place to start. >> >> http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/?repo=collect#android%2Ftasks >> >> >> On Mon, Jul 18, 2011 at 04:17, Kartikey Badgaiyan wrote: >> > One more thing. I have created the async class in splashscreen >> > activity. >> > Now I am wondering where to execute the class in splashscreen >> > activity, meaning where should I run this: >> > CopyForm form = new CopyForm(); >> > form.execute(""); >> > >> > Thanks again >> > >> > On Jul 18, 11:28 am, Yaw Anokwa wrote: >> >> great! >> >> >> >> if you have more developer questions, send them to >> >> opendatakit-developers@googlegroups.com. you can also find us on irc >> >> at #opendatakit on freenode.net >> >> >> >> On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan wrote: >> >> > okay I get it now. Thanks a lot for your quick reply. >> >> >> >> > On Jul 18, 10:35 am, Yaw Anokwa wrote: >> >> >> let me try again... >> >> >> >> >> the easiest way to accomplish this is to copy the files from the res >> >> >> folder to the odk/forms folder the first time collect is launched. >> >> >> you >> >> >> can insert code in the splashscreen activity >> >> >> >> >> >> (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) >> >> >> that runs when the first time collect is launched. that code should >> >> >> be >> >> >> an asynctask >> >> >> (http://developer.android.com/reference/android/os/AsyncTask.html) >> >> >> that does the file copy. you'll likely have to also pop up some >> >> >> progress dialog (see the tasks in collect for examples). >> >> >> >> >> if any of that doesn't make any sense, then you should probably >> >> >> brush >> >> >> up on some android java first before >> >> >> continuing.http://developer.android.com/index.htmlisa good place to start. >> >> >> >> >> On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: >> >> >> > I am not sure what you mean. I am beginner in this so would >> >> >> > appreciate >> >> >> > if you could clarify it. >> >> >> > To clarify on my end, I would like one form to be placed in either >> >> >> > res/ >> >> >> > raw or res/xml folder and I would like it to be visible to the >> >> >> > client >> >> >> > when he/she clicks the 'start form' button. The client shouldn't >> >> >> > have >> >> >> > to downloaded the form from any server. >> >> >> >> >> > Thanks >> >> >> >> >> > On Jul 15, 11:07 pm, Yaw Anokwa wrote: >> >> >> >> probably easiest to copy the files from res/raw to the /odk/forms >> >> >> >> on >> >> >> >> first run. we check for first run in the splashscreen activity, >> >> >> >> so >> >> >> >> maybe spawn an async task there to do the copy. >> >> >> >> >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: >> >> >> >> > Hi. >> >> >> >> > I want one form to be there as soon as odk collect is opened. >> >> >> >> > The form >> >> >> >> > shouldn't have to be downloaded from the aggregate. The form >> >> >> >> > will be >> >> >> >> > in res/raw folder and it will be downloaded along with the odk >> >> >> >> > collect >> >> >> >> > software. I have been trying to figure out where and how to >> >> >> >> > edit the >> >> >> >> > source code so I can accommodate this. >> >> >> >> >> >> > Any help would be greatly appreciated. >> >> >> >> > Thanks >> >> >> >> > Kartikey >> >> >> >> >> >> > -- >> >> >> >> > Post: opendatakit@googlegroups.com >> >> >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> >> >> >> > -- >> >> >> > Post: opendatakit@googlegroups.com >> >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> >> >> > -- >> >> > Post: opendatakit@googlegroups.com >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> > >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options: http://groups.google.com/group/opendatakit?hl=en >> > >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

we don't provide this kind of code level on the mailing list. maybe
try http://stackoverflow.com/questions/tagged/android

··· On Tue, Jul 19, 2011 at 00:25, Kartikey Badgaiyan wrote: > i appreciate all this help. but somehow its still now copying to sd > card. > this is my async task: > class CopyForm extends AsyncTask { > > @Override > protected void onPreExecute() { > super.onPreExecute(); > showDialog(FormEntryActivity.PROGRESS_DIALOG); > } > > @Override > protected String doInBackground(String...strings) { > > try { > InputStream in = > getResources().openRawResource(R.raw.problem); > OutputStream out = new > FileOutputStream(Collect.FORMS_PATH, "problem"); > > // Transfer bytes from in to out > byte[] buf = new byte[1024]; > int len; > while ((len = in.read(buf)) > 0) { > out.write(buf, 0, len); > } > in.close(); > out.close(); > > } > > catch(IOException e){ } > return null; > } > > @Override > protected void onPostExecute(String unused) { > dismissDialog(FormEntryActivity.PROGRESS_DIALOG); > } > } > > and I executed: > CopyForm form = new CopyForm(); > form.execute(""); > after firstRun=true; > > any help would be greatly appreciated. > thanks. > > > On Jul 18, 9:08 pm, Yaw Anokwa wrote: >> execute it when first run is true.http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec... >> >> also, it would be a good idea for to follow how use tasks, listeners >> and activities. you need to implement a listener on the relevant >> activities. the disk sync task is a good place to start.http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec... >> >> On Mon, Jul 18, 2011 at 04:17, Kartikey Badgaiyan wrote: >> > One more thing. I have created the async class in splashscreen >> > activity. >> > Now I am wondering where to execute the class in splashscreen >> > activity, meaning where should I run this: >> > CopyForm form = new CopyForm(); >> > form.execute(""); >> >> > Thanks again >> >> > On Jul 18, 11:28 am, Yaw Anokwa wrote: >> >> great! >> >> >> if you have more developer questions, send them to >> >> opendatakit-developers@googlegroups.com. you can also find us on irc >> >> at #opendatakit on freenode.net >> >> >> On Sun, Jul 17, 2011 at 23:16, Kartikey Badgaiyan wrote: >> >> > okay I get it now. Thanks a lot for your quick reply. >> >> >> > On Jul 18, 10:35 am, Yaw Anokwa wrote: >> >> >> let me try again... >> >> >> >> the easiest way to accomplish this is to copy the files from the res >> >> >> folder to the odk/forms folder the first time collect is launched. you >> >> >> can insert code in the splashscreen activity >> >> >> (http://code.google.com/p/opendatakit/source/browse/src/org/odk/collec...) >> >> >> that runs when the first time collect is launched. that code should be >> >> >> an asynctask (http://developer.android.com/reference/android/os/AsyncTask.html) >> >> >> that does the file copy. you'll likely have to also pop up some >> >> >> progress dialog (see the tasks in collect for examples). >> >> >> >> if any of that doesn't make any sense, then you should probably brush >> >> >> up on some android java first before continuing.http://developer.android.com/index.htmlisagood place to start. >> >> >> >> On Sun, Jul 17, 2011 at 22:17, Kartikey Badgaiyan wrote: >> >> >> > I am not sure what you mean. I am beginner in this so would appreciate >> >> >> > if you could clarify it. >> >> >> > To clarify on my end, I would like one form to be placed in either res/ >> >> >> > raw or res/xml folder and I would like it to be visible to the client >> >> >> > when he/she clicks the 'start form' button. The client shouldn't have >> >> >> > to downloaded the form from any server. >> >> >> >> > Thanks >> >> >> >> > On Jul 15, 11:07 pm, Yaw Anokwa wrote: >> >> >> >> probably easiest to copy the files from res/raw to the /odk/forms on >> >> >> >> first run. we check for first run in the splashscreen activity, so >> >> >> >> maybe spawn an async task there to do the copy. >> >> >> >> >> On Fri, Jul 15, 2011 at 03:18, Kartikey Badgaiyan wrote: >> >> >> >> > Hi. >> >> >> >> > I want one form to be there as soon as odk collect is opened. The form >> >> >> >> > shouldn't have to be downloaded from the aggregate. The form will be >> >> >> >> > in res/raw folder and it will be downloaded along with the odk collect >> >> >> >> > software. I have been trying to figure out where and how to edit the >> >> >> >> > source code so I can accommodate this. >> >> >> >> >> > Any help would be greatly appreciated. >> >> >> >> > Thanks >> >> >> >> > Kartikey >> >> >> >> >> > -- >> >> >> >> > Post: opendatakit@googlegroups.com >> >> >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> >> >> > -- >> >> >> > Post: opendatakit@googlegroups.com >> >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> >> > -- >> >> > Post: opendatakit@googlegroups.com >> >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> >> > Options:http://groups.google.com/group/opendatakit?hl=en >> >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options:http://groups.google.com/group/opendatakit?hl=en > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >