Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

New Forums: Nexus Player | Nexus 9
test: Reply
 
LinkBack Thread Tools
Old September 23rd, 2012, 06:07 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2011
Posts: 5
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default Remote drawables in Android 4.0.3

hi, Im developing an app which is a product catalogue. Users can search for and view products (books). It's all read only and just so allow user's to view products. When the user clicks on a product, the next screen displays
- book title
- book author
- picture of front cover.

It's the picture part that I've a question about. I know one way to present drawables is to have them in the "drawable" direction in my android project and access them (in my xml file) as android:src="@drawable/name".

Only problem is that new products will be added so I can't store drawables in the APK file when I release it. I'll need to read them at runtime. I'm wondering what the best way to approach this is.

I'm thinking of upon app launch executing an AsyncTask which would call
openConnection of HttpURLConnection and would grab down all drawable (from a particular remote directory on a website) and would then store them in the sqllite db (as a blob). Each product in the db could easily be associated with it's specific drawable.

Not sure if there's a better approach to this ? or should I save them to the internal storage of the device (I know the size is an issue with this option). Or I could, when I show the product, call the Async task to present the image - i.e.get the image when the user requests it. This sounds good (in a lazy loading kinda way)..

any help would be great. I'm developing on Android 4.0.3.

Thanks - Ro

Advertisements
ro_eire is offline  
Reply With Quote
sponsored links
Old September 24th, 2012, 11:44 AM   #2 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,935
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 482 Times in 294 Posts
Default

You are on the right track, however it's not a good practice on Android to store BLOBs. Instead, we tend to store them on the sdcard and then store the URI for the file as a VARCHAR in the db.
jonbonazza is offline  
Reply With Quote
Reply
Tags
drawable, httpurlconnection, remote


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:34 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.