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


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

Re: Android URI to drawable

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Android URI to drawable
Date Fri, 4 Nov 2011 08:54:37 -0700 (PDT)
Organization http://groups.google.com
Lines 74
Message-ID <975530.124.1320422077528.JavaMail.geo-discussion-forums@yqbl36> (permalink)
References <9hgtnoF760U1@mid.individual.net> <7367201.498.1320372924453.JavaMail.geo-discussion-forums@prep8> <9hh1nbF1ugU1@mid.individual.net> <9hh51sFndkU1@mid.individual.net>
Reply-To comp.lang.java.programmer@googlegroups.com
NNTP-Posting-Host 65.50.217.124
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1320422176 18051 127.0.0.1 (4 Nov 2011 15:56:16 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Fri, 4 Nov 2011 15:56:16 +0000 (UTC)
In-Reply-To <9hh51sFndkU1@mid.individual.net>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=65.50.217.124; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9517

Show key headers only | View raw


Dirk Bruere at NeoPax wrote:
> Dirk Bruere at NeoPax wrote:
>> 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.

And that would be what, exactly?  (With emphasis on the "exactly".)

>> How to fix it is another matter
>>
> 
> What I need is a path I can use.
> The machine I am looking for is on the LAN, and named "Base".
> The path on that machine is e:\\Config\\$NetRadioCovers\\Other\\96.7
> Ashbourne Radio.jpg"
> 
> What is the correct path string with the machine name added?

You need a LAN-aware or WAN-aware file system.

Your subject line has the right idea - refer to the resource via a URI, specifically a URL.

URLs are made available by drivers or servers that recognize the access protocol.  For example. to read a local file or one that is presented as such by your network driver, you can use the "file://" protocol.  The file system understands that one.  On the Web you use the "http://" protocol.  Web servers understand that one.

There is no automatic network driver that presents files on the host as files on the Android device.  If you do mount one, it will present the remote files in Android (i.e., Linux) file-system syntax, not Windows.  This is true for any remote-file access system - the resource presented as a file is in terms of the local file system, not the remote one.  That's basic networking.

So make a server (file system, Web, FTP, or whatever) that presents the desired resource via a URL, then connect to it in the appropriate way (network, HTTP client, FTP client, ...) from the Android device, using a 'java.net.URL' to get to it.

-- 
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