Viewed   93 times

What is the difference between:





in Android?





is attribute reference from appCompat library so it is applied to older versions of android and doesn't need android prefix.


is attribute provided by platform which may not support older android versions but only from version they are introduced.


Here use of attr applies to the attribute defined for current theme. i.e if you have your application theme set for light version then selectableItemBackground of light theme will be applied.

And you can define your own values which can be accessed without using android prefix.

Thursday, November 10, 2022

Since the attribute is defined in a library (support v7), you would use it as a user-defined attribute: i.e without the android: prefix:


The error you see is pointing out that ?android:attr/selectableItemBackground is available for API versions >= 11. True, indeed.

Tuesday, August 2, 2022

A Kotlin object is like a class that can't be instantiated so it must be called by name. (a static class per se)

The android converter saw that your class contained only a static method, so it converted it to a Kotlin object.

Read more about it here:

Thursday, August 11, 2022

The major difference between the two (other than add()'s String-only support) is that put() overwrites the previous presence of param with an existing key while add() does not.

For example:

params.put("etc", "etc");
params.put("key", "abc");
params.put("key", "xyz");

// Params: etc=etc&key=xyz

While add creates two params with the same key:

params.add("etc", "etc");
params.add("key", "abc");
params.add("key", "xyz");

// Params: etc=etc&key=abc&key=xyz

But what is the importance of doing this?

In the above example, the web-server would only read the last value of key i.e. xyz and not abc but this is useful when POSTing arrays:

params.add("key[]", "a");
params.add("key[]", "b");
params.add("key[]", "c");

// Params: key[]=a&key[]=b&key[]=c
// The server will read it as: "key" => ["a", "b", "c"]
Monday, August 1, 2022

This is a Strict-mode violation. In short, you are not supposed to do any network or DB operation on the main thread. Use an AsyncTask for getting the XML.

Monday, November 21, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :