Advertisement
Fhernd

MainActivity.java

Jul 19th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. package co.ortizol.u4s3c5ex2tiendamultimedia;
  2.  
  3. import android.support.design.widget.TabLayout;
  4. import android.support.v4.view.ViewPager;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.support.v7.widget.Toolbar;
  8.  
  9. import co.ortizol.u4s3c5ex2tiendamultimedia.adapters.MultimediaTabsAdapter;
  10.  
  11. public class MainActivity extends AppCompatActivity {
  12.  
  13.     @Override
  14.     protected void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.activity_main);
  17.  
  18.         Toolbar tbrPrincipal = (Toolbar) findViewById(R.id.tbrPrincipal);
  19.         setSupportActionBar(tbrPrincipal);
  20.  
  21.         TabLayout tblSeccionesMultimedia = (TabLayout) findViewById(R.id.tblSeccionesMultimedia);
  22.         ViewPager vprMultimedia = (ViewPager) findViewById(R.id.vprMultimedia);
  23.  
  24.         if(vprMultimedia != null){
  25.             vprMultimedia.setAdapter(new MultimediaTabsAdapter(getSupportFragmentManager(), this));
  26.         }
  27.  
  28.         if(tblSeccionesMultimedia != null){
  29.             tblSeccionesMultimedia.setupWithViewPager(vprMultimedia, true);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement