This seems like a question for the Xamarin team. Although both ways should work on both the device and the emulator as they use the same framework...
On Tue, May 29, 2012 at 3:23 PM, michelw <[email protected]> wrote: > i've no error on path, because (on avd only) > > imageView.SetImageURI(Android.Net.Uri.Parse(pathtopic... or > imageView.SetImageURI(Android.Net.Uri.WithAppendedPath(Android.Net.Uri.Parse(pathtopic > > don't work > > and imageView.SetImageDrawable(Drawable.CreateFromPath(pathtopic) works > fine. > > So, if i do an error with the path, nothing will work, right? > > and before doing my imageView.XX i do a if File.Exists ..... so /sdcard, > or /other.. if pic doesn't exist, he don't try to get the pic, > > > > > Le 29/05/2012 15:07, Matthew Leibowitz a écrit : > > What you can also try is to specify the path exactly: > > imageView.SetImageURI(Android.Net.Uri.Parse("file:///data/XXX/XXX/YYY.jpg" > )); > > and see what happens. > > If you are storing the files on a SD Card then you can also try: > > The device may have a different path to the resource: > I know my device has the path */sdcard*/data/XXX and the emulator has > something like /data/XXX > > Also see if the *Environment.ExternalStorageDirectory *differs on the > device and on the emulator. > > On Tue, May 29, 2012 at 2:57 PM, michelw <[email protected]> wrote: > >> yes the pic exist! >> >> if (File.Exists(Config.PathOfCache + nameofpic)) >> { >> imageView.SetImageURI(............. >> } >> >> if the pic doesn't exist, he download it.. >> >> I've no problem on Hard device.. >> >> If, for example, i do a >> imageView.SetImageDrawable(Drawable.CreateFromPath(Config.PathOfCache + >> nameofpic) i've the pic on avd and hard device :). >> >> So, for me, there is a bug :( >> >> >> Le 29/05/2012 14:37, Matthew Leibowitz a écrit : >> >> Hmm... Does the image exist on the emulator? how did you get it on the >> emulator? >> >> On Tue, May 29, 2012 at 1:47 PM, michelw <[email protected]> wrote: >> >>> imageView.SetImageURI(*Android.Net.Uri.Parse(*"file://" + pathofpic*)* >>> ); >>> => >>> resolveUri failed on bad bitmap uri: file:///............. (3 / ) but >>> don't work on avd, it's ok on my hard device >>> >>> >>> >>> imageView.SetImageURI(Android.Net.Uri.WithAppendedPath(Android.Net.Uri.Parse( >>> "file://"),pathofpic)); >>> => >>> resolveUri failed on bad bitmap uri: file:////............. (4 / ), >>> don't work on avd, it's ok on my hard device! >>> >>> >>> >>> i don't undestand anything.........................; >>> >>> >>> >>> >>> >>> >>> >>> Le 29/05/2012 13:28, Matthew Leibowitz a écrit : >>> >>> Oops my bad: >>> >>> var pathToImg = System.IO.Path.Combine(Config.PathOfCache, nameofpic); >>> imageView.SetImageURI(*Android.Net.Uri.Parse(*"file://" + pathToImg*)*); >>> >>> On Tue, May 29, 2012 at 1:20 PM, Matthew Leibowitz < >>> [email protected]> wrote: >>> >>>> Try this and let me know what happens: >>>> >>>> var pathToImg = System.IO.Path.Combine(Config.PathOfCache, nameofpic); >>>> imageView.SetImageURI("file://" + pathToImg); >>>> >>>> Also see what the value of 'pathToImg' is... >>>> >>>> Matthew >>>> >>>> >>>> >>>> On Tue, May 29, 2012 at 11:58 AM, michelw <[email protected]>wrote: >>>> >>>>> "three means use absolute path" <= yes, i'm right, but android add >>>>> another / i don't know why, on avd only maybe... >>>>> >>>>> Config.PathOfCache => /data/nameofapp/ >>>>> nameofpic => XXXXXX.jpg >>>>> >>>>> Config.PathOfCache + nameofpic => /data/nameofapp/XXXXXX.jpg >>>>> file:// + Config.PathOfCache + nameofpic => >>>>> file:///data/nameofapp/XXXXXX.jpg (3 /) >>>>> >>>>> so for me : >>>>> Android.Net.Uri.WithAppendedPath(Android.Net.Uri.Parse("file://"), >>>>> Config.PathOfCache + nameofpic is good >>>>> >>>>> But error return 4 /, not 3 >>>>> >>>>> i look Path.Combine for see >>>>> >>>>> >>>>> Android.Net.Uri.WithAppendedPath(Android.Net.Uri.Parse("file://"), >>>>> Config.PathOfCache + nameofpic >>>>> >>>>> Le 29/05/2012 11:52, Matthew Leibowitz a écrit : >>>>> >>>>> This might be a problem with too many slashes. >>>>> >>>>> You have four. I may be wrong, but two means relative path, three >>>>> means use absolute path and four means use absolute path to the zero >>>>> length >>>>> directory name. eg: /[no_name]/file.jpg >>>>> >>>>> Try using >Path.Combine and see its that helps. >>>>> >>>>> Matthew >>>>> On May 29, 2012 11:45 AM, "michelw" <[email protected]> wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> I've a problem with file:// >>>>>> >>>>>> i've pics on /data/data/appname.appname/app_cache/_picXXXXXXXX.jpg >>>>>> >>>>>> var pathofpic = >>>>>> "/data/data/appname.appname/app_cache/_picXXXXXXXX.jpg" >>>>>> >>>>>> i use >>>>>> imageView.SetImageURI(Android.Net.Uri.WithAppendedPath(Android.Net.Uri.Parse( >>>>>> "file://"), Config.PathOfCache + nameofpic)); >>>>>> >>>>>> >>>>>> On harddevice, i've no problem, but on avd he said: cannot resolve >>>>>> file:////data/data/nameofappli/..........jpg >>>>>> >>>>>> >>>>>> (monodroid 4.2.2, android 2.1 on avd, 2.3 on hard device) >>>>>> _______________________________________________ >>>>>> Monodroid mailing list >>>>>> [email protected] >>>>>> >>>>>> UNSUBSCRIBE INFORMATION: >>>>>> http://lists.ximian.com/mailman/listinfo/monodroid >>>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Monodroid mailing [email protected] >>>>> >>>>> UNSUBSCRIBE INFORMATION:http://lists.ximian.com/mailman/listinfo/monodroid >>>>> >>>>> >>>>> _______________________________________________ >>>>> Monodroid mailing list >>>>> [email protected] >>>>> >>>>> UNSUBSCRIBE INFORMATION: >>>>> http://lists.ximian.com/mailman/listinfo/monodroid >>>>> >>>>> >>>> >>> >>> >>> _______________________________________________ >>> Monodroid mailing [email protected] >>> >>> UNSUBSCRIBE INFORMATION:http://lists.ximian.com/mailman/listinfo/monodroid >>> >>> >>> _______________________________________________ >>> Monodroid mailing list >>> [email protected] >>> >>> UNSUBSCRIBE INFORMATION: >>> http://lists.ximian.com/mailman/listinfo/monodroid >>> >>> >> >> >> _______________________________________________ >> Monodroid mailing [email protected] >> >> UNSUBSCRIBE INFORMATION:http://lists.ximian.com/mailman/listinfo/monodroid >> >> >> _______________________________________________ >> Monodroid mailing list >> [email protected] >> >> UNSUBSCRIBE INFORMATION: >> http://lists.ximian.com/mailman/listinfo/monodroid >> >> > > > _______________________________________________ > Monodroid mailing [email protected] > > UNSUBSCRIBE INFORMATION:http://lists.ximian.com/mailman/listinfo/monodroid > > > _______________________________________________ > Monodroid mailing list > [email protected] > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid > >
_______________________________________________ Monodroid mailing list [email protected] UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
