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 […]