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

Android Spinner Dropdown Example

person shubham sharmaaccess_time January 11, 2017launch Read More

Android Studio Gradle project sync failed

    Just a blind guess: try to add something like this to your gradle.properties file in the project:

 

person shubham sharmaaccess_time January 2, 2017launch Read More

getChildFragmentManager

getChildFragmentManager() on programmatically (dynamically) added Fragments? accepted In conclusion, I want to reference OuterFrag in MainActivity always. And I want OuterFrag act as a placeholder to load different InnerFrags. In short, I want to call getChildFragmentManager() in OuterFrag, when it is added programmatically (dynamically). If you want this then make your OuterFrag have a container […]

person shubham sharmaaccess_time December 31, 2016launch Read More

How to make android app’s background image repeat

Ok, here’s what I’ve got in my app. It includes a hack to prevent ListViews from going black while scrolling. drawable/app_background.xml:

  values/styles.xml:

  AndroidManifest.xml:

 

person shubham sharmaaccess_time December 29, 2016launch Read More

how to use runOnUiThread

 

person shubham sharmaaccess_time December 22, 2016launch Read More

Transprent Colors

100% — FF 99% — FC 98% — FA 97% — F7 96% — F5 95% — F2 94% — F0 93% — ED 92% — EB 91% — E8 90% — E6 89% — E3 88% — E0 87% — DE 86% — DB 85% — D9 84% — D6 83% — D4 […]

person shubham sharmaaccess_time December 21, 2016launch Read More