android.support.wearable.view.GridViewPager Java Examples
The following examples show how to use
android.support.wearable.view.GridViewPager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java From AndroidWearable-Samples with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Adjust page margins: // A little extra horizontal spacing between pages looks a bit // less crowded on a round display. final boolean round = insets.isRound(); int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin); int colMargin = res.getDimensionPixelOffset(round ? R.dimen.page_column_margin_round : R.dimen.page_column_margin); pager.setPageMargins(rowMargin, colMargin); return insets; } }); pager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager())); }
Example #2
Source File: CPPActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); percentage = extras.getInt("percentage", -1); timeshift = extras.getInt("timeshift", -1); if (percentage ==-1 || timeshift ==-25){ finish(); return; } if(timeshift < 0) timeshift += 24; setContentView(R.layout.grid_layout); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(new MyGridViewPagerAdapter()); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); }
Example #3
Source File: MainActivity.java From TutosAndroidFrance with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (GridViewPager) findViewById(R.id.pager); dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); //initialise Emmet emmet = new Emmet(); emmet.onCreate(this); emmet.registerReceiver(WearProtocol.class, this); SmartphoneProtocol smartphoneProtocol = emmet.createSender(SmartphoneProtocol.class); smartphoneProtocol.hello(); //envoie le message hello smartphone }
Example #4
Source File: TempTargetActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.grid_layout); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(new MyGridViewPagerAdapter()); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); isMGDL = sp.getBoolean("units_mgdl", true); isSingleTarget = sp.getBoolean("singletarget", true); }
Example #5
Source File: ImageViewerActivity.java From android-wear-gopro-remote with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_picture_viewer); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mPager = (GridViewPager)findViewById(R.id.pagerView); mImageViewAnim = (ImageView)findViewById(R.id.imageViewAnim); setImageFromIntent(getIntent(), false); mPager.setOnPageChangeListener(this); }
Example #6
Source File: CommentsActivity.java From wear-notify-for-reddit with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_comments); final String stringComments = getIntent().getStringExtra(Constants.KEY_REDDIT_POSTS); final ArrayList<Comment> comments = mGson.fromJson(stringComments, new TypeToken<List<Comment>>() { }.getType()); if (comments == null || comments.isEmpty()) { Toast.makeText(this, R.string.thread_has_no_comments_yet, Toast.LENGTH_SHORT).show(); finish(); } else { mGridViewPager = (GridViewPager) findViewById(R.id.pager); mGridViewPager.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // A little extra horizontal spacing between pages looks a bit less crowded on a round display int rowMargin = getResources().getDimensionPixelOffset(R.dimen.page_row_margin); int colMargin = getResources().getDimensionPixelOffset(insets.isRound() ? R.dimen.page_column_margin_round : R.dimen.page_column_margin); mGridViewPager.setPageMargins(rowMargin, colMargin); // GridViewPager relies on insets to properly handle layout for round displays // They must be explicitly applied since this listener has taken them over mGridViewPager.onApplyWindowInsets(insets); return insets; } }); mGridViewPager.setAdapter(new CommentsGridPagerAdapter(CommentsActivity.this, getFragmentManager(), comments)); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(mGridViewPager); } }
Example #7
Source File: GridExampleActivity.java From android-SkeletonWearableApp with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.grid_activity); mPager = (GridViewPager) findViewById(R.id.fragment_container); mAdapter = new MainAdapter(this, getFragmentManager()); mPager.setAdapter(mAdapter); }
Example #8
Source File: GridExampleActivity.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.grid_activity); mPager = (GridViewPager) findViewById(R.id.fragment_container); mAdapter = new MainAdapter(getFragmentManager()); mPager.setAdapter(mAdapter); }
Example #9
Source File: MainActivity.java From android-GridViewPager with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Adjust page margins: // A little extra horizontal spacing between pages looks a bit // less crowded on a round display. final boolean round = insets.isRound(); int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin); int colMargin = res.getDimensionPixelOffset(round ? R.dimen.page_column_margin_round : R.dimen.page_column_margin); pager.setPageMargins(rowMargin, colMargin); // GridViewPager relies on insets to properly handle // layout for round displays. They must be explicitly // applied since this listener has taken them over. pager.onApplyWindowInsets(insets); return insets; } }); pager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager())); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); }
Example #10
Source File: MainActivity.java From DaVinci with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (GridViewPager) findViewById(R.id.pager); dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); mImageView = (ImageView) findViewById(R.id.imageWithTransparency); DaVinci.with(this).load("http://www.seomofo.com/downloads/new-google-logo-knockoff.png").into(mImageView); }
Example #11
Source File: MainActivity.java From WearViewStub with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (GridViewPager) findViewById(R.id.pager); dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); elementList = creerListElements(); pager.setAdapter(new ElementGridPagerAdapter(elementList,getFragmentManager())); }
Example #12
Source File: UARTCommandsActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_grid_pager); final Intent intent = getIntent(); final UartConfiguration configuration = intent.getParcelableExtra(CONFIGURATION); configurationId = configuration.getId(); // Check if the WEAR device is connected to the UART device itself, or by the phone. // Binding will fail if we are using phone as proxy as the service has not been started before. final Intent service = new Intent(this, BleProfileService.class); bindService(service, serviceConnection, 0); // Set up tht grid final GridViewPager pager = findViewById(R.id.pager); pager.setAdapter(adapter = new UARTCommandsAdapter(configuration, this)); final DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); // Configure Google API client googleApiClient = new GoogleApiClient.Builder(this) .addApi(Wearable.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); // Register the broadcast receiver that will listen for events from the device final IntentFilter filter = new IntentFilter(); filter.addAction(BleProfileService.BROADCAST_CONNECTION_STATE); filter.addAction(BleProfileService.BROADCAST_ERROR); filter.addAction(UARTProfile.BROADCAST_DATA_RECEIVED); LocalBroadcastManager.getInstance(this).registerReceiver(serviceBroadcastReceiver, filter); }
Example #13
Source File: MainActivity.java From WearMenu with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (GridViewPager) findViewById(R.id.pager); dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); elementList = creerListElements(); pager.setAdapter(new ElementGridPagerAdapter(this,elementList,getFragmentManager())); final WearMenu wearMenu = (WearMenu) findViewById(R.id.wear_menu); wearMenu.setMenuElements( new String[]{ "title 1", "title 2", "title 3", "title 4" }, new Drawable[]{ getResources().getDrawable(R.drawable.ic_car,null), getResources().getDrawable(R.drawable.ic_notif,null), getResources().getDrawable(R.drawable.ic_picture,null), getResources().getDrawable(R.drawable.ic_speak,null) } ); wearMenu.setWearMenuListener(new WearMenu.WearMenuListener() { @Override public void onWearMenuListClicked(int position) { } }); }
Example #14
Source File: ReviewFragment.java From AnkiDroid-Wear with GNU General Public License v2.0 | 5 votes |
/** * Use this factory method to create a new instance of * this fragment. * * @param settings * @return A new instance of fragment ReviewFragment. */ public static ReviewFragment newInstance(Preferences settings, GridViewPager gridViewPager) { ReviewFragment fragment = new ReviewFragment(); Bundle args = new Bundle(); ReviewFragment.settings = settings; ReviewFragment.gridViewPager = gridViewPager; fragment.setArguments(args); return fragment; }
Example #15
Source File: MainActivity.java From TutosAndroidFrance with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (GridViewPager) findViewById(R.id.pager); dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); //elementList = creerListElements(); //pager.setAdapter(new ElementGridPagerAdapter(elementList,getFragmentManager())); }
Example #16
Source File: FillActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.grid_layout); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(new MyGridViewPagerAdapter()); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); }
Example #17
Source File: BolusActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.grid_layout); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(new MyGridViewPagerAdapter()); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); }
Example #18
Source File: ECarbActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.grid_layout); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(new MyGridViewPagerAdapter()); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); }
Example #19
Source File: WizardActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.grid_layout); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(new MyGridViewPagerAdapter()); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); hasPercentage = sp.getBoolean("wizardpercentage", false); }
Example #20
Source File: AcceptActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.dismissThread = new DismissThread(); dismissThread.start(); Bundle extras = getIntent().getExtras(); title = extras.getString("title", ""); message = extras.getString("message", ""); actionstring = extras.getString("actionstring", ""); if ("".equals(message) || "".equals(actionstring) ){ finish(); return; } setContentView(R.layout.grid_layout); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(new MyGridViewPagerAdapter()); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); long[] vibratePattern = new long[]{0, 100, 50, 100, 50}; v.vibrate(vibratePattern, -1); }
Example #21
Source File: WearMenu.java From WearMenu with Apache License 2.0 | 4 votes |
private GridViewPager findGridViewPager() { GridViewPager viewPager = (GridViewPager) findViewByClass(this, GridViewPager.class); return viewPager; }
Example #22
Source File: AttractionsActivity.java From io2015-codelabs with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final FrameLayout topFrameLayout = (FrameLayout) findViewById(R.id.topFrameLayout); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mGridViewPager = (GridViewPager) findViewById(R.id.gridViewPager); mDotsPageIndicator = (DotsPageIndicator) findViewById(R.id.dotsPageIndicator); mAdapter = new AttractionsGridPagerAdapter(this, mAttractions); mAdapter.setOnChromeFadeListener(this); mGridViewPager.setAdapter(mAdapter); topFrameLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Call through to super implementation insets = topFrameLayout.onApplyWindowInsets(insets); boolean round = insets.isRound(); // Store system window insets regardless of screen shape mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); if (round) { // On a round screen calculate the square inset to use. // Alternatively could use BoxInsetLayout, although calculating // the inset ourselves lets us position views outside the center // box. For example, slightly lower on the round screen (by giving // up some horizontal space). mInsets = Utils.calculateBottomInsetsOnRoundDevice( getWindowManager().getDefaultDisplay(), mInsets); // Boost the dots indicator up by the bottom inset FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mDotsPageIndicator.getLayoutParams(); params.bottomMargin = mInsets.bottom; mDotsPageIndicator.setLayoutParams(params); } mAdapter.setInsets(mInsets); return insets; } }); // Set up the DismissOverlayView mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(getString(R.string.exit_intro_text)); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); Uri attractionsUri = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTIONS_URI); if (attractionsUri != null) { new FetchDataAsyncTask(this).execute(attractionsUri); UtilityService.clearNotification(this); UtilityService.clearRemoteNotifications(this); } else { finish(); } }
Example #23
Source File: AttractionsActivity.java From io2015-codelabs with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final FrameLayout topFrameLayout = (FrameLayout) findViewById(R.id.topFrameLayout); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mGridViewPager = (GridViewPager) findViewById(R.id.gridViewPager); mDotsPageIndicator = (DotsPageIndicator) findViewById(R.id.dotsPageIndicator); mAdapter = new AttractionsGridPagerAdapter(this, mAttractions); mAdapter.setOnChromeFadeListener(this); mGridViewPager.setAdapter(mAdapter); topFrameLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Call through to super implementation insets = topFrameLayout.onApplyWindowInsets(insets); boolean round = insets.isRound(); // Store system window insets regardless of screen shape mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); if (round) { // On a round screen calculate the square inset to use. // Alternatively could use BoxInsetLayout, although calculating // the inset ourselves lets us position views outside the center // box. For example, slightly lower on the round screen (by giving // up some horizontal space). mInsets = Utils.calculateBottomInsetsOnRoundDevice( getWindowManager().getDefaultDisplay(), mInsets); // Boost the dots indicator up by the bottom inset FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mDotsPageIndicator.getLayoutParams(); params.bottomMargin = mInsets.bottom; mDotsPageIndicator.setLayoutParams(params); } mAdapter.setInsets(mInsets); return insets; } }); // Set up the DismissOverlayView mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(getString(R.string.exit_intro_text)); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); Uri attractionsUri = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTIONS_URI); if (attractionsUri != null) { new FetchDataAsyncTask(this).execute(attractionsUri); UtilityService.clearNotification(this); UtilityService.clearRemoteNotifications(this); } else { finish(); } }
Example #24
Source File: AttractionsActivity.java From wear-os-samples with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final FrameLayout topFrameLayout = (FrameLayout) findViewById(R.id.topFrameLayout); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mGridViewPager = (GridViewPager) findViewById(R.id.gridViewPager); mDotsPageIndicator = (DotsPageIndicator) findViewById(R.id.dotsPageIndicator); mAdapter = new AttractionsGridPagerAdapter(this, mAttractions); mAdapter.setOnChromeFadeListener(this); mGridViewPager.setAdapter(mAdapter); mDotsPageIndicator.setPager(mGridViewPager); mDotsPageIndicator.setOnPageChangeListener(mAdapter); topFrameLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Call through to super implementation insets = topFrameLayout.onApplyWindowInsets(insets); boolean round = insets.isRound(); // Store system window insets regardless of screen shape mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); if (round) { // On a round screen calculate the square inset to use. // Alternatively could use BoxInsetLayout, although calculating // the inset ourselves lets us position views outside the center // box. For example, slightly lower on the round screen (by giving // up some horizontal space). mInsets = Utils.calculateBottomInsetsOnRoundDevice( getWindowManager().getDefaultDisplay(), mInsets); // Boost the dots indicator up by the bottom inset FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mDotsPageIndicator.getLayoutParams(); params.bottomMargin = mInsets.bottom; mDotsPageIndicator.setLayoutParams(params); } mAdapter.setInsets(mInsets); return insets; } }); // Set up the DismissOverlayView mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(getString(R.string.exit_intro_text)); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); Uri attractionsUri = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTIONS_URI); if (attractionsUri != null) { new FetchDataAsyncTask(this).execute(attractionsUri); UtilityService.clearNotification(this); UtilityService.clearRemoteNotifications(this); } else { finish(); } }
Example #25
Source File: MainActivity.java From ETSMobile-Android2 with Apache License 2.0 | 3 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (GridViewPager) findViewById(R.id.pager); imageViewNoCourses = (ImageView) findViewById(R.id.imageview_no_courses); adapter = new SeancesPagerAdapter(MainActivity.this, new ArrayList<Seances>()); pager.setAdapter(adapter); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { ArrayList<Seances> seances = intent.getParcelableArrayListExtra("seances"); loadSeances(seances); } }; }