How to define dimens.xml for every different screen size in android?

You have to create Different values folder for different screens . Like values-sw720dp 10.1” tablet 1280×800 mdpi values-sw600dp 7.0” tablet 1024×600 mdpi values-sw480dp 5.4” 480×854 mdpi values-sw480dp 5.1” 480×800 mdpi values-xxhdpi 5.5″ 1080×1920 xxhdpi values-xxxhdpi 5.5″ 1440×2560 xxxhdpi values-xhdpi 4.7” 1280×720 xhdpi values-xhdpi 4.65” 720×1280 xhdpi values-hdpi 4.0” 480×800 hdpi values-hdpi 3.7” 480×854 hdpi values-mdpi … Read more

How to close activity and go back to previous activity in android

I think you are calling finish() method in MainActivity before starting SettingsActivity. The scenario which you have described will occur in following two ways: EITHER You have set android:noHistory = “true” for MainActivity inside AndroidManifest.xml which causes MainActivity to finish automatically on pressing the back key. OR Before switching to your ‘SettingsActivity’, you have called … Read more

Difference between onCreate() and onStart()? [duplicate]

Take a look on life cycle of Activity Where ***onCreate()*** Called when the activity is first created. This is where you should do all of your normal static set up: create views, bind data to lists, etc. This method also provides you with a Bundle containing the activity’s previously frozen state, if there was one. … Read more

What is the difference between onPause() and onStop() of Android Activites?

No, if some activity comes into foreground, that doesn’t necessarily mean that the other activity is completely invisible. Consider the following case: Here we see both activities at the same time. The first activity with the fields is obscured by another activity, and the user can no longer interact with it. However, it is still … Read more

java.lang.IllegalStateException: Fragment not attached to Activity

This error happens due to the combined effect of two factors: The HTTP request, when complete, invokes either onResponse() or onError() (which work on the main thread) without knowing whether the Activity is still in the foreground or not. If the Activity is gone (the user navigated elsewhere), getActivity() returns null. The Volley Response is … Read more

Why this line xmlns:android=”http://schemas.android.com/apk/res/android” must be the first in the layout xml file?

In XML, xmlns declares a Namespace. In fact, when you do: <LinearLayout android:id> </LinearLayout> Instead of calling android:id, the xml will use http://schemas.android.com/apk/res/android:id to be unique. Generally this page doesn’t exist (it’s a URI, not a URL), but sometimes it is a URL that explains the used namespace. The namespace has pretty much the same … Read more

Notification click: activity already open

You need to set the launchMode attribute of the Activity you are starting to singleTop. This will cause incoming Intents to be delivered to the existing instance rather than starting a new instance when that Activity is already at the top of the task’s stack. This is done in the manifest by adding android:launchMode=”singleTop” to … Read more

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