Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Android: create drawable from path Date: Thu, 14 Apr 2011 18:32:14 -0400 Organization: albasani.net Lines: 83 Message-ID: References: <90opnjFunsU1@mid.individual.net> <908b85be-4c87-4bd6-b5f1-4b82ffeea13e@b13g2000prf.googlegroups.com> <90p3v4Fe4fU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net I/7o8czkg89xyzNZt5nUQLYI3voEuu5yRTzumiRortwP2g9Oou/PlV92XEOZwOLcYShgPdG7jIV+k/3ywnAus43P/1+CaZq67mccXR8L4rVeS+8BCufwpBPZxRM7+7pA NNTP-Posting-Date: Thu, 14 Apr 2011 22:31:59 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="X1aa/6f4jrYpfEhef0Gv+8mksulwqiDkt7VyHOss0XN52THPy6XlXH9PCtB5qFFZRKg9OZ/8BbfIBJvLtZkkRLL34zdq3G38hMvR6IB6r/R7RK/acR/V9pEFWbjr4NKu"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: <90p3v4Fe4fU1@mid.individual.net> Cancel-Lock: sha1:kLAWBWTdYpYDjFwg/bNOgYKfCQM= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3064 On 04/14/2011 04:32 PM, Dirk Bruere at NeoPax wrote: > On 14/04/2011 20:06, Lew wrote: >> On Apr 14, 1:37 pm, Dirk Bruere at NeoPax >> wrote: >>> For some reason d=null when creating a drawable from coverArtURLStr, >>> which is the full http path to the resource on the LAN. >>> >> >> Are you certain that value is what the method sees? >> >>> Anything obvious wrong? It's a path to a .png >>> [I can access the LAN OK, and Data.defaultCoverArt works fine] >>> >>> public static void updateCoverArt(String coverArtURLStr) >>> { >>> String coverArtURL = coverArtURLStr; >>> >> >> Why the extra 'String' assignment? >> >> What is the *actual* value of 'coverArtURLStr' at this point when you >> have the problem? >> >>> Drawable d; >>> >>> if (coverArtURL.equals("")) >>> d = Data.defaultCoverArt; >>> else >>> d = Drawable.createFromPath(coverArtURL); >>> >> >> The value of 'd' at this point when you have the problem is 'null', >> you say. >> >>> Data.coverArtIV.setImageDrawable(d); >>> } >>> >> >> When you say "I can access the LAN OK", that may or may not bear on >> whether your program can access the LAN when you're running your >> test. There's insufficient information in your post for us to know. >> >> Since you have not provided an SSCCE there's little likelihood we can >> debug your problem. On the face of it the'createFromPath()' method is >> unable to access the actual URL string you're giving it, a datum you >> have omitted from your problem statement. >> >> Provide an SSCCE, please. > Actually, there is enough information. Now that you've shared it, sure, but not before in the post in which I pointed out you didn't provide enough information. > It seems that > Drawable.createFromPath(coverArtURL); > > doesn't like it if the path is http:\\... That information was *not* in your post, so no, there was *not* enough information in your post. I am happy that we found the correct answer despite that. It is strange that you're claiming to have provided enough information by citing data that you did not provide us. Yes, of course it can't parse a URL string of that form. Had you included that datum in the original post we could have answered with complete certainty instead of probabilistically (and, as it turned out, correctly). We'd have seen that you used backslashes in the URL string, and been able to focus right in on that for you. At least we were able to focus on the string itself and the likelihood (now certainty) that it specified an unreachable (or outright invalid) location, based on the information that was available. > I've just got it to work. > I'll post the code tomorrow for reference Thanks. That's a good thing. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg