This is the best 1 liner answer I found in the Internet to check if an array’s item or value or however you may call it exists in another array.

Using the function array_intersect(), you can achieve this. User lorenzo-s from Stack Overflow gave this 1 liner code that did the trick.

Do note that array_intersect() is case sensitive.

Setting the sort order between 2 rows in MySQL can be done in 1 line by making use of the IF() function.

I had a scenario where I had move up and move down functionalities to set the order of my database entries.

Let us say, you have columns ID and SORT_ORDER.

This line of code should do the trick.

The best and easiest way to have your app determine if the device is a smartphone or a tablet is to place a boolean value in a specific value file such as res/values-xlarge.

Then, in the folder res/values, you can add the same XML code but with a false value.

In your Android code, you can get the value with this code:

Related Posts Plugin for WordPress, Blogger...