Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Dirk Bruere at NeoPax Newsgroups: comp.lang.java.programmer Subject: Re: Android URI to drawable Date: Fri, 04 Nov 2011 02:41:55 +0000 Organization: Dirk Bruere at Neopax Lines: 28 Message-ID: <9hh1nbF1ugU1@mid.individual.net> References: <9hgtnoF760U1@mid.individual.net> <7367201.498.1320372924453.JavaMail.geo-discussion-forums@prep8> Reply-To: dirk.bruere@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net ONJ4+2vwK+4dhNqHlsh/VQNT+6noo2hAG9iKKnWri8PGo7y5dG Cancel-Lock: sha1:5WDaDCfHyI7GgbAhi87Gtu9y/NM= User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 In-Reply-To: <7367201.498.1320372924453.JavaMail.geo-discussion-forums@prep8> X-Antivirus: avast! (VPS 111103-1, 03/11/2011), Outbound message X-Antivirus-Status: Clean Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9500 On 04/11/2011 02:15, Lew wrote: > Dirk Bruere at NeoPax wrote: >> Drawable d = >> Drawable.createFromPath("e:\\Config\\$NetRadioCovers\\Other\\96.7 >> Ashbourne Radio.jpg"); >> >> This returns null, even though the path is correct. >> Any ideas on how to do it? > > Here is a lesson in why you should put all the necessary information in the body of your post, and not just in the subject. Your subject refers to "Android URI", but the body of your post talks about a Windows path. That is confusing. > > Regardless, the evidence from the tiny bit of information you provide is that the path is most definitely *not* correct. At the very least, you should re-examine that assumption and take steps to prove it. (E.g., write a unit test that test for something like 'new File("your path").exists()'.) Don't assume the path is right, prove that it's right. I will bet you fifty bucks that it isn't. (Monopoly money only.) > > Please give ocmplete information in your post. Is this a Windows problem or an Android problem? If this is Android, then the path isn't even correctly formatted, much less correct. > > You should consider using 'System.getProperty("file.separator")' or equivalent instead of hard-coding non-portable idioms. > > Also, I see no evidence of a URI in your code snippet. How does that figure in? > Thanks. In replying to this I think I have just realized what is wrong. How to fix it is another matter -- Dirk The New Futurism : ZERO STATE : http://zerostate.net