Tag: android-viewpager

Highlight or underline selected TabPageIndicator

I have a dualpane on a tablet-sized landscape layout and I’m using fragments. On the left I have a fragment with a listview. When a click occurs on one of the item list the right fragment loads the detail. In the layout of the right (detail) fragment there is a com.viewpagerindicator.TabPageIndicator and a android.support.v4.view.ViewPager. The […]

Refresh images on FragmentStatePagerAdapter on resuming activity

I have created an activity that uses FragmentStatePagerAdapter to provide small gallery. However, I can’t get it to refresh when activity resumes (after coming back from other activity, for example). Every time first two pictures will be blank, and only after i swipe two pictures to the side, they get refreshed. None of the answers […]

Changing animation style of ViewPager

I want to change the animation style of Android’s ViewPager class with using Android Animation Framework. Is it possible?

Android ViewPager throwing IndexOutOfBounds exception when setting current item/page

I have a ViewPager with three items. I am trying to set the ViewPager to view the page furthest to the right (which would be the 2nd element). This is returning an IndexOutOfBounds exception, though I know the index ought to be in bounds. Here is the exact stack: 02-22 12:22:50.256: E/AndroidRuntime(384): FATAL EXCEPTION: main […]

android viewpager change adapter

I’m developing an app with a ViewPager for lateral scrolling tables, sometimes i need to change the adapter to load a different set of tables. I’ve tried to do the following: mViewPager.setAdapter(new pagerAdapterPushed(getSupportFragmentManager())); mViewPager.getAdapter().notifyDataSetChanged(); indicator.setViewPager(mViewPager); indicator.invalidate(); mViewPager.invalidate(); but it always reload the previous data. Isn’t it possibile to change the adapter of a ViewPager?

Android using viewPager vs using tabhost

In my Android application I have had to use a tab layout and I want to choose a one from folowing scenarios. they are using viewPager using tab host what are the advantages of viewPager over tabhost. Which one is better. And I’m targeting the android 4.2. Thank You!

Android setBackgroundResource cause out of memory excepiton

I’m working on a gamebook application that shows 12 views in a ViewPager. This is my custom PagerAdapter : private class ImagePagerAdapter extends PagerAdapter { private int[] mImages = new int[] { R.drawable.copertinai, R.drawable.blui, R.drawable.azzurroi, R.drawable.rossoi, R.drawable.gialloi, R.drawable.verdei, R.drawable.rosai, R.drawable.grigioi, R.drawable.neroi, R.drawable.arancionei, R.drawable.marronei, R.drawable.violai, R.drawable.ulm }; @Override public int getCount() { return mImages.length; } @Override […]

Fix the Animation of a Circular ViewPager

Goal Build a Circular ViewPager. The first element lets you peak to the last element and swipe to it, and vice versa. You should be able to swipe in either direction forever. Now this has been accomplished before, but these questions do not work for my implementation. Here are a few for reference: how to […]

AsyncTask runs on each page of the ViewPager

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) […]

Android how to stop refreshing Fragments on tab change

I have the following code : MainActivity.java package com.erc.library; import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.FragmentTransaction; import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.Color; import android.os.Bundle; import android.os.Environment; import android.os.StrictMode; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.TextView; import android.widget.Toast; import com.erc.sayeghlibrary.adapter.TabsPagerAdapter; […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.