Category: "Android programming"
Convert DhcpInfo.dns into a readable IP
DhcpInfo.dns1 and DhcpInfo.dns2 is an integer, not a readable IP string,"x.x.x.x". That is hard to understand. I did a search in internet. There are a number of people to write their own function to do that. Actually, Android SDK has a formatter to do that.
Code
Formatter.formatIpAddress(info.dns1) |
Android Layout XML File is case-sensitive!
In the most situation, XML file is case-insensitive. I thought that is the same case as Android Layout XML. There is no different between
Android - On Screen Notification
In the C# Wolrd, we always use "MessageBox.Show (String)" to generate on screen notification (Pop-Up Message Box). In the Android, it has a similar thing calls toast. That is a small square box on the screen. Well, this is not just a single line of code, like Toast.Show(string). But that is just a few lines of codes more.
Code
Context context = getApplicationContext(); | |
CharSequence msgText= "Test"; | |
Toast toast = Toast.makeText(context,msgText, Toast.LENGTH_LONG); | |
toast.show(); |
Android 4.0
Apple has announced iPhone 4S and iOS 5 update. I need Google to response this news too! Last week, they has announced Galaxy Nexus and Android 4.0. That is the new generation of Google Phone! Moreover, that is the first Android which can use in Tablet and Phone! I hope we can get a Galaxy Nexus soon too!
Reference:
Android Blog
My first android program
I have written a tiny game in Android. That is my frist android progam. The game is very simple to guess what number the computer picked. But it shows how to use event handler.
http://www.michaelleung.info/download-area?task=view.download&cid=2