http://stackoverflow.com/questions/4820816/android-how-to-get-uri-from-an-asset-file

On Thu, Jan 27, 2011 at 2:31 PM, Titus <[email protected]> wrote:
> Hello,
>
> I have been trying to get the absolute path for an asset file but i
> havent found an answer.
>
> the file which is directly within my asset folder is mydemo.txt
>  and i call the function given below to test the validity of the path
> (tried the below options)
>                testURI("//android_asset/mydemo.txt");
>                testURI("//assets/mydemo.txt");
>
>        public void testURI(String filepath) {
>                try {
>                        Log.e(TAG, "Testing " + filepath);
>                        File f = new File(filepath);
>                        if (f.exists() == true) {
>                                Log.e(TAG, "Valid :" + filepath);
>                        } else {
>                                Log.e(TAG, "InValid :" + filepath);
>                        }
>                } catch (Exception e) {
>                        Log.e(TAG, "File not found" + filepath);
>                        e.printStackTrace();
>                }
>        }
>
> Can someone let me know whats the absolute path i can use to get an
> asset file. i don't need the file descriptors but i want the file path
> to construct an URI.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1 and http://bit.ly/smand2

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to