How to change spinner text size and text color?

Make a custom XML file for your spinner item. spinner_item.xml: Give your customized color and size to text in this file. <?xml version=”1.0″ encoding=”utf-8″?> <TextView xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:textSize=”20sp” android:gravity=”left” android:textColor=”#FF0000″ android:padding=”5dip” /> Now use this file to show your spinner items like: ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item,list); You don’t need to set the … Read more

How do you change text to bold in Android?

To do this in the layout.xml file: android:textStyle Examples: android:textStyle=”bold|italic” Programmatically the method is: setTypeface(Typeface tf) Sets the typeface and style in which the text should be displayed. Note that not all Typeface families actually have bold and italic variants, so you may need to use setTypeface(Typeface, int) to get the appearance that you actually … Read more

How to manually include external aar package using Gradle for Android

Please follow below steps to get it working ( I have tested it up to Android Studio 2.2) Lets say you have kept aar file in libs folder. ( assume file name is cards.aar ) then in app build.gradle specify following and click sync project with Gradle files. Open Project level build.gradle and add flatDir{dirs … Read more

ViewPager and fragments — what’s the right way to store fragment’s state?

When the FragmentPagerAdapter adds a fragment to the FragmentManager, it uses a special tag based on the particular position that the fragment will be placed. FragmentPagerAdapter.getItem(int position) is only called when a fragment for that position does not exist. After rotating, Android will notice that it already created/saved a fragment for this particular position and … Read more

Save bitmap to location

try (FileOutputStream out = new FileOutputStream(filename)) { bmp.compress(Bitmap.CompressFormat.PNG, 100, out); // bmp is your Bitmap instance // PNG is a lossless format, the compression factor (100) is ignored } catch (IOException e) { e.printStackTrace(); }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)