Posts

Showing posts with the label Dynamically create Fragment

Dynamically create Fragments in android with ViewPager

Image
In this article I am going to describe step by step how we can Dynamically create tabs in the android app. Steps involve in achieving the result: 1. Start with creating a new project 2. Define the Database Layer 3. Writing Fragment and Fragment Pager Adapter 4. Update main activity to work with ViewPager Part 1: Start with creating a new app project   (I am using android studio for development) Click on android studio > Start a new Android Studio Project > Specify Project Name, location and Press Next > Select your appropriate Minimum SDK and click Next  > Select Empty Activity and Press Next > Specify the Activity name (if required) and Press Finish. So now we are ready to go. Part 2: Implementing Database Layer Contract Class Our next step is creating a Database layer -  why we need Database the answer is we will be fetching the tab details from sqlite database. Create a folder 'Data' under your package folder and then create a cla...