android-viewpager

IllegalStateException: database already closed (using ViewPager)

蹲街弑〆低调 提交于 2020-01-02 04:44:09
问题 I'm stumped as to what is causing this error, as I have made sure that I am closing my database adapter properly (at least I think I am). Here's what LogCat's saying (the tag for all of them is AndroidRuntime): FATAL EXCEPTION: main java.lang.IllegalStateException: database /data/data/com.acedit.assignamo/databases/data.db (conn# 0) already closed at android.database.sqlite.SQLiteDatabase.verifyDbIsOpen(SQLiteDatabase.java:2082) at android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase

Failed to Load fragments when tabs + viewpager inside scrollview ?

…衆ロ難τιáo~ 提交于 2020-01-02 04:20:28
问题 using material design tablayout +viewpager material design tablayout everything works perfectly but if i m trying to put parent view as ScrollView so that my whole screen can scroll once user try to see tabs fragment content as fragment contains listview so it is getting very low height on small devices.After adding scrollview my fragments of viewpager are not being displayed ?how to overcome in this situation ? <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas

android - combine horizontal viewpager with vertical viewpager

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 03:35:07
问题 I want to combine a default horizontal ViewPager with some kind of a vertical ViewPager. My approach would be that the Fragments provided by the horizontal ViewPager, are subclassing the vertical ViewPager. public class SubWebViewFragment extends Fragment, VerticalViewPager { } Thus each Fragment provided by the horizontal ViewPager should at the same time act as a VerticalViewPager, building up some kind of a matrix. In addition I have to have the possibility to go to a certain page in this

ViewPager with different adapters for portrait and landscape

好久不见. 提交于 2020-01-02 03:29:12
问题 In portrait mode, my ViewPager has 3 fragments A, B, C but in landscape mode, it has only 2 fragments A and C. So I create 2 FragmentStatePagerAdapter s for each mode. The problem is when screen orientation changed, ViewPager restores and uses previous fragments of old orientation. For example, when change orientation from portrait to landscape, ViewPager now shows 2 fragments A, B instead of A and C. I know why this happen but can't find a good solution for this. My current workaround is to

customize padding and margin in IconPageIndicator

隐身守侯 提交于 2020-01-02 02:23:27
问题 I am trying to implement a custom IconPageIndicator - viewpager. I want to customize the margins and paddings of the icons displayed in com.viewpagerindicator.IconPageIndicator. So I wrote my custom IconPageIndicator and CustomLinearLayout. I changed the dividerPadding variable in CustomLinearLayout. Here is the code. But this doesn't seem to work. The margins and paddings are still the same. Any help? class CustomLinearLayout extends LinearLayout { private static final int[] LL = new int[] {

AsyncTask runs on each page of the ViewPager

穿精又带淫゛_ 提交于 2020-01-02 00:49:30
问题 I have 3 Tabs like in the android development tutorial Now what I want to do is very simple I use Fragments on each page. I want to show different content from a rss feed on each page. The problem is when I go to the next tab it runs AsyncTask (which is in onCreateView) of the previous Fragment. So you start on Page 1 it loads the content fine. Then when you go to Page 2 is runs the onCreateView of the Fragment of Page 1 again. And obviously gives an NullException. The point is it should not

How to display video in VideoView in the center of the screen?

断了今生、忘了曾经 提交于 2020-01-01 19:22:11
问题 I am creating ViewPager with two VideoViews . On sliding pages, video on current page start playing. One problem: how to display video in VideoView in the center of the screen ? Here is my code, MainActivity.java: public class MainActivity extends Activity{ private class MyViewPagerAdapter extends PagerAdapter implements ViewPager.OnPageChangeListener { private Vector<View> pages; private ViewGroup myContainer; private int currentPageId; private boolean flag; public MyViewPagerAdapter(Context

Android:ViewPager - PagerSlidingTabStrip, Custom Tab Background on state_selected

浪子不回头ぞ 提交于 2020-01-01 19:17:52
问题 I need to use a custom background for each tab when each one of them is in state_selected mode. But still nothing happens when I select a tab. I used selector like this: ( tab_selector.xml ) <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@drawable/gradient_tab" /> <item android:state_selected="false" android:drawable="@drawable/tab_unselected" /> <item android:drawable="@drawable/tab_unselected"/> </selector> And

Indicate after swiping the last page in ViewPager

情到浓时终转凉″ 提交于 2020-01-01 15:59:10
问题 I have created a view pager with circle page indicator. Its working fine. Here is my new requirement : When i'am in last/first page and try to swipe for next/previous page, my screen should move at least 30% towards the swiped direction and come back to its original position as there are no more pages to navigate? Of course i have page indicators at top which tells where am i in available pages. I hope my requirement is clear. How can i achieve it ? Please help me. Thanks in advance. 回答1:

Android viewpager: weird bug when adding/removing page

末鹿安然 提交于 2020-01-01 14:40:13
问题 I dont know how to explain this, so i uploaded a video in Youtube. Everything works fine when i am adding pages. Also removing page works if i start at the end of the list and move progressively to the first page, but if i remove somewhere between 0-end and after that i add page, i am getting a blank page. Fragment is created but view is not. Is there something wrong with my code? Yes, i have seen this question, returning POSITION_NONE is not an option, because application i am working on