tag:blogger.com,1999:blog-89878749563391212.post8645554261395859691..comments2024-03-25T17:53:11.127-07:00Comments on Android-er: HelloGallery, read picture files from SD, display in ImageView.Unknownnoreply@blogger.comBlogger6125tag:blogger.com,1999:blog-89878749563391212.post-2275035066876092502013-01-25T23:58:13.157-08:002013-01-25T23:58:13.157-08:00hello Karlosbboy,
Do the third is a big photo? Pl...hello Karlosbboy,<br /><br />Do the third is a big photo? Please note that it cannot load big photo, or out of memory will happen. You have to re-size it before display, if it's the case.Erikhttps://www.blogger.com/profile/04983894331825656853noreply@blogger.comtag:blogger.com,1999:blog-89878749563391212.post-56973801342004197642013-01-25T07:44:08.657-08:002013-01-25T07:44:08.657-08:00I have a problem, every time I install it on my de...I have a problem, every time I install it on my device displays an error whenever I view the third photo in the emulator but that does not eclipse happens what do can this happening?Karlosbboyhttps://www.blogger.com/profile/07079751290717359294noreply@blogger.comtag:blogger.com,1999:blog-89878749563391212.post-45975083650821346522011-05-28T02:52:55.894-07:002011-05-28T02:52:55.894-07:00hello Steve Ballantyne,
Have you update the funct...hello Steve Ballantyne,<br /><br />Have you update the functions getCount(), getItem() and getItemId() of your ImageAdapter to return FileList.size(), position and position?<br /><br />The auto-generated default return have is 0, null and 0, it have to be changed manually.<br /><br />I test the exercise again, it should be work as expected.Erikhttps://www.blogger.com/profile/04983894331825656853noreply@blogger.comtag:blogger.com,1999:blog-89878749563391212.post-74446085356089241692011-05-27T14:03:03.454-07:002011-05-27T14:03:03.454-07:00Hello, I have a curious question:
I am trying to ...Hello, I have a curious question:<br /><br />I am trying to use my current "position" to identify my place in the array for the purpose of using the image displayed, and to play with gestures. The problem I have is that if I try to use the int position outside of the adapter, it's value is always returned as '0'. So I have placed a long press listener which tries to set the wallpaper using the currently selected bitmap. But it always uses the first bitmap from the list, because position is always '0'.<br /><br />Do you have any ideas on how I could get around that?Steve Ballantynehttps://www.blogger.com/profile/07585614642614904136noreply@blogger.comtag:blogger.com,1999:blog-89878749563391212.post-76605212745399983372011-05-18T00:05:48.468-07:002011-05-18T00:05:48.468-07:00thx:)thx:)Erikhttps://www.blogger.com/profile/04983894331825656853noreply@blogger.comtag:blogger.com,1999:blog-89878749563391212.post-3933898566260676192011-05-17T10:35:14.198-07:002011-05-17T10:35:14.198-07:00This was very useful to me. I ran into a little b...This was very useful to me. I ran into a little bit of trouble running my VM out of memory using pictures that were just slightly too large. I found an interesting trick on stack overflow to scale your images before trying to decode and display them. Here is what I hacked together, which works really well ...<br /><br />snip! ------- >8<br /><br /> g.setOnItemClickListener(new OnItemClickListener() {<br /> public void onItemClick(AdapterView parent, View v, int position, long id) { <br /> String imageInSD = SD.get(position);<br /> // Decode image size<br /> BitmapFactory.Options o = new BitmapFactory.Options();<br /> o.inJustDecodeBounds = true;<br /> <br /> // The new size we want to scale to<br /> final int REQUIRED_SIZE=70;<br /> // Find the correct scale value. It should be the power of 2.<br /> int width_tmp=o.outWidth, height_tmp=o.outHeight;<br /> int scale=1;<br /> while(true){<br /> if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE)<br /> break;<br /> width_tmp/=2;<br /> height_tmp/=2;<br /> scale*=2;<br /> }<br /> // Decode with inSampleSize<br /> BitmapFactory.Options o2 = new BitmapFactory.Options();<br /> o2.inSampleSize=scale;<br /><br /> bitmap = BitmapFactory.decodeFile(imageInSD, o2);<br /><br /> imageView.setImageBitmap(bitmap);<br /> }<br /> });<br /><br />snip!! 8< -----dadehttps://www.blogger.com/profile/07808136708335088519noreply@blogger.com