Fragment Android Club 2015. Agenda Fragment Static fragment Dynamic fragment ViewPager.

Slides:



Advertisements
Similar presentations
Android Application Development Tutorial. Topics Lecture 6 Overview Programming Tutorial 3: Sending/Receiving SMS Messages.
Advertisements

Programming with Android: Android for Tablets Luca Bedogni Marco Di Felice Dipartimento di Scienze dellInformazione Università di Bologna.
Programming with Android: Android for Tablets Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Fragments: Introduction Fragments were introduced in Android 3.0 to support flexible and dynamic UI designs represent portions of an application’s user.
Android Fragments.
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
Programming with Android: Android Fragments Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Android Fragments A very brief introduction Android Fragments1.
ANDROID UI - DEVELOP AND DESIGN Peter Liu School of ICT, Seneca College.
ANDROID UI – FRAGMENTS. Fragment  An activity is a container for views  When you have a larger screen device than a phone –like a tablet it can look.
CS378 - Mobile Computing Web - WebView and Web Services.
Broadcast Receiver Android Club Agenda Broadcast Receiver Widget.
Mobile Programming Lecture 6
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Create Navigation Drawer Team 2 Zhong Wang Jiaming Dong Philip Wu Lingduo Kong.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
Android – Fragments L. Grewe.
Cosc 5/4730 Dialogs and below 3.0 and above (fragment)
Presented By: Muhammad Tariq Software Engineer Android Training course.
Silicon Valley Code Camp 2009 “Embellish Your Pictures” Build an Application for an Android Phone Jack Ha, Balwinder Kaur Oct 3, 2009 – 5:15PM Room CCL.
User notification Android Club Agenda Toast Custom Toast Notification Dialog.
Cosc 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
User Interface Android Club Agenda Button OnClickListener OnLongClickListener ToggleButton Checkbox RatingBar AutoCompleteTextView.
Activity Android Club Agenda Hello Android application Application components Activity StartActivity.
Android Boot Camp Demo Application – Part 1. Development Environment Set Up Download and install Java Development Kit (JDK) Download and unzip Android.
Mobile Programming Midterm Review
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Pearson Webcast Series
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
More UI Action Bar, Navigation, and Fragments
[Presentation Title] – Edit this footer by clicking on “View” tab,  “Slide Master” button  this slide’s layout [Date] Changing... Leading... Learning...
User Interface Layout Interaction. EventsEvent Handlers/Listeners Interacting with a user.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Blaise Senior UX Designer at AllofUs Friend of foxes Android UI The Basics.
Contents Searches related to Android RatingBar Basics Android ratingbar example Android custom ratingbar.
Class on Fragments & threads. Fragments fragment is a modular section of an activity, which has its own lifecycle, receives its own input events, and.
Android intro Building UI #1: basics. UI layout.xml Controls Layouts AdapterViews Toasts dp/sp/px Animations 2.
School of Engineering and Information and Communication Technology KIT305/KIT607 Mobile Application Development Android OS –Permissions (cont.), Fragments,
Android Fragments. Slide 2 Lecture Overview Getting resources and configuration information Conceptualizing the Back Stack Introduction to fragments.
The Flag Quiz app tests your ability to correctly identify 10 flags from various countries and territories.
Cosc 5/4730 Support design library. Support Design library Adds (API 9+) back support to a number of 5.0 lollipop widgets and material design pieces –
UI Redux, Navigation Patterns, Tabbed Views, Pagers, Drawers
Fragments and Menus Chapter 4 1. Objectives Learn three different types of menus: options, context, and popup Learn to configure the ActionBar and Toolbar.
Fragment ANDROID CLUB 2015.
Open Handset Alliance.
Fragment ?.
Fragments: Introduction
Android 3: Fragments: API Guide
CS499 – Mobile Application Development
Mobile Application Development BSCS-7 Lecture # 6
Android 16: Fragments: Tutorial
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Android 15: Fragments: API Guide
Android – Fragments L. Grewe.
ANDROID UI – FRAGMENTS UNIT II.
Navigation Patterns Using Fragments
Depreciation App: Demo of tabs
CIS 470 Mobile App Development
Chapter 9: Fragments.
Android App Developing with communication included
دانشگاه شهیدرجایی تهران
Mobile Applications (Android Programming)
تعهدات مشتری در کنوانسیون بیع بین المللی
To Navigate the Slideshow
CIS 470 Mobile App Development
Android Developer Fundamentals V2
Enhanced Slideshow App
Mobile Programming Dr. Mohsin Ali Memon.
Activities and Fragments
Android Sensor Programming
Presentation transcript:

Fragment Android Club 2015

Agenda Fragment Static fragment Dynamic fragment ViewPager

What is fragment? Fragment – used to show part of Activity’s UI. Introduced in Android 3.0 Honeycomb Initially was developed for tablets

Why to use fragment? 1. Form-factor 2. Passing information 3. Tabs & spinner 4. Swipe based navigation

Static fragment: example

Static fragment: practice Create new Activity It should contain three fragments FirstFragment: bg: purple, contains: ToggleButton SecondFragment: bg: white, contains: RatingBar ThirdFragment: bg: brown, contains: EditText

Dynamic fragment: 4 steps 1. Reference FragmentManager 2. Begin FragmentTransaction 3. Add fragment to transaction 4. Commit

Dynamic fragment: example FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); RedFragment fragment = new RedFragment(); transaction.add(R.id.flFragments, fragment); transaction.commit();

Dynamic fragment: practice Create three buttons for FirstFragment, SecondFragment, ThirdFragment Change fragments dynamically on click each button

ViewPager adapter: example public class MyPagerAdapter extends FragmentStatePagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); public Fragment getItem(int position) { switch(position) { case 0: return new RedFragment(); case 1: return new YellowFragment(); } return null; public int getCount() { return 2; } }

android.support.v4.view.Vie wPager: example ViewPager vpPager = (ViewPager) findViewById(R.id.vpPager); MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManag er()); vpPager.setAdapter(adapter);

ViewPager: practice Create new ViewPager Create new FragmentStatePagerAdapter for ViewPager Set FragmentStatePagerAdapter as ViewPager’s adapter

Homework 1: static fragment Create new activity In activity’s layout add 5 fragments Each fragment’s height should 100dp Each fragment should contain different views

Homework 2: dynamic fragment Create new Activity Activity’s layout should contain 5 buttons and one framelayout On click each button, should show separate button It should look like Facebook app

Homework 3: viewpager Create new Activity Put one ViewPager Create adapter for it ViewPager should show images as slideshow. 10 images!

Questions? Any quesitons?

Thank you! Thank you very much for your attention!