Auto Detect Mobile SMS through Broadcast Receiver

BroadcastReceiver smsBroadCastReceiver = new BroadcastReceiver() { final SmsManager sms = SmsManager.getDefault(); public void onReceive(Context context, Intent intent) { // Retrieves a map of extended data from the intent. final Bundle bundle = intent.getExtras(); try { if (bundle != null) { final Object[] pdusObj = (Object[]) bundle.get(“pdus”); for (int i = 0; i < pdusObj.length; i++) […]

What is SharedPreferences ?

Android provides many ways of storing data of an application. One of this way is called Shared Preferences. Shared Preferences allow you to save and retrieve data in the form of key,value pair. In order to use shared preferences , you have to call a method getSharedPreferences() that returns a SharedPreference instance pointing to the […]

GPS Tracker sample code

import android.app.AlertDialog; import android.app.Service; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; import android.provider.Settings; import android.util.Log; public class GPSTracking extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // […]

Future Scope of android

Android is an open source mobile application operating system, in today’s era every person have smart phone and people haven’t enough time for performing lot’s of things at same time. That’s the reason most of the things are running in mobile compatibility mode and mobile application are mostly used in present and upcoming future also. […]

Android back button event with example

Android device back button is to navigate from current activity to previous activity. In that case we are using below code for handing event on back button. Declare variable in class : 1. boolean doubleBackToExitPressedOnce = false; 2. put code after onCreate method on an activity. @Override public void onBackPressed() { if (doubleBackToExitPressedOnce) { super.onBackPressed(); […]

How to apply rating bar in android

Step 1 : Put below code in your layout file : <RatingBar android:id=”@+id/ratingBar” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center” android:numStars=”5″ android:progressTint=”@android:color/holo_orange_light” android:layout_marginTop=”10dp” android:stepSize=”1.0″ android:rating=”0″ /> here define the components which we are used : ratingBar – id of RatinBar Component. numStars – how many starts which you show for rating progressTint – Color of starts when we select […]