Latest Post

Brief history of Android app

Android application development has been a growth in the recent times. In the present scenario, the market for Android apps development is growing at a fast pace and the apps developed are getting a big round of applause from the people across the world. The chief beauty of Android-based apps is that they are easy to handle and manage.

Android, an open medium framework, widely and most commonly used to develop mobile apps is dominating the mobile app development market. There could be no denying to this fact that the platform of Android Apps Development is great when it comes to open up new and great possibilities for Android application developers, businesses, and marketers as well Of course, from creating eye-catchy and attractive games that are seductive, that sell like hot cakes, so as to making apps that users love to get their hands on and share with their loved ones, the alternatives of Android apps development service offered are almost infinite.

Reasons Why My Business Needs A Android App Development Platform

Android has a wide variety of libraries that can be utilized to extend the capabilities of an app. Android Software Development Kit can do wonders when it comes to enabling developers to create unique and creative applications that are sure to improve the utility of your equipment. To be very honest, Android OS gives customers the complete freedom to portray their imagination which results in a development of innovative applications.

Android app in Business


Almost every business person has a dream to expand their business frontier and take it to a whole new level. Now, applying android app development service, you can make your dream come true. Android have a broad range of features that brings tangible as well as intangible benefits to your business. If you are seeking for new and more simplified methods to supervise, track data as well as reports, a custom Android application can do great when it comes to making it happen for you The fact is that Android apps not only simplify your business operations but also assist you with effectively managing the varied aspects of your business. In general, they act as a powerful and lucrative means of advertising and promoting your business to lure new users, simultaneously assisting you to create brand awareness. In simple words. Android app development can leverage and benefit your business to the next level, expand your client/customer base and let you earn a considerable amount of money to help you make your business successful.

Uniqueness off the Android


For a unique presence, an app that is both robust and scalable is required, and there are a plethora of companies who specialize in offering comprehensive Android app development service. Such organizations maintain a team of highly-skilled and experienced developers who have a good experience of working for certain industry verticals and are well aware of the framework. Hiring the services of an experienced and highly skilled Android app developer who has good technical knowledge and possess the requisite skills makes sure that app developed is in the best interest of your business. To find more information about the topic, you can use the internet technology. Just browsing few websites you can approach the one that will help gather relevant stuff.


Author: Martin Brown
Martin Brown is a senior marketing executive at Top App Creators, a comprehensive listing service that acts as a platform for app development companies to showcase their services to prospective clients. You can also follow us on Facebook.

Firebase is a cloud service provider and backend as a server for mobile and web app. Firebase was founded in 2011 and launched with a real time cloud database in April 2012. Firebase has many features; most of them are free while some are paid. Firebase include mobile app analytics (Android, iOS, etc), cloud messaging, firebase auth, storage, hosting, remote config, test lab for android, crash reporting, send notification to the users, app indexing, dynamic links and send personalized email and SMS invitation, measuring the impact of invitation.

In this tutorial, you will learn to integrate or add Google firebase analytics to your android project. Firebase analytics collects usage and behavior data for your application or game. If you already integrate any of the firebase services in your android app or game then adding firebase analytic is very easy. If not, don’t worry. In this tutorial, I will show you step-by-step guide to integrate Google firebase and firebase analytic in your android application with simple example and you can download this sample project source code from GitHub at last.

Related:
Android Push Notification Tutorial Using Firebase
How to Integrate Google AdMob in Android
Google Maps Android API Getting Started Tutorial : Part 1

Integrating Google Firebase Analytics to your Android Project: Get Started with Firebase Analytics for Android


Before starting to add google firebase analytic to your android project, make sure your device is running Android 2.3 (Gingerbread) or newer, and Google Play services 9.2.1 or newer and Android Studio 1.5 or higher.

Integrating Google Firebase Analytics to your Android Project: Get Started with Firebase Analytics for Android

1. Create a new Android Project using Android Studio


Create a new android project with the package name: Add Firebase Analytics to Android Project and select minimum SDK: API 9 Android 2.3 (Gingerbread) or higher.

2. Install the Firebase ADK to your Android Project


To integrate the firebase libraries into your own android project, you need to perform certain tasks.

2.1. Open your project level (top level) build.gradle file and add classpath 'com.google.gms:google-services:3.0.0' as a dependencies. Your project level build.gradle file will look like below.

Project level build.gradle file

2.2. Now open your app level build.gradle file and add compile 'com.google.firebase:firebase-core:9.2.1' as app dependencies and apply plugin: 'com.google.gms.google-services' at the bottom. Your app level build.gradle file will look like below.

App level build.gradle file

3. Adding Internet Permission in your Application AndroidManifest.xml File


In your app’s AndroidManifest.xml file you need to add internet user permission. Open AndroidManifest.xml file and add android.permission.INTERNET which is look like below.

AndroidManifest.xml

4. Add Your App to Your Firebase Project in the Firebase Console


4.1. Go to Google Firebase Developer Console

Add Your App to Your Firebase Project in the Firebase Console

4.2. Create new project.
4.3. A dialog box will appear, add project name: Google Firebase Analytics and choose your country and click Create Project button.
4.4. After creating new project in Google firebase developer console, new screen will appear like below.

Add Your App to Your Firebase Project in the Firebase Console

4.5. Click add firebase to your android app. Here you need to provide your app package name.
4.6. Add project package name in the box and click Add App button. A file google-services.json is downloaded. Click Continue and Finish button.

5. Adding google-services.json File to Your Project


5.1. Go to android studio. Switch to the project view in Android Studio.
5.2. Add google-services.json file that you just downloaded to your android app directory like the screenshot below.

Adding google-services.json File to Your Project

6. Adding Firebase Analytics for Android to Your Android App


In android studio, again open app level build.gradle file and add compile 'com.google.android.gms:play-services-analytics:9.2.1' as app dependencies. Following is the final content of app level build.gradle file.

App level build.gradle file

7. Check Your App Report in Google Firebase Analytics


7.1. Go to Firebase Developers Console.
7.2. Choose your app
7.3. Click Analytics from left menu. For the first time, it will look like below.

Check Your App Report in Google Firebase Analytics

After some hours or day you can see your app’s complete reports like below.

Check Your App Report in Google Firebase Analytics

That’s all. You have done all things. Now you can see your application’s complete report in Google firebase analytic. It’s very easy and simple to integrate.


8. Java Activity File and XML Layout File


Following is the content of XML layout file.

res/activity_main.xml

Following is the complete content of java activity file.

src/MainActivity.java

Download Complete Project Source Code

You can download complete example project source code from GitHub.

Firebase is a powerful platform for building Android, IOS and web based applications. Firebase offers real time data storage and synchronization, user authentication, analytics, hosting, database, remote configuration, notification, cloud messaging and lots more. Before the Google I/O 2016, we used Google Cloud Messaging service (GCM) to send data: notification, messages from the server to the clients or android app users. Google introduced the firebase cloud messaging in Google I/O 2016 and it makes developers very easy and fast to implement in their applications or games.

In this tutorial, you will learn to connect your android app to firebase to store data and push/send notification to the android app/game users using Google Firebase. Firebase is totally new and not the part of Google Cloud Platform.

Firebase offers both free plan and paid/pro plan. You can use analytic, app indexing, dynamic links, invites, authentication, notification, remote configuration, crash reporting, real-time database: 100 simultaneous connections, 1GB stored, 10 GB transferred and file storage: 5 GB storage, 30 GB transferred, 50,000 each uploads and downloads and lots more in free plan.

Related:
Show and Clear Android Notification Example
Adding Badge (Notification Count) to Android ActionBar Icon
Adding a Share Action to Android Application

Android Example: Android Push Notification Tutorial Using Firebase


Make sure you have installed Android Studio 1.4 and higher before creating new android project using android studio. Following are the simple steps to connect your android app/game to firebase to send/push notification to your app users.

Android Example: Android Push Notification Tutorial Using Firebase

1. Create a new Android Project using Android Studio


Create a new android project with the application name: Push Notification Example Using Firebase, company domain: viralandroid.com. Select the minimum SDK: API 14 Android 4.0(IceCreamSandwish) and empty activity.

2. Connect your Android App to Firebase


To connect your android app to firebase follow the following steps:

2.1. Go to Google Firebase Developer Console.

Push/Send Notification Tutorial Using Firebase in Android

2.2. Create a new project by clicking Create New Project button.
2.3. Add your application name in project name and select your country and click Create Project button. I have written Push Notification Firebase as project name.

Create New Project in Firebase to Send Notification/Message to the Users

2.4. After creating new project in firebase, you will see in the screen something like below.

Choose Platform in Firebase to Send Notification/Message to the Users

2.5. Click on the add firebase to your android app. Here you need to provide your application package name. After adding package name in the box click Add App button.
2.5. A file google-services.json is downloaded. Click continue and then finish button.

3. Adding google-services.json file to Your Android Application


3.1. Go to android studio. Switch to the project view in Android Studio, you will see project root directory.
3.2 Add google-services.json file that you just downloaded to your android app directory like the screenshot below.
Adding google-services.json file to Your Android Application Android Studio


4. Adding Google Services Plugin to Your Android Application


4.1. Open your project level build.gradle file and add classpath 'com.google.gms:google-services:3.0.0' as dependencies. Project level build.gradle file will look like below.

Project level build.gradle file

4.2. Now open your app level build.gradle file and add apply plugin: 'com.google.gms.google-services' and compile 'com.google.firebase:firebase-messaging:9.0.2' as dependencies. And then press Sync now. Following is the content of app level build.gradle file.

App level build.gradle file


5. Adding Internet Permission in your App AndroidManifest.xml File


Open your AndroidManifest.xml file and add android.permission.INTERNET as user permission. AndroidManifest.xml file will look like below.

AndroidManifest.xml

6. Sending a Notification/Message to your App Users from the Notifications Console


6.1. Go to Firebase Console.
6.2. Choose your project that we recently created.
6.3. Click Notification from left menu.

Sending a Notification/Message to your App Users from the Notifications Console

6.4. Click send your first message button, if you have not sent before.
6.5. Type your message in enter message area, enter message label, choose your app and click Send Message button. Review your message and click Send button.

Sending a Notification/Message to your App Users from the Firebase  Notifications Console

Run your Android Push Notification Tutorial Using Firebase application before sending above notification. Don’t open your application while sending notification. After rending notification to your android application users. Notification looks like below screenshot.

Android Push Notification Tutorial Using Firebase

AdMob is one of the most popular, high paying and world’s largest mobile advertising networks. AdMob is multi platform mobile advertising network that allows you to monetize from your android, iPhone, iOS, windows and others mobile application and game. If you’ve published a free app to the app store and want to earn money, AdMob is one of the great ways to earn extra money from your free games and apps. In this tutorial, you will learn to integrate Google AdMob step by step to your android application or game and display banner and full screen (Interstitial) ads.

Integrating Google AdMob to your app or game is very easy; you don’t need to know any more advanced thing. Currently AdMob supports four types of ads; banner, interstitial (full screen), rewarded interstitial and native ads.

Related:
YouTube Android API Integration: Getting Started with YouTube Android API
Google Maps Android API Getting Started Tutorial : Part 1
Load Images Using Picasso Library in Android

Android Integration Example: How to Integrate Google AdMob to Android to Earn Money from Free Apps and Games


Open existing project or create new project to integrate AdMob and earn money by displaying ads on your application.

Android Integration Example: How to Integrate Google AdMob to Android to Earn Money from Free Apps and Games

1. Sign in to AdMob Account and Create Ad Units


1.1. If you already have AdMob account then sign in to it and if you don’t have then create a new account.
1.2. Click on Monetize tab and select or create new app.
1.3. If you’ve already published your app to the play store, you can search app or developer from search for your app tab.
1.4. If you want to add your app manually (not published yet) click on add your app manually tab and give your app name and choose platform. Or you can select from apps you have already added.

Sign in to AdMob Account and Create Ad Units

1.5. Select Banner ad format and give name to ad unit and then click save button. There is other setting like ad type, automatic refresh, text ad style.

Sign in to AdMob Account and Create Ad Units

1.6. Likewise, again create a new Interstitial (full screen) ad unit.
1.7. After creating ad units, you can see the Ad Unit ID on the dashboard which looks like: ca-app-pub-5717827144758520/8297887893


AdMob Account Ad Units ID

You can create other many ad units if required for your app.

2. Adding Google Play Services Dependency, Ad units ID


2.1. Open your app build.gradle file and add compile ‘com.google.android.gms:play-services-ads:8.4.0’ dependency. Build.gradle file will look like below.

build.gradle

2.2. Now open your strings.xml from res/values/ and add your ads unit ID to your app strings.xml file.

strings.xml

3. Modifying AndroidManifest.xml File


Open AndroidManifest.xml file and add the android.permission.INTERNET and android.permission.ACCESS_NETWORK_STATE user permission, google play services version meta-data and AdActivity with android:theme and android:configChanges attributes. Following is the complete content of AndroidManifest.xml file.

AndroidManifest.xml

4. Adding AdMob Footer Banner Ad in Android Application


Banner ad can be added on any place on the screen. In this example project I am adding banner ad at the bottom/footer of screen.

4.1. Open your XML layout file and add com.google.android.gms.ads.AdView inside RelativeLayout with attributes like android:id, android:layout_width, android:layout_height, android:layout_centerHorizontal, android:layout_alignParentBottom, ads:adSize, ads:adUnitId. Following is the complete code of XML layout file.

res/layout/activity_main.xml

4.2. Open your java activity file and add following code. Don’t forget to change test device id with your device id. Follow the step 6 to get your device id to enable testing ads on your device only.

src/MainActivity.java


5. How to Enable Test Ads of AdMob in Android Application


AdMob policies do not allow you to click on your own live ads. If you click your own ads google may suspend your account. To protect your account from being suspended, you can use test ads while developing. For that, you need to provide your testing device id, I have added my device id like above .addTestDevice("4DD0986B8BB49093161F4F00CF61B887 ") and if you are testing app on emulator add .addTestDevice(AdRequest.DEVICE_ID_EMULATOR). To get your device ID to enable AdMob test ad follow step 6.

6. How to Get My Android Device (Real Phone) ID for AdMob Test Ads


6.1. To get your real device id for AdMob test ad, first replace Device ID with some text like .addTestDevice("Device ID") in MainActivity.java file and run your application.
6.2. After running your application on real device, open logcat and search for addTestDevice. You will see like AdRequest.Builder.addTestDevice("4DD0986B8BB49093161F4F00CF61B887") in your logcat, 4DD0986B8BB49093161F4F00CF61B887 is your device ID.
6.3. Add device ID in addTestDevice of your java activity file like step 4.

How to Get My Android Device (Real Phone) ID for AdMob Test Ad

Now run your application, you will see Google AdMob test ad at the bottom of screen like below screenshot.

Android Integration Example: How to Integrate Google AdMob to Android to Earn Money from Free Apps and Games

7. How to Add Full screen Ad (Interstitial Ad) of AdMob in Android Application and Game


7.1. Create a new java activity file call it ActivityTwo.java and add fullscreen ad (Interstitial Ad) code in your activity file. ActivityTwo.java file will look like below.

src/ActivityTwo.java

7.2. Create a new XML file activity_two.xml and add following code.

res/layout/activity_two.xml

Android Integration Example: How to Integrate Google AdMob to Android to Earn Money from Free Apps and Games

Now run your Google AdMob Android Integrate application, you will see google banner ad on bottom/footer of home screen and if you click the Open Interstitial (Fullscreen) Ad, you will be able to see full screen ad on your application.


Download Complete Project


You can download complete example project of How to Integrate Google AdMob in Android from GitHub.

There are many popular android chatting and messaging application available in Google Play Store. Chat/messaging app like Facebook Messenger, Viber, Twitter, WhatsApp, Google Hangouts, Kik, Skype, SnapChat, IM+, EvolveSMS, BlackBerry Messenger and Line are some of the most popular android and iPhone/IOS application. These applications have different UI/UX (User Interface/User Experience) design with similar and different features. If you want to develop such types of android application, you need to focus user interface and user experience not only programming part. So in this tutorial, you will learn to make simple android chat/messaging application UI design with XML.

Android app UI is created with XML and here we will make chat application UI with android TextView, ImageView, EditText and so on.

Related:
Android Music App XML UI Design
Android FlexboxLayout Tutorial with Example
Bar Chart XML UI Design For Android


Android Example: How to Build an Android Chat/Messaging App UI Design with XML

Let’s start by creating new android application with project name Android Chat Messaging App UI Design and with blank activity.

1. Creating XML Drawable File

Create two XML drawable file rounded_corner.xml and rounded_corner1.xml to create chat application ui design. In these two file we will create rounded corner rectangle with different background color for two users. Add solid color, stock color and width, corners radius, padding inside shape of drawable XML file. Following is the complete XML code of rounded_corner.xml and rounded_corner1.xml file.

res/drawable/rounded_corner.xml

res/drawable/rounded_corner1.xml

2. XML Layout File

Create type_message_area.xml file inside res/layout directory and add EditText and ImageView inside LinearLayout. Don’t forgot to add ndroid:layout_weight attribute to EditText and ImageVIew and android:gravity bottom to LInearLayout. type_message_area.xml file will look like below.

res/layout/type_message_area.xml

Now open your XML layout file and add ScrollView, RelativeLayout, Linearayout and include type_message_area at the bottom of root layout LinearLayout like below. I have also added other more views like ImageView and TextView with different attributes. Don’t forget to add android:layout_weight attribute in ScrollView and include of type_message_area. There are many other important attributes in TextView, ImageView and layouts which will look like below.

res/layout/activity_main.xml

Following are the necessary images, just download and add in drawable folder.

Images:
user_pacific.png
user_pratikshya.png
arrow_bg1.png
arrow_bg2.png

3. Java Activity File

Following is the default code of java activity file.

src/MainActivity.java

And colors.xml file will look like below.

res/values/colors.xml

Screenshots of Output:

Chat/Messaging App XML UI Design for Android

Chat/Messaging App XML UI Design for Android

Chat/Messaging App XML UI Design for Android

You have done all things. Now, run your Chat/Messaging App XML UI Design for Android application, which will look like above screenshots. You can add other things according to your needs this is only sample project to create chat or messaging app xml ui.

4. Download Complete Source Code

You can download complete example project source code of Chat/Messaging App XML UI Design from GitHub.

Android SDK does not have a good way to get images from web and display it to android app. Almost every popular android application display images from website, web server or anywhere from the internet. To solve this problem, numbers of third party libraries are available. In this tutorial, you will learn to load images from internet using Picasso image loader library; this is one of the best and powerful image downloading and caching android library. Using this library, we can easily fill an ImageView with an image from the internet.

Picasso library have lots of features like load images from web, resizing images, cropping images, place holder and displaying error images. Picasso from Square is open source and one of the popular& easiest libraries used to download and cache images from web in android. You can also load images without using any libraries in android application, check out my tutorial: Load Image from URL (Internet) in Android.

Related:
Check Internet Connection in Android
Turn ON and OFF WiFi Connection Programmatically in Android
How to Get Current GPS Location Programmatically in Android

Android Example: View Images from Web using Picasso Image Loader Library


Create a new android project with the project name Picasso Image Loader Library. You can setup Picasso image downloader and caching library with gradle dependency or mavne. Open your app build.gradle file and add compile 'com.squareup.picasso:picasso:2.5.2' as application dependencies which will look like below.

build.gradle

XML Layout File

Open XML layout file and add ImageView with different id. Here I have added many ImageView and TextView to make look like news reader app with in LinearLayout and ScrollView. Just copy and paste following XML code in your layout file.

res/layout/activity_main.xml

Java Activity File

In java file, defile variables for different ImageView, add images URL like strings. Link to your layout image view with findViewById and load the images in ImageView from web using Picasso library like Picasso.with(this).load(imageURL4).resize(250, 200).into(image1);. Following is the complete code of java activity file.

src/MainActivity.java

Before running your application don’t forgot to add user permission android.permission.INTERNET in AndroidManifest.xml file. Android manifest file will look like below.

AndroidManifest.xml

Picasso image downloading android library offers much more than just downloading image. You can resize images, display error image when image is unable to download, rotate, place holder, transform before image is displayed in ImageView.

Picasso.with(this)
      .load("Image URL")
      .error(R.drawable.error_image) // optional
      .placeholder(R.drawable.placeholder_image) // optional
      .resize(200, 200) // optional
      .rotate(60) // optional
      .into(imageview1);

Output:

Android Example: Create a Music Player Android Application XML UI Design

You have done all things. Now, run your Load Images Using Picasso Library in Android application, you will see images in ImageView which are loaded from internet. Make sure your phone or emulator have WiFi or mobile network turned on.

In android, you can control playback of video, audio and streams in many ways. Previously I have already posted some tutorials about android XML UI design like bar chart XML UI design, simple calculator app XML UI design, material design profile screen, sign up/registration, login and contact form, etc. In this tutorial, you will learn to create android music application XML UI design.

In this music player app XML UI design, you can add further features like playing music with sound, display related music or latest added music, sharing option, etc based on this UI according to your needs. Music progress is shown in circular progress bar and inside circular progressbar there is music progress shown by seconds, favorite button and so on. To play and stop music, you can use android floating action button, here I have used just an ImageView.

Related:
Tabs - Beautiful Mobile Tabs UI Design with Amazing User Experience
Adding Circular Progress Ring to Android FAB (Floating Action Button)
How to Use Custom Fonts in Android Application

Android Example: Create a Music Player Android Application XML UI Design


Let’s start to create a music player android app XML UI design with the project name Music Player XML Design.

Open your app colors.xml file (res/values/colors.xml) and add following color values.

res/values/colors.xml

Again open your app build.gradle file and add compile 'com.github.iammert:InteractivePlayerView:f4f6490290' as dependencies and url https://jitpack.io in maven inside repositories which will look like below.

build.gradle

Drawable XML File and Images

Create a new XML file (circle.xml) inside drawable directory and add following XML code. Following code will make a circle/oval shape with red color as background colour. This circle shape is needed us later in XML layout file.

res/drawable/circle.xml

You need to add some icons and images inside drawable folder with following name. You can find these icons and images here.

Images and Icons Name:
ic_action_pause.png
ic_action_play.png
like_selected.png
like_unselected.png
model_female.jpeg
one_direction.jpg
one_direction_blur.jpg
replay_selected.png
replay_unselected.png
shuffle_selected.png
shuffle_unselected.png

XML Layout File

In XML layout file you need to add many Layouts (LinearLayout, RelativeLayout, ScrollView), ImageView, TextView, co.mobiwise.library.InteractivePlayerView, View, etc with different attributes. Following is the complete content of XML layout file.

res/layout/activity_main.xml

Java Activity File

Open your java activity file and extend AppCompactActivity and then implement OnActionClickedListener. You can set start progress from and maximum progress in second like mInteractivePlayerView.setMax, and mInteractivePlayerView.setProgress. Following is the complete code of java activity file.

src/MainActivity.java

Output:
Android Example: Create a Music Player Android Application XML UI Design

Now, run your Android Music App XML UI Design application which will look like above screenshot. If you click on the play button you will see the music progress in the progress bar.

Download Complete Project

You can download complete example project of android music application XML UI design from GitHub.

FlexboxLayout is a new android library which was introduced by Google in many 2016. This new library project was pushed to the official Google GitHub repository. FlexboxLayout is an android layout manager which brings the similar capabilities to the CSS Flexible Box Layout Module. In this tutorial, you will learn to implement this FlexboxLayout library in your android project and we will create some example using flexbox layout.

FlexboxLayout extends the ViewGroup like android relative layout and linear layout. You can add different attributes to the flexbox layout like flexDirection, flexWrap, justifyContent, alignItems and alignContent. There are other many attributes that you can add to your child view of a FlexboxLayout.

Related:
How to Add a Library Project to Android Studio
Android Layouts Tutorial
Android Material Design Sliding Tabs Example

Android Example: How to Use FlexboxLayout Android Library


Create a new android project with the project name Android FlexboxLayout, open build.gradle file and add compile 'com.google.android:flexbox:0.1.3' dependency. Your build.gradle file will look like below.

build.gradle

FlexboxLayout is similar to the LinearLayout because it positions it’s children sequentially. Each child is placed one after another.

Let’s talk about different flexbox layout attributes.

flexDirection

This attribute determines the direction of main axis. It has different variables, they are: row, row_reverse, column and column_reverse.
flexWrap.

This attribute helps to control the behavior whether the flex container is in single line or multi line as well as direction of cross axis. It has three different variables, they are: wrap, wrap_reverse and nowrap.

justifyContent

This is another important attribute which control the alignment along with the main axis. There are five possible variables, they are: space_between, space_around, flex_start, flex_end and center.

alignItems

This attribute controls the size and position of the items along with the cross axis. There are also five possible variables of anignItems attribute, they are: stretch, center, baseline, flex_start and flex_end.

alignContent

alignContent attribute controls the alignment of flex line in the flex container. There are six possible variables, they are: stretch, center, space_between, space_around, flex_start and flex_end.

There are some other attributes which you can add to the child view of flexbox layout. Attributes for child view of FlexboxLayout are: layout_order, layout_flexGrow, layout_flexShrink, layout_alignSelf and layout_flexBasisPercent.


Android Flexbox Layout Example


Create a new XML layout file flexbox_layout1.xml and add com.google.android.flexbox.FlexboxLayout layout with the attributes app:alignContent, app:alignItems, app:flexDirection and app:flexWrap. Inside FlexboxLayout add some TextView with app:layout_alignSelf attribute. Following is the complete content of flexbox_layout1.xml file.

res/layout/flexbox_layout1.xml

Output of above code


Android Flexbox Layout Example

Similarly create two XML layout file flexbox_layout2.xml and flexbox_layout3.xml and add the following XML code.

res/layout/flexbox_layout2.xml

Output of above code

 Android Flexbox Layout Example

res/layout/flexbox_layout3.xml

Output of above code

 Android Flexbox Layout Example

Now create three java file FlexboxLayoutExampleOne.java, FlexboxLayoutExampleTwo.java and FlexboxLayoutExampleThree.java. Following is the default code of these java activity file.

src/FlexboxLayoutExampleOne.java

src/FlexboxLayoutExampleTwo.java

src/FlexboxLayoutExampleThree.java

Open your main XML layout file and add three buttons with onClick attributes. Your main XML layout file will look like below.

res/layout/activity_main.xml

Similarly, open your main java activity file and add the following code.

src/MainActivity.java

Now open your app AndroidManifest.xml file and add the three activities name inside application tag .FlexboxLayoutExampleOne, .FlexboxLayoutExampleTwo and .FlexboxLayoutExampleThree. Android manifest file will look like below.

AndroidManifest.xml

Run your Android Flexbox Layout Example application and click the different buttons which will look like above screenshots. You can download the complete example source code from GitHub.

Android RecyclerView is used to create advance lists and cards or grids with material design concept in your android application. Android RecyclerView and CardView widgets can be used together. The RecyclerView is a advanced and flexible version of list view. By using RecyclerView and CardView widgets you can make more material design style app. If you want to add ListView or GridView inside NestedScrollView design support library, you may face many problems. So if you want to add lists, cards, grids with material header view, coordinator layout, I recommend you to use RecyclerView. You can customize your cards, lists in your own ways.

In this tutorial, you will learn to display grids item in your android application with image and text using android RecyclerView. For that you need to create java file like DataAdapter, AndroidVersion and ItemClickListener.

Related:
Android Material Design GridView Tutorial
Android Fragments Tutorial with Example
Start New Activity from Android ListView onItemClick

Android Example: Custom Grid RecyclerView with Images and Text


Let’s start by creating new android project called Android RecyclerView Example. After creating new project open build.gradle file and add compile com.android.support:recyclerview-v7:23.2.0 and compile com.android.support:design:23.0.0 dependencies. Bulid.gradle file will look like below.

build.gradle

Android Example: Custom Grid RecyclerView with Images and Text

XML Layout File

Open your main XML layout file and add android.support.v7.widget.RecyclerView inside android.support.design.widget.CoordinatorLayout with id. This will look like below.

res/layout/activity_main.xml

Now you need to create a new XML layout file for grids or lists item. Create row_layout.xml file in res/layout and add ImageView and TextView inside LinearLayout or RelativeLayout with different id. Following is the complete content of row_layout.xml file.

res/layout/row_layout.xml

Java Activity File

Open main java activity file and add following code. Here I have added text for grid title, images for grid items. Create ArrayList and add onItemTouchListener and onItemClickListener in recycler view. Following is the complete code of java activity file.

src/MainActivity.java

Again create a new java file called AndroidDataAdapter and extend into RecyclerView.Adapter<AndroidDataAdapter.ViewHolder>. Defile private variable from ArrayList and Context. In ViewHolder class you need to connect to grid row layout image and text like below. Following is the complete code of AndroidDataAdapter.java file.

src/AndroidDataAdapter.java


Again, create a new java file AndroidVersion.java and add following code.

src/ AndroidVersion.java


Handle RecyclerView Item Click Event

Finally, create a new java file called RecyclerItemClickListener.java to handle recycler item click listener and implements it to RecyclerView.OnItemTouchListener. Defile private variable to RecyclerView.OnItemTouchListener and add the following code. We have already added toast message when android recyclerView item click in mRecyclerView.addOnItemTouchListener of MainActivity.java file. Following is the complete java code of RecyclerItemClickListener.java file.

src/RecyclerItemClickListener.java

Run your Android RecyclerView Example application which will look like above screenshot. If you click grid items, a toast message will appear with grid position

In this tutorial, you will learn to implement an effective and user friendly share action to android app. You can add android share action anywhere in your app. Here I have added share action in actionbar/toolbar and on button’s click event. If user clicks the share button from actionbar/toolbar, many options will be available there to share like email, gmail, facebook, twitter and so on. If you want to add subtitle to your app toolbar/appbar follow Setting Android ActionBar Subtitle and Color tutorial and if you want to make custom material design appbar follow Android Material Design ActionBar/App Bar tutorial.

Here we will share/send message to friends via our android application with message title, description. For subject you need to use EXTRA_SUBJECT and EXTRA_TEXT for text message.

Related:
Sending Email from Android Application
How to Add Spinner (Dropdown List) to Android ActionBar/Toolbar
Implementing SearchView in Android ActionBar

Android Example: How to Add Easy Share Action in Android ActionBar and Button


Create a new android project called android easy share action. Open your app main XML layout file and add a button or textview with onClick attribute. I have added a TextView with onClick attribute. Following is the complete content of XML layout file.

res/layout/activity_main.xml

To add share action in android appbar/toolbar you need to create a XML file in res/menu directory and add an items with attributes like android:id, android:actionProviderClass, android:icon, android:title, app:showAsAction. Action_menu.xml file will look like below.

res/menu/action_menu.xml

Now open your java activity file and add override onCreateOptionsMenu and onOptionsItemSelected methods to implement share action to android actionbar. In onOptionsItemSelected method you need to add some code to open share option and share something to the friends. If you want to share something when user click the button you need to add little bit code in android button onClick like the below. Following is the complete code of java activity file.

src/MainActivity.java

In this tutorial, you will learn to implement an effective and user friendly share action to android app.

That’s all. Run your Adding a Share Action to Android Application and click on the share icon from action bar or click the share button. There, you will see many option to share, choose one of them and then share to your friends.

Android GridView is a view group which allows us to display items in a two dimensional grid. I have posted some android gridview tutorial post like Simple Android GridView Example, GridView with Image and Text and so on. This time you will learn to make material design android application using GridView with header view and material ripple effect.

In this tutorial example project I have used android design support library and a material ripple library. To make a android app with grid view you need to create a java file for adapter class and a XML custom gridview layout file.

Related:
Simple Android GridView Tutorial with Example
Parallax Header with Android ListView Example
Android ListView with Image and Text

Android Example: How to Make Material Application with GridView


Create a new android project to make material design android application and add android design support library and material ripple effect in your project build.gradle file as dependencies. Build.gradle file will look like below.

build.gradle

Now open your app styles.xml file and add two items windowActionBar to false and windowNoTitle to true. Following is the complete content of styles.xml file.

res/values/styles.xml

And update your colors.xml file which is look like below.

res/values/colors.xml

Again open dimense.xml file from res/values and add two dimen for app bar height and expanded toolbar title margin. Following is the complete content of dimense.xml file.

res/values/dimense.xml

XML Layout File

Open your main XML layout file and add CoordinatorLayout, AppBarLayout, CollapsingToolbarLayout, ImageView, Toolbar, NestedScrollView, LinearLayout and GridView which will look like below.

res/layout/activity_main.xml

Create a new XML layout file called gridview_custom_layout.xml to make custom grid view image and text design and add a LinearLayout as root layout. Inside LinearLayout add RippleView with proper attribute like the below and inside RippleView add ImageView and TextView in LinearLayout which will look like below.

res/layout/gridview_custom_layout.xml

Java Activity File

Open your java activity file and add define variable for Toolbar, CollapsingToolbarLayout, CoordinatorLayout, GridView, Context and ArrayList. Add strings and images for gridview items. Following is the complete code of java activity file.

src/MainActivity.java

Create a new java file with the name CustomAndroidGridViewAdapter.java and extend it to BaseAdapter. Following is the complete code of custom gridview adapter file.

src/CustomAndroidGridViewAdapter.java

Android Example: How to Make Material Application with GridView

Now, run your Android Material Design GridView application and scroll the page, you will see that the toolbar collapsing and expanding with animation. If you click on the GridView items, you will see material ripple effect. Above is the screenshot of this sample material design gridview android application.

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget