Hey can you help me with that.

I am in the middle of developing a video dictionary. the main application is
complete. I am working on the support application for downloading files form
the server.

can you help me with sample code or useful hints in downloading the files.

Thanks in advance.

Yousuf.



On Tue, Dec 15, 2009 at 2:25 PM, kaloer <mkal...@gmail.com> wrote:

> Thank you very much for your help!
> No problem, I know how to do this.
>
> Best regards,
> Kaloer
>
> On 15 Dec., 20:22, Yousuf Syed <yousuf.syed....@gmail.com> wrote:
> > Hi,
> >
> > Write another supporting application to download them and save it to the
> > location used in your main application. then install the main
> applicaiton.
> > This should do. but I have not worked on downloading files from server.
> So
> > cant help you in this regard. Sorry for that.
> >
> > Regards,
> >
> > Yousuf.
> >
> > On Tue, Dec 15, 2009 at 2:11 PM, kaloer <mkal...@gmail.com> wrote:
> > > Oh okay.. But how can I use it them? Do I need to download it from a
> > > server or so? I have tried putting it into the assets folder but this
> > > seems to have the same limit.
> >
> > > On 15 Dec., 20:04, Yousuf Syed <yousuf.syed....@gmail.com> wrote:
> > > > yes, For sure.
> >
> > > > the raw folder has a limit to the amount of data that it can hold.
> >
> > > > It cant hold large data files.
> >
> > > > Regards,
> >
> > > > Yousuf.
> >
> > > > On Tue, Dec 15, 2009 at 1:58 PM, kaloer <mkal...@gmail.com> wrote:
> > > > > Hi again,
> >
> > > > > I've just tried putting a simple file with the "Hello, world" text
> > > > > into the raw folder, and this works as it should. The other file is
> > > > > 1.1 megabyte. Can the error be caused because of the size?
> >
> > > > > On 15 Dec., 19:52, Yousuf Syed <yousuf.syed....@gmail.com> wrote:
> > > > > > Hi Kaloer,
> >
> > > > > >  The procedure is as follows:
> >
> > > > > > 1. create a raw folder,
> > > > > > 2. place a file.(txt or regular file with no extension) in the
> raw
> > > > > folder.
> > > > > > 3.write the code as said earlier.
> >
> > > > > > 4 one more thing that you can do is push the file through
> eclipse's
> > > ddms
> > > > > to
> > > > > > data/data/<your application dir>/files directory.
> >
> > > > > > (Your file in the DDMS will be updated not the one contained in
> > > /res/raw/
> > > > > > folder so look for the size of the file present in ddms under
> > > > > > /data/data/com.app.files/files/ )
> >
> > > > > > 5 path to be specified: just give the file name that is present
> in
> > > the
> > > > > raw
> > > > > > folder.
> > > > > > if the name of file is sample.txt which is present in /res/raw/
> > > folder
> > > > > > FileInputStream fin = context.openFileInput("sample.txt"); // if
> used
> > > > > within
> > > > > > a adapter class or somewhere outside the activity class
> >
> > > > > > if you are using this within the activity it should be
> > > > > > FileInputStream fin = openFileInput("sample.txt");
> >
> > > > > > I guess step 4 is needed for the first time since your read is
> > > performed
> > > > > > before your write.
> > > > > > if you are writing before reading then the FileOutputStream
> object
> > > either
> > > > > > writes to a existing file or creates a new one( FileInputStream
> > > object
> > > > > > cannot create a new file).
> >
> > > > > > Do remember that raw folder has a limit to the data that it can
> > > contain
> > > > > so
> > > > > > files with large amount of data cant be stored there.
> >
> > > > > > For your convenience I am attaching my filehandling projected
> that
> > > reads
> > > > > and
> > > > > > writes to file. This is a working example.
> >
> > > > > > for some reason if this is not working try using permissions.
> >
> > > > > > read_owner_data
> > > > > > write_owner_data
> > > > > > write_external_storage
> >
> > > > > > but these permissions are for files stored on /sdcard/filename
> > > > > > Hope this would help.
> >
> > > > > > Regards,
> >
> > > > > > Yousuf.
> >
> > > > > > On Tue, Dec 15, 2009 at 12:28 PM, kaloer <mkal...@gmail.com>
> wrote:
> > > > > > > Hi Yousuf,
> >
> > > > > > > Thank you very much for the answer. However, I don't know in
> which
> > > > > > > directory i should put the file? I don't want to save the file
> from
> > > my
> > > > > > > application - it should just be there when the application is
> > > > > > > installed. I don't think I can access this file with the
> > > > > > > context.openFileInput() method? Or am I wrong?
> >
> > > > > > > //Kaloer
> >
> > > > > > > On 15 Dec., 16:44, Yousuf Syed <yousuf.syed....@gmail.com>
> wrote:
> > > > > > > > Hi,
> >
> > > > > > > > You cannot use the regular java IO for res/raw. folder.
> > > > > > > > only if you are using /sd/card you can use regular java.io
> >
> > > > > > > > here is some code that might help you
> >
> > > > > > > > FileInputStream fin = context.openFileInput("sitestore");
> > > > > > > >         InputStreamReader br = new InputStreamReader(fin);
> > > > > > > >         String readString = "";
> > > > > > > >         int i;
> > > > > > > >         while((i = br.read()) != -1){
> > > > > > > >             inputBuffer = (char)i;
> > > > > > > >         readString = readString + inputBuffer;
> > > > > > > >         }
> >
> > > > > > > > FileOutputStream fOut = context.openFileOutput("sitestore",
> > > > > > > > context.MODE_WORLD_READABLE);
> > > > > > > > OutputStreamWriter bw = new OutputStreamWriter(fOut);
> >
> > > > > > > > write the code for writting to file here...........
> >
> > > > > > > > Regards,
> >
> > > > > > > > Yousuf.
> >
> > > > > > > > On Mon, Dec 14, 2009 at 4:03 PM, kaloer <mkal...@gmail.com>
> > > wrote:
> > > > > > > > > Hi,
> >
> > > > > > > > > I have a problem when I'm trying to read a file from the
> > > res/raw
> > > > > > > > > folder. When I get the file as an InputStream and try
> reading
> > > it
> > > > > line
> > > > > > > > > for line with a BufferedReader, I get an IOException when
> I'm
> > > > > calling
> > > > > > > > > the br.readLine(). I do no get any additional information
> in
> > > the
> > > > > > > > > exception.
> > > > > > > > > Are there anything wrong with this code:
> >
> > > > > > > > >        private void readFile(InputStream mFile) {
> > > > > > > > >                DataInputStream in = new
> DataInputStream(mFile);
> > > > > > > > >                BufferedReader br = new BufferedReader(new
> > > > > > > > > InputStreamReader(in));
> > > > > > > > >                String strLine;
> > > > > > > > >                while ((strLine = br.readLine()) != null) {
> > > > > > > > >                        Log.i("line", strLine);
> > > > > > > > >                }
> > > > > > > > >                in.close();
> > > > > > > > >        }
> >
> > > > > > > > > Thank you very much!
> >
> > > > > > > > > //Kaloer
> >
> > > > > > > > > --
> > > > > > > > > You received this message because you are subscribed to the
> > > Google
> > > > > > > > > Groups "Android Beginners" group.
> > > > > > > > > To post to this group, send email to
> > > > > > > android-beginners@googlegroups.com
> > > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> >
> > > <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> >
> >
> > > > > <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> >
> > > <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> <android-beginners%25252bunsubscr...@googlegroups.com<android-beginners%2525252bunsubscr...@googlegroups.com>
> >
> >
> > > > > > > <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> >
> > > <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> <android-beginners%25252bunsubscr...@googlegroups.com<android-beginners%2525252bunsubscr...@googlegroups.com>
> >
> >
> > > > > <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> <android-beginners%25252bunsubscr...@googlegroups.com<android-beginners%2525252bunsubscr...@googlegroups.com>
> >
> > > <android-beginners%25252bunsubscr...@googlegroups.com<android-beginners%2525252bunsubscr...@googlegroups.com>
> <android-beginners%2525252bunsubscr...@googlegroups.com<android-beginners%252525252bunsubscr...@googlegroups.com>
> >
> >
> > > > > > > > > For more options, visit this group at
> > > > > > > > >http://groups.google.com/group/android-beginners?hl=en
> >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the
> Google
> > > > > > > Groups "Android Beginners" group.
> > > > > > > To post to this group, send email to
> > > > > android-beginners@googlegroups.com
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> >
> > > <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> >
> >
> > > > > <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> >
> > > <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> <android-beginners%25252bunsubscr...@googlegroups.com<android-beginners%2525252bunsubscr...@googlegroups.com>
> >
> >
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/android-beginners?hl=en
> >
> > > > > >  filehandling.zip
> > > > > > 59KVisDownload
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Beginners" group.
> > > > > To post to this group, send email to
> > > android-beginners@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> >
> > > <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> <android-beginners%252bunsubscr...@googlegroups.com<android-beginners%25252bunsubscr...@googlegroups.com>
> >
> >
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-beginners?hl=en
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Beginners" group.
> > > To post to this group, send email to
> android-beginners@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> <android-beginners%2bunsubscr...@googlegroups.com<android-beginners%252bunsubscr...@googlegroups.com>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-beginners?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> To post to this group, send email to android-beginners@googlegroups.com
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to