tag:blogger.com,1999:blog-88902209727634796.post2450243557249080352..comments2023-11-28T22:17:49.707-08:00Comments on Android Development - News, Example, tutorial, Source Code : Viewpager Example in androidAhmadhttp://www.blogger.com/profile/00703191824388162129noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-88902209727634796.post-14336054020624151982013-04-15T23:31:20.157-07:002013-04-15T23:31:20.157-07:00Yes it can be done. In view pager you can change t...Yes it can be done. In view pager you can change the pages on swipe or dynamically using code.Ahmadhttps://www.blogger.com/profile/00703191824388162129noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-59739392952779591182013-04-15T07:56:06.034-07:002013-04-15T07:56:06.034-07:00Thanks for such a nice tutorial, here on different...Thanks for such a nice tutorial, here on different screens how do i save some data like a form or setting? i want to put this screens where user can enter data and instead of pressing next he or she just need to swipe the screen to go in next screen. How do i achieve this? is that possibble?<br /><br />ThanksAnonymoushttps://www.blogger.com/profile/07454115280017748047noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-38066557064713162452013-03-30T02:00:17.564-07:002013-03-30T02:00:17.564-07:00Hi,
Yes it will cut, Currently i am working on it...Hi, <br />Yes it will cut, Currently i am working on it to make pinch zoom gallery. As soon as i complete, will let you know. Keep visitingAhmadhttps://www.blogger.com/profile/00703191824388162129noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-36613213453152909342013-03-30T01:48:14.105-07:002013-03-30T01:48:14.105-07:00Hi,
Nice tutorial..Working great...!!
But if now i...Hi,<br />Nice tutorial..Working great...!!<br />But if now i want to add zoom functionality with View Pager. Actually I have searched for it and I get the solution in form of TouchImageView file. <br /><br />Now, zooming is done but the image cuts when it is zooed. <br /><br />Please help...Thanks in advance.<br /><br /><br /><br /><br /><br /><br /><br />Manali Shethhttps://www.blogger.com/profile/02155149585692048451noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-72421136799536661712013-02-05T08:25:58.668-08:002013-02-05T08:25:58.668-08:00First of all, i thank you for such worthy discussi...First of all, i thank you for such worthy discussion.But AFAIK, it can not work like ListView. I request you to come on <a href="http://www.facebook.com/androidtrainningcenter?ref=tn_tnmn" rel="nofollow">Tech Trainer FaceBook</a>Ahmadhttps://www.blogger.com/profile/00703191824388162129noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-1392023480821590112013-02-05T05:23:26.783-08:002013-02-05T05:23:26.783-08:00That is understood, i'm just looking at docume...That is understood, i'm just looking at documentation that says that PagerAdapter is more general from ViewAdapters allowing and requiring me to manually add/remove views and also keeps track by Objects instead of views. But how can I use that power, except like in example?<br />I can add more than one view to Pager in instantiateItem, I could do different compare in isViewFromObject, but I can't really think of any useful trick it can allow me.Ilyahttps://www.blogger.com/profile/17622778578511098787noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-69029971867171368802013-02-04T20:22:29.097-08:002013-02-04T20:22:29.097-08:00Hi Ilya,
We can not reuse View in sider Viewpager ...Hi Ilya,<br />We can not reuse View in sider Viewpager like ListView. As it keeps maximum of Three view. And then reload if its goes from these three. If you does not remove the then, it will waste the memoryAhmadhttps://www.blogger.com/profile/00703191824388162129noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-67915294658207993312013-02-04T14:03:48.473-08:002013-02-04T14:03:48.473-08:00Hi,
In all examples until now, isViewFromObject is...Hi,<br />In all examples until now, isViewFromObject is only implemented as "return arg0==arg1;". It works fine, of course, but it's interesting what else be done in this method? Can Views be reused, like with ListView?Ilyahttps://www.blogger.com/profile/17622778578511098787noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-31224411802820010902012-11-25T23:10:04.568-08:002012-11-25T23:10:04.568-08:00i tried to apply the method in (Scalling Image To ...i tried to apply the method in (Scalling Image To avoid Memory Error) to above code , but i think my way not calling the method to scale the image for some reason , please help me by fixing that , really appreciated , thanks.<br />my code attempt :<br /><br />public class ViewPagerAdapter extends PagerAdapter {<br /><br /> Activity activity;<br /> int imageArray[];<br /><br /> public ViewPagerAdapter(Activity act, int[] imgArra) {<br /> imageArray = imgArra;<br /> activity = act;<br /> }<br /><br /> public int getCount() {<br /> return imageArray.length;<br /> }<br /><br /> public Object instantiateItem(View collection, int position) {<br /> ImageView view = new ImageView(activity);<br /> view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,<br /> LayoutParams.MATCH_PARENT));<br /> view.setScaleType(ScaleType.CENTER_CROP);<br /> view.setBackgroundResource(imageArray[position]);<br /> ((ViewPager) collection).addView(view, 0);<br /> return view;<br /> }<br /><br /> @Override<br /> public void destroyItem(View arg0, int arg1, Object arg2) {<br /> ((ViewPager) arg0).removeView((View) arg2);<br /> }<br /><br /> @Override<br /> public boolean isViewFromObject(View arg0, Object arg1) {<br /> return arg0 == ((View) arg1);<br /> }<br /><br /> @Override<br /> public Parcelable saveState() {<br /> return null;<br /> }<br /> public static Bitmap decodeSampledBitmapFromResource(String imageArra,<br /> int reqWidth, int reqHeight) { <br /> <br /> // First decode with inJustDecodeBounds=true to check dimensions<br /> final BitmapFactory.Options options = new BitmapFactory.Options();<br /> options.inJustDecodeBounds = true;<br /> BitmapFactory.decodeFile(imageArra, options);<br /> <br /> // Calculate inSampleSize<br /> options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);<br /><br /> // Decode bitmap with inSampleSize set<br /> options.inJustDecodeBounds = false;<br /> return BitmapFactory.decodeFile(imageArra, options);<br /> }<br /><br /> <br /> public static int calculateInSampleSize(<br /> BitmapFactory.Options options, int reqWidth, int reqHeight) {<br /> // Raw height and width of image<br /> final int height = options.outHeight;<br /> final int width = options.outWidth;<br /> int inSampleSize = 1;<br /><br /> if (height > reqHeight || width > reqWidth) {<br /> if (width > height) {<br /> inSampleSize = Math.round((float)height / (float)reqHeight);<br /> } else {<br /> inSampleSize = Math.round((float)width / (float)reqWidth);<br /> }<br /> }<br /> return inSampleSize;<br /> }<br /> }<br /><br />androidqq6https://www.blogger.com/profile/13998801081734575250noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-87199196842364869902012-11-25T08:17:00.788-08:002012-11-25T08:17:00.788-08:00I looked on Scalling image to avoid Memory Error ,...I looked on Scalling image to avoid Memory Error , but i cant implemented to your code coz im new to android please help me with some code .thanksandroidqq6https://www.blogger.com/profile/13998801081734575250noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-78585964557793144432012-11-24T01:51:39.622-08:002012-11-24T01:51:39.622-08:00Thank you..Use my Ahmad Image Downloader> to d...Thank you..Use my <a href="http://androidtrainningcenter.blogspot.in/2012/10/android-lazy-loading-and-caching-of.html" rel="nofollow"> Ahmad Image Downloader></a> to download big images. Or If you getting error while displaying image then see <a href="http://androidtrainningcenter.blogspot.in/2012/04/displaying-bitmaps-efficiently-and.html" rel="nofollow">Scaling Image To avoid Memory Error</a>Ahmadhttps://www.blogger.com/profile/00703191824388162129noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-82860000833078260602012-11-24T01:32:51.743-08:002012-11-24T01:32:51.743-08:00very nice tutorial , i need your help when i place...very nice tutorial , i need your help when i place my images which is high definition image with large size it gave me this exception :<br />java.lang.OutOfMemoryError: bitmap size exceeds VM budget.<br /> any advice please how to fix it , im new to android development ,<br />thanks <br /><br />yours :<br /> androidqq6androidqq6https://www.blogger.com/profile/13998801081734575250noreply@blogger.comtag:blogger.com,1999:blog-88902209727634796.post-63021729102122749272012-11-24T01:30:05.312-08:002012-11-24T01:30:05.312-08:00very nice tutorialvery nice tutorialandroidqq6https://www.blogger.com/profile/13998801081734575250noreply@blogger.com