android-viewpager

Android ViewPager Refresh fragment

我的梦境 提交于 2019-12-29 07:03:07
问题 In my app there's 2 tabs (Android Design Support Library) this is the Fragment with ViewPagerAdapter: public class ListaCanali extends Fragment { public static TabLayout tabLayout; public static ViewPager viewPager; public static int int_items = 2 ; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v =inflater.inflate(R.layout.lista_canali, container,false); //Titolo Fragment ((MainActivity) getActivity())

ViewPager with multiple visible children and selected bigger

自古美人都是妖i 提交于 2019-12-29 06:22:23
问题 In my Activity I've added a Gallery -like View using Dave Smith's PagerContainer example and the code I'm using to instantiate it is very similar to the PagerActivity in his example, while I changed the layout because I needed to use layout weights: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <com.example.myapp

Video is not pausing in fragment ViewPager

孤者浪人 提交于 2019-12-29 05:25:08
问题 I am using View Pager with fragment to showing image and video, I am able to show image and video properly but I have problem, when I swipe for video, then video is playing, but I swipe next or previous then video is still playing on just next or previous screen but when I move two slide next or previous then video is being stop, but why not on next or previous slide. I search it more but I did not get any solution, any help will be appreciable. Thanks in advance. Here is my code: This is

WebView reloading when Fragment in ViewPager is retained form BackStack

喜你入骨 提交于 2019-12-29 04:33:47
问题 Here is a code for a basic Fragment which contains a WebView . WebFragment.java public class WebFragment extends Fragment { String TAG = "WebFragment"; private WebView webView; private String currentUrl = "http://www.google.com"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.webview_layout, null); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated

Android Viewpager saving data and views

老子叫甜甜 提交于 2019-12-29 03:59:59
问题 Hopefully someone can help me with a slight problem/confusion I have with Viewpagers and saving data. PROBLEM: When scrolling across the four views I have, the first view has two spinners, two textviews that display a string or a selected item. if I scroll on to the third page and back to the second page, the data in the first view is lost. hense needing to save the data. Would this be done in the two routines stated below? (best guess is it would be) if so, what sort of commands need to be

Disabling & Enabling Paging In ViewPager in Android

旧巷老猫 提交于 2019-12-29 03:59:29
问题 I am using android compatibility package version 4 for displaying pdf pages in my app. I have used PagerAdapter & ViewPager for displaying pdf pages like horizontal scroll view. Now the problem is in paging related stuff.I am able to stop paging by detecting childs inside the viewpager according to this thread android: ViewPager and HorizontalScrollVIew, but how can I can enable that back when user touches outside of that view. I have used following code for CustomViewPager. public class

Android: Where to put activity's onCreate() code in a fragment?

穿精又带淫゛_ 提交于 2019-12-29 03:28:32
问题 I'm converting all my Activities to Fragments so that I can use them in a ViewPager. I've searched for this but I couldn't find a satisfying answer, so that's why I'm asking it here. In my Activities, I've written some code in the onCreate() method. I for example call some findViewById() s in order to link some xml-buttons to my Activity. I also make some views invisible in the onCreate() , set an OnClickListener() , fill a TextView with text and remove a Notification, all in the onCreate()

Fragment as a singleton in Android

放肆的年华 提交于 2019-12-29 03:21:28
问题 General Question Can I define Fragments as Singletons? Specific question In my application I have one 'FragmentActivity' with a FragmentPager which has two Fragments, FragmentA and FragmentB . I defined the fragments as Singletons in the FragmentA extends Fragment class: private static instance = null; public static FragmentA getInstance() { if (instance == null) { instance = new FragmentA(); } return instance; } private FragmentA() {} and in my FragmentPagerAdapter : @Override public

how to change the image automatically in view pager when it reaches the last image it should come to the first image automatically

谁都会走 提交于 2019-12-29 01:51:09
问题 I am now implementing the view pager and i want to continuously change the image one by one automatically for a particular periods of time may be once in 5 ms . I also have to manually allow the user to swipe the images (it is working properly) But the image is not automatically changing and when it reaches the last image it should come to the first image automatically final Handler handler = new Handler(); final Runnable Update = new Runnable() { public void run() { if (currentPage ==

Saving Fragment state in ViewPager

非 Y 不嫁゛ 提交于 2019-12-28 08:09:13
问题 I tried out the sample code from the API and it didn't really work so I implemented my own: FragmentPagerSupport public class FragmentPagerSupport extends FragmentActivity { static final int NUM_ITEMS = 10; MyAdapter mAdapter; ViewPager mPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mAdapter = new MyAdapter(getSupportFragmentManager()); Log.i("Pager", "mAdapter = " + mAdapter.toString()); mPager =