Skip to main content

Posts

Android FloatingActionButton example.

Floating Action Button represents the primary action in application. They are used for special type of promoted actions. It is shaped like a Circled icon Floating above the UI. Floating Action button has 2 sizes , Default(56dp*56dp) and Mini(40dp*40dp) .   Floating Action Button is a material design compenent so we need to follow some design guidelines while using it Important Floating Action Button Desin Guidelines Floating Buttons should only be used for positive actions like create,favorite,share,explore . It should not be used for destructive actions like delete,alerts,errors.. It should be placed minimum 16dp from the edge of the screen Icon inside the Floating Action Button should 24dp Only one floating Action button recommended per screen For more Guidelines visit  https://material.io/guidelines/components/buttons-floating-action-button.html Floting ActionBar has special motion behaviour like morohing,launching and tranferring anchor points. It ca...

Android Carview With PopupMenu example

This demo Application shows how to use PopupMenu with CardView inside RecyclerView . I have already written one post about using CardView with RecycleView . Refer that post before proceeding to this one. http://androidtuts4u.blogspot.in/2017/09/android-card-view-example.html ScreenShots of the demo application are      Our Demo Application consist of List of cards . Each card contains movie poster , movie name , director name and popup menu icon . On clicking the popup menu icon popup Menu is shown with menu items. On clicking each menu item a Toast is shown  . 1.First we need to add the dependency for CardView and RecyclerView in app level build.gradle file . build.gradle  apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion "26.0.1" defaultConfig { applicationId "com.androidtuts4u.arun.cardviewmenu" minSdkVersion 16 targetSdkVersion 26 versionCode...

Android Card View And RecyclerView Example

CardView Cardview lets you show information inside cards that have consistent look across the platform . CardView is introduced with material design through support v7 library. CardView extends frame layout and It can have shadows and round corners.     Cards can be used as independent views that serves as an entry point to more detailed information. CardView can also  be used with RecyclerView to display cards as list. In this example we are using Cardview with Recyclerview to show data as list of cards. Our Demo application contains vertical list of cards . Each card contain Movie name, movie poster and director name. screenshot of demo app 1. CardView and RecyclerView are supportV7 library widget . so we need to add dependency for both in app level build.gradle file . which is in the app folder compile 'com.android.support:cardview-v7:26.+' compile 'com.android.support:recyclerview-v7:26.+' build.gradle file is apply plugin: 'com.android.applicat...

Android RecyclerView Example

RecyclerView RecyclerView is the advanced version of Listview . It has more flexibility than ListView . RecyclerView is Compatible with Api level 7 onward . We need an adpater class and layout manager for creating Recyclerview.  RecyclerView has 3 built in layout managers LinearlayoutManager - this shows items in vertical or horizontal list GridLayoutManger - this shows item in a grid StaggeredGridLayout Manager - this shows item in a staggered grid we can also create custom layout mangers by extending RecyclerView.LayoutManager class RecyclerView does not have a divider to separate ts iitems . if we want divider we need to extend ItemDecoration class to display the divider RecyclerView also does not have an onItemClickListener for onClick events so we need a class extending RecyclerView.OnItemTouchListener for onclick events or we can use onlick listener in our adapter class we use LinearLayoutManager and a custom Adapter class in this example . This Demo ap...

Using Toolbar In Android

Toolbar Toolbar is used in our application as an app bar providing useful information to the user. From API level  11 ActionBar had been used as default app bar. But with newer versions and newer features ActionBar looks and behaves differently on devices depending on the version of the android it is using . So Toolbar is introduced in Android Support library to provide consistent look and behavior to our application for a wide range of devices . Toolbar is supported from API level 7 . In our application we should use   android.support.v7.widget.Toolbar     This is a simple application using  Toolbar.  Screenshots of the application are the following .  Toolbar contains Navigation icon, Title, SubTitle and 5 menu items, on clicking any menu item a Toast will show up with menu item name.                   You can download the full project from the following drive link https://drive....

Cannot Choose Between Multiple Debugging Devices in Android Studio

If  you connect multiple Devices or Emulators to Android Studio and Run Application. Application will only run on the first run device.  It will not ask to select connected device. ie, 1. If you connect one Device or Emulator 2. Run a project on the device or Emulator 3. Connect another Device or start another Emulator 4. Try to run project on new device 5. It will only run on first device  . will not ask to select Connected Device or Emulators 6. Select Deployment Target Dialog box will not show. If this Problem occurs to you while Developing on android Studio .  First thing to do is to Stop Application after running on the first device This can be done by clicking Stop app icon which is left of the AVD manger icon. Or by using Keyboard shortcut CTRL+F2 Now if you Run the project , Select Deployment Target Dialog box will pop up. You can select another Device or emulator from the list If still Select Deployment Target window not showing up an...