Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9497

Re: Android URI to drawable

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Android URI to drawable
Date 2011-11-03 19:15 -0700
Organization http://groups.google.com
Message-ID <7367201.498.1320372924453.JavaMail.geo-discussion-forums@prep8> (permalink)
References <9hgtnoF760U1@mid.individual.net>

Show all headers | View raw


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?

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Android URI to drawable Dirk Bruere at NeoPax <dirk.bruere@gmail.com> - 2011-11-04 01:33 +0000
  Re: Android URI to drawable Lew <lewbloch@gmail.com> - 2011-11-03 19:15 -0700
    Re: Android URI to drawable Dirk Bruere at NeoPax <dirk.bruere@gmail.com> - 2011-11-04 02:41 +0000
      Re: Android URI to drawable Dirk Bruere at NeoPax <dirk.bruere@gmail.com> - 2011-11-04 03:38 +0000
        Re: Android URI to drawable Lew <lewbloch@gmail.com> - 2011-11-04 08:54 -0700
          Re: Android URI to drawable Dirk Bruere at NeoPax <dirk.bruere@gmail.com> - 2011-11-06 00:06 +0000
  Re: Android URI to drawable Roedy Green <see_website@mindprod.com.invalid> - 2011-11-03 21:59 -0700

csiph-web