For years, I have wanted to develop for Android but I haven’t gotten off my butt and done it. I recently decided to force myself to explore development, using PhoneGap. Today, I wrote a very basic proof of concept. I have to admit that it was pretty easy. I wrote the app using HTML, JS, and CSS, uploaded it to github, and built it on PhoneGap Build. It is not pretty but it is very functional.
As you can see, the conversion from binary to decimal is much easier than decimal to binary. Before you ask, I do know that toString() can convert decimal to binary, octal, and hexadecimal but that would not have been as fun. 🙂
Edit: I updated BinaryToDecimal(). There was a significant flaw in it. After talking the problem over with Jeremy Streich, I also decided that this could be refactored to be much more simple. I’ll probably wait on writing a revision, though. I want to try hex and octal sometime soon and I’ll revisit this as part of that.
These days, it seems like there are an almost infinite number of device types. There are phones, tablets, phablets (AKA really big phone), small laptops (like netbooks), big laptops, and desktops. The key to dealing with these devices is simply responsive design and extensive compatibility testing. You should not deviate from that!
With that said, let us say that you want to target specific devices for device-specific behavior. You could use a condition that is based upon user-agent strings but you would need to know all of the potential user-agent strings. Even if you have the user-agent for Chrome on Android, what if they use the Dolphin Browser on Android? Well, you can target based upon the screen width.