James SDC | 2 Sep 20:22 2009
Picon

Re: How to Access the SD File System?


Hi WoodManEXP,

I may want to try on the Emulator as well. So how to configuration
NDK, and how to configuration ADV?

Thank you very much!
James.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to android-ndk <at> googlegroups.com
To unsubscribe from this group, send email to android-ndk+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en
-~----------~----~----~----~------~----~------~--~---

WoodManEXP | 2 Sep 21:47 2009
Picon

Re: How to Access the SD File System?


I am still working through the NDK configuration and so don't know
enough yet to help. Configuring the /sdcard/ for the emulator is very
easy. Use the tools/android command to make an avd, maybe like this

android create avd -n my_avd -t 2 -c 256M

This will make an 1.5 SDK emulator with a 256M /sdcard/.

See http://developer.android.com/guide/developing/tools/avd.html

Hope that is what you wer asking.

On Sep 2, 2:22 pm, James SDC <hanzon... <at> gmail.com> wrote:
> Hi WoodManEXP,
>
> I may want to try on the Emulator as well. So how to configuration
> NDK, and how to configuration ADV?
>
> Thank you very much!
> James.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to android-ndk <at> googlegroups.com
To unsubscribe from this group, send email to android-ndk+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en
-~----------~----~----~----~------~----~------~--~---

James SDC | 2 Sep 22:46 2009
Picon

Re: How to Access the SD File System?


Hi WoodManEXP,

I usually use Visual Studio to edit the c code. Sometimes, I use Vim
to make it simpler.
I have added a SD card to my emulator now, and see how it is going on
emulator.

Hi Dianne,

You mentioned that Java and JNI have the same permissions. However,
why can my Java application be able to open/read/write to the file on
SD card, but the fopen("/sdcard/mytest.dat", "r+")  in JNI gets
"permission denied"?

Can you point out how to open/read/write the file on SD card, by using
JNI?

Thanks,
James.

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

Dianne Hackborn | 2 Sep 23:57 2009

Re: How to Access the SD File System?

On Wed, Sep 2, 2009 at 1:46 PM, James SDC <hanzonliu <at> gmail.com> wrote:

You mentioned that Java and JNI have the same permissions. However,
why can my Java application be able to open/read/write to the file on
SD card, but the fopen("/sdcard/mytest.dat", "r+")  in JNI gets
"permission denied"?

I don't know, but all the Java code does is open the file, I can assure you.  You could try using the lower-level open() call.  And if you look at the filesystem, you will see that all of the files on the SD card are world readable.

--
Dianne Hackborn
Android framework engineer
hackbod <at> android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.


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

Mine | 3 Sep 03:26 2009
Picon

Re: How to Access the SD File System?

Hi James,

    I'm using Emulator to do the same thing as you did, which is using fopen to open a file, and fread to read the file. Everything works fine.
    The difference is that I only need to read the file, so the fopen parameter is "rb". So I suggest that you try read the file first by fopen with "rb", then try write to see if anything different.

BRs,
Lei Yu

On Thu, Sep 3, 2009 at 4:46 AM, James SDC <hanzonliu <at> gmail.com> wrote:

Hi WoodManEXP,

I usually use Visual Studio to edit the c code. Sometimes, I use Vim
to make it simpler.
I have added a SD card to my emulator now, and see how it is going on
emulator.

Hi Dianne,

You mentioned that Java and JNI have the same permissions. However,
why can my Java application be able to open/read/write to the file on
SD card, but the fopen("/sdcard/mytest.dat", "r+")  in JNI gets
"permission denied"?

Can you point out how to open/read/write the file on SD card, by using
JNI?

Thanks,
James.




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

James SDC | 4 Sep 02:43 2009
Picon

Re: How to Access the SD File System?


Hi Lei Yu,

Yes, it is working now to me. I have tried both fopen() and open(),
and they all are working to me on both the emulator and the phone.
Thanks for all of you to help me out.

Best Regards,
James.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to android-ndk <at> googlegroups.com
To unsubscribe from this group, send email to android-ndk+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en
-~----------~----~----~----~------~----~------~--~---

Sureshbabu | 15 Oct 08:31 2009
Picon

Re: How to Access the SD File System?


Hello All,

I am new to this android platform. Can i get some information on
developing JNI code (file read/write)?

I am using windows OS for development (eclipse).

How to develope JNI and how to use it in android java application?

Anyone can help on this.

In advance Thanks Much.

-tsbabu.

On Sep 4, 5:43 am, James SDC <hanzon... <at> gmail.com> wrote:
> Hi Lei Yu,
>
> Yes, it is working now to me. I have tried both fopen() and open(),
> and they all are working to me on both the emulator and the phone.
> Thanks for all of you to help me out.
>
> Best Regards,
> James.

Jack Palevich | 15 Oct 15:14 2009
Picon

Re: How to Access the SD File System?

Sorry that everything is so confusing. Windows development is unfortunately different than Android development. (Android development is pretty similar to Unix/Linux development.)


