Skip to main content

Posts

Android percent support library sample (Android)

In this post I'm gonna show you guys a demo of percent layout of android from support library. Since many a time in our awesome RelativeLayout we insert LinearLayout just to get the property of layout_weight for accessing. Now android has a new support library to remove this dependencies. Refer Before beginning some pre-requestic (at the time for development): Android SDK v22 Android Build Tools v22.0.1 Android Percent Support Repository v23.0.0 Android Support appcompat-v7:22.2.1 So let's get started: Step 1: Add below line into apps build.gradle. compile 'com.android.support:percent:23.0.0' Step 2:  Add any one of below as the parent of the layout.Its similar to our RelativeLayout or FrameLayout. < android . support . percent . PercentRelativeLayout >   or < android . support . percent . PercentFrameLayout > Step 3: Now we gonna use layout_heightPercent and layout_widthPercent   property's to specify our height and width i

Change Android Studio editor's background color - Android Studio

You can change it by going  File     Settings  (Shortcut  CTRL +  ALT +  S ) , from Left panel Choose  Appearance   Now from Right Panel choose  theme . Android Studio 2.1 Preference -> Search for Appearance -> UI options , Click on DropDown  Theme Android 2.2 Android studio -> File -> Settings -> Appearance & Behavior -> Look for UI Options Import External Themes You can download custom theme from  this  website. Choose your theme, download it. To set theme Go to  Android studio -> File -> Import Settings ->  Choose the .jar  file downloaded. _____________________________________________________________________________ Happy Coding...

HAPTIC FEEDBACK - ANDROID TUTORIAL

Haptic Feedback ? Haptic feedback, often referred to as simply "haptics", is the use of the sense of touch in a user interface design to provide information to an end user. The resistive force that some "force feedback" joysticks and video game steering wheels provide is another form of haptic feedback. Haptic Feedback in Android??? Haptic feedback (commonly referred to as haptics) is the use of touchfeedback to the end user. You know how your Android phone vibrates a tiny bit when you tap one of the navigation buttons? That's haptics at work. How it works ? By default haptic feedback setter works only for long press.  Here we are implementing this haptic feedback in simple onClick You need to add the "android.permission.VIBRATE" permission to the program's manifest.  You can do so by adding the following to the "AndroidManifest.xml" file, <uses-permission android:name = "android.permission.VIBRATE"

Create RadioButton RadioGroup Dynamically - Android Tutorial

In this article, we took a look at how to create Radio Buttons Dynamically. Here I have created this example to create the number of time slots (slot select by Radio Button) in between two selected time. The final output looks like, Here I have selected the Start time as 10:00 AM and End time as 12:00 PM and the Time interval between two slots as 15 mins. Therefore the calculation will result as 8 slots. MainActivity Class Example shows the Radio group in Grid view -  Adding the values to an ArrayList, String slotscounts += " "+slotStartTime+ "-"+slotEndTime +","; ArrayList<String> slots = new ArrayList<>(); slots.add(slotscounts); Passing the value to an Adapter class(Base Adapter used) /*Call adapter to set_radiobuttons_for_timeSlots*/ GridSlotAdapter gridslotadapter = new GridSlotAdapter(MainActivity.this, slots); /*set an adapter in Gridview*/ slotGrid.setAdapter(gridslotadapter); Adapter Class Adapter layout