How to make the corners of a button round?

If you want something like this here is the code. 1.Create a xml file in your drawable folder like mybutton.xml and paste the following markup: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android” > <item android:state_pressed=”true” > <shape android:shape=”rectangle” > <corners android:radius=”3dip” /> <stroke android:width=”1dip” android:color=”#5e7974″ /> <gradient android:angle=”-90″ android:startColor=”#345953″ android:endColor=”#689a92″ /> </shape> </item> <item android:state_focused=”true”> <shape android:shape=”rectangle” … Read more

How to add manifest permission to an application?

Assuming you do not have permissions set from your LogCat error description, here is my contents for my AndroidManifest.xml file that has access to the internet: <manifest xlmns:android…> … <uses-permission android:name=”android.permission.INTERNET” /> <application … </manifest> Other than that, you should be fine to download a file from the internet.

How to change the status bar color in Android?

Android 5.0 Lollipop introduced Material Design theme which automatically colors the status bar based on the colorPrimaryDark value of the theme. Note by realdognose: with Material Design library it will be colorPrimaryVariant This is supported on device pre-lollipop thanks to the library support-v7-appcompat starting from version 21. Blogpost about support appcompat v21 from Chris Banes … Read more

How to handle screen orientation change when progress dialog and background thread active?

Edit: Google engineers do not recommend this approach, as described by Dianne Hackborn (a.k.a. hackbod) in this StackOverflow post. Check out this blog post for more information. You have to add this to the activity declaration in the manifest: android:configChanges=”orientation|screenSize” so it looks like <activity android:label=”@string/app_name” android:configChanges=”orientation|screenSize|keyboardHidden” android:name=”.your.package”> The matter is that the system destroys … Read more

How to correctly save instance state of Fragments in back stack?

To correctly save the instance state of Fragment you should do the following: 1. In the fragment, save instance state by overriding onSaveInstanceState() and restore in onActivityCreated(): class MyFragment extends Fragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); … if (savedInstanceState != null) { //Restore the fragment’s state here } } … @Override public … Read more

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