Some suggestions:

+ Learn the standard Linux routines for file i/o. Do a web search for "fopen" or "stdio".

+ Learn how JNI works.  The Android implementation of JNI is very similar to the standard Java implementation, so you can use the documentation for the standard version to learn how to use the Android version.

+ Learn how the NDK works. There are documents and sample code in the NDK.

On Wed, Oct 14, 2009 at 11:31 PM, Sureshbabu <sureshbabu.thota <at> gmail.com> wrote:

Hello All,

I am new to this android platform. Can i get some information on
developing JNI code (file read/write)?

I am using windows OS for development (eclipse).

How to develope JNI and how to use it in android java application?

Anyone can help on this.

In advance Thanks Much.

-tsbabu.

On Sep 4, 5:43 am, James SDC <hanzon... <at> gmail.com> wrote:
> Hi Lei Yu,
>
> Yes, it is working now to me. I have tried both fopen() and open(),
> and they all are working to me on both the emulator and the phone.
> Thanks for all of you to help me out.
>
> Best Regards,
> James.




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

Jack Palevich | 15 Oct 15:17 2009
Picon

Re: How to Access the SD File System?

D'Oh, I think I should have said:


+ Learn how the Android permission system works. Starting with the Android 1.6 SDK, your apk has to have this permission in its manifest in order to be able to write to the SD card:

uses-permission 
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 


On Thu, Oct 15, 2009 at 6:14 AM, Jack Palevich <jackpal <at> google.com> wrote:
Sorry that everything is so confusing. Windows development is unfortunately different than Android development. (Android development is pretty similar to Unix/Linux development.)

Some suggestions:

+ Learn the standard Linux routines for file i/o. Do a web search for "fopen" or "stdio".

+ Learn how JNI works.  The Android implementation of JNI is very similar to the standard Java implementation, so you can use the documentation for the standard version to learn how to use the Android version.

+ Learn how the NDK works. There are documents and sample code in the NDK.

On Wed, Oct 14, 2009 at 11:31 PM, Sureshbabu <sureshbabu.thota <at> gmail.com> wrote:

Hello All,

I am new to this android platform. Can i get some information on
developing JNI code (file read/write)?

I am using windows OS for development (eclipse).

How to develope JNI and how to use it in android java application?

Anyone can help on this.

In advance Thanks Much.

-tsbabu.

On Sep 4, 5:43 am, James SDC <hanzon... <at> gmail.com> wrote:
> Hi Lei Yu,
>
> Yes, it is working now to me. I have tried both fopen() and open(),
> and they all are working to me on both the emulator and the phone.
> Thanks for all of you to help me out.
>
> Best Regards,
> James.





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

Sureshbabu | 21 Oct 07:45 2009
Picon

Re: How to Access the SD File System?


Hi Jack,

Thank you very much for your quick response.

I am developing android application in windows platform with Eclipse
editor.
Android-ndk available for windows platform. So can we develop the jni
code in windows platform (eclipse editor)?

-tsbabu.

On Oct 15, 6:17 pm, Jack Palevich <jack... <at> google.com> wrote:
> D'Oh, I think I should have said:
> + Learn how the Android permission system works. Starting with the Android
> 1.6 SDK, your apk has to have this permission in its manifest in order to be
> able to write to the SD card:
>
> uses-permission
> android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
>
>
>
> On Thu, Oct 15, 2009 at 6:14 AM, Jack Palevich <jack... <at> google.com> wrote:
> > Sorry that everything is so confusing. Windows development is unfortunately
> > different than Android development. (Android development is pretty similar
> > to Unix/Linux development.)
> > Some suggestions:
>
> > + Learn the standard Linux routines for file i/o. Do a web search for
> > "fopen" or "stdio".
>
> > + Learn how JNI works.  The Android implementation of JNI is very similar
> > to the standard Java implementation, so you can use the documentation for
> > the standard version to learn how to use the Android version.
>
> > + Learn how the NDK works. There are documents and sample code in the NDK.
>
> > On Wed, Oct 14, 2009 at 11:31 PM, Sureshbabu <sureshbabu.th... <at> gmail.com>wrote:
>
> >> Hello All,
>
> >> I am new to this android platform. Can i get some information on
> >> developing JNI code (file read/write)?
>
> >> I am using windows OS for development (eclipse).
>
> >> How to develope JNI and how to use it in android java application?
>
> >> Anyone can help on this.
>
> >> In advance Thanks Much.
>
> >> -tsbabu.
>
> >> On Sep 4, 5:43 am, James SDC <hanzon... <at> gmail.com> wrote:
> >> > Hi Lei Yu,
>
> >> > Yes, it is working now to me. I have tried both fopen() and open(),
> >> > and they all are working to me on both the emulator and the phone.
> >> > Thanks for all of you to help me out.
>
> >> > Best Regards,
> >> > James.- Hide quoted text -
>
> - Show quoted text -

Gmane