android-viewpager

Stop Android TabLayout loading next page automatically

Deadly 提交于 2019-12-20 03:55:09
问题 I've realized when using a tab layout in Android it always loads the tabs touching it, i.e. the tab before and the tab after so it is loaded when you page to it. However, I load lots of content and images from a server and this causes a lot of data and memory use and I often get OOM errors , I am displaying the images efficiently using Glide. Basically I need to know 3 things: How can I stop the tab layout loading any pages other than the current one How to clear/recycle/delete an old tab

How to update the List whenever the tabs are changing in view pager

孤街浪徒 提交于 2019-12-19 15:24:50
问题 In my app i am using navigation tab using view pager. I have able to successfully drawn the tabs using the code posted on: https://github.com/codepath/android_guides/wiki/Sliding-Tabs-with-PagerSlidingTabStrip Here i have used the Sliding tab and view pager both to get the navigation tabs.Everything is working fine but the list are not getting updated when i am moving to the other tab. OnResume() is getting called even the Object list variable is also getting updated while debugging but

java.lang.OutOfMemoryError: Failed to allocate a 571401228 byte allocation with 16777216 free bytes and 495MB until OOM

ぐ巨炮叔叔 提交于 2019-12-19 11:54:56
问题 I got an error with my android application. I want to use a viewPager as an android image slider, for this I got my AndroidImageAdapter.java, but when it comes to the method instantiateItem the application aborts and I don't know how to fix it. I already looked up the failure and added android:hardwareAccelerated="false" android:largeHeap="true" to my manifest, but it still remains. Here is the complete error code: java.lang.OutOfMemoryError: Failed to allocate a 571401228 byte allocation

Using Google Maps inside a Fragment in Android

强颜欢笑 提交于 2019-12-19 11:32:11
问题 I am trying to load Google Maps inside fragment ,and I keep getting the same error regardless of what solution I am trying to implement. I have already gone though all of the similar(if not the same) questions and have tried to do what the first few best answers have suggested but sadly without luck. So I really would appreciate it if you could help me out: My MainActivity.java is as follows: package com.nzf.nzf.nzfmap; import android.support.v4.app.Fragment; import android.os.Bundle; import

Fragment with ViewPager inside Fragment and FragmentStatePagerAdapter results in Exception (with complete example)

两盒软妹~` 提交于 2019-12-19 05:38:25
问题 I have a simple Fragment with a ViewPager. I'm using the up to date support library, v4 rev18! If I show the sub fragment the first time, everything works fine, if I go back and show it again, the app crashes with the following exception: I have a complete example which shows, WHEN the following exception is occuring: java.lang.NullPointerException at android.support.v4.app.FragmentManagerImpl.getFragment(FragmentManager.java:569) at android.support.v4.app.FragmentStatePagerAdapter

Fragment with ViewPager inside Fragment and FragmentStatePagerAdapter results in Exception (with complete example)

天涯浪子 提交于 2019-12-19 05:38:09
问题 I have a simple Fragment with a ViewPager. I'm using the up to date support library, v4 rev18! If I show the sub fragment the first time, everything works fine, if I go back and show it again, the app crashes with the following exception: I have a complete example which shows, WHEN the following exception is occuring: java.lang.NullPointerException at android.support.v4.app.FragmentManagerImpl.getFragment(FragmentManager.java:569) at android.support.v4.app.FragmentStatePagerAdapter

Viewpager and listviews

被刻印的时光 ゝ 提交于 2019-12-19 04:55:27
问题 I'm trying to use viewpager in my app. I want to create 4 view pages with listviews and every listview only data will change.When app started every page will load own data but only first one will be shown at the first time. But i can't do this.My fragment refresh own data every page changes and all the listviews always have same data.Please help me about this.I have asked this at stackoverflow but no one answer it.If there is a source about that can you send its link? 回答1: Take a look at this

ViewPager: java.lang.IllegalArgumentException: pointerIndex out of range

戏子无情 提交于 2019-12-19 04:17:09
问题 I am writing an code to handle touch event based on what suggested here. I am using ViewPager as an ViewGroup and ListView(I know #thisbad) as child view of Fragment. This is what I wanted to achieve: Detect multitouch event on child view then pass touch control to parent but While passing listener event from child View to Parent view it giving following error: E/AndroidRuntime(11414): java.lang.IllegalArgumentException:pointerIndex out of range E/AndroidRuntime(11414): at android.view

How to implement a viewpager inside of a fragment?

六月ゝ 毕业季﹏ 提交于 2019-12-19 04:12:26
问题 I have been looking and having a hard time finding a clear cut example? I am trying to understand how to create a viewpager within a fragment that is open as a drawer item from my mainActivity... This is my attempt but I think I am doing something wrong whether it be that I am including it incorrectly or have it in the wrong spot... public class RandomFragment extends android.app.Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

How to implement a viewpager inside of a fragment?

混江龙づ霸主 提交于 2019-12-19 04:11:59
问题 I have been looking and having a hard time finding a clear cut example? I am trying to understand how to create a viewpager within a fragment that is open as a drawer item from my mainActivity... This is my attempt but I think I am doing something wrong whether it be that I am including it incorrectly or have it in the wrong spot... public class RandomFragment extends android.app.Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle