Detect whether there is an Internet connection available on Android

The getActiveNetworkInfo() method of ConnectivityManager returns a NetworkInfo instance representing the first connected network interface it can find or null if none of the interfaces are connected. Checking if this method returns null should be enough to tell if an internet connection is available or not.

  You will also need:

  in […]

person shubham sharmaaccess_time March 11, 2017launch Read More

Android BroadcastReceiver

In this tutorial we’ll discuss and implement a very important component of the Android Framework named BroadcastReceiver. Android BroadcastReceiver Overview A BroadcastReceiver is a dormant component of Android that listens to system-wide broadcast events or intents. When any of these events occur it brings the application into action by either creating a status bar notification […]

person shubham sharmaaccess_time March 11, 2017launch Read More

Swipe screen left , right , top , bottom

File : AndroidMainifest.xml

File : src/SwipeScreenExample.java   Create touch event with the use of SimpleGestureFilter class object

File : src/SimpleGestureFilter.java

 

person shubham sharmaaccess_time March 7, 2017launch Read More

Create Media UI

media_controller.xml

activity_video_player.xml

VideoControllerView.java

VideoPlayerActivity.java

Download Media Controls set permission

person shubham sharmaaccess_time March 6, 2017launch Read More

How to achieve right to left animation to start the activity

Do these modifications to your animation files: enter.xml:

  exit.xml:

  You’ll have your second activity sliding in from right to the left. For a better understadnig on how to play around with the fromXDelta and toXDelta values for the animations, here is a very basic illustration on the values: This way you […]

person shubham sharmaaccess_time March 6, 2017launch Read More

Push Notification Firebase

Add google-services.json file   Add file into maifest.xml

  Create Files Config.php

    In activity

 

  To receive Brodcast  

 

person shubham sharmaaccess_time February 17, 2017launch Read More

Android Spinner set Selected Item by Value

The spinner provides a way to set the selected valued based on the position using the setSelection(int position) method. Now to get the position based on a value you have to loop thru the spinner and get the position. Here is an example

If you are using an ArrayList for your Spinner Adapter then […]

person shubham sharmaaccess_time February 15, 2017launch Read More

Android Internal and External storage example – Store and Retrieve Data

Android Internal Storage  Internal storage are private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed. Android External Storage  External storage such as SD card can also store application data, there’s no security enforced upon files you save to the external […]

person shubham sharmaaccess_time February 1, 2017launch Read More

Android marshmallow request permission?

Open a Dialog using the code below:

  Get the Activity result as below:

  More info: https://developer.android.com/training/permissions/requesting.html

person shubham sharmaaccess_time January 31, 2017launch Read More