Android numeric input

July 10, 2010 | In Android, Development | No Comments

To restrict the input for an EditText to a numeric value, you can add the following to the layout file:

<EditText
...
android:singleLine="true"
android:inputType="numberDecimal"
...
>

Then use, for example, Double.parseDouble(…) to retrieve the value in code.

Incidentally, the documentation recommends avoiding floats and using double instead.

main.out.xml: Error parsing XML: no element found

April 11, 2010 | In Android, Development | No Comments

When you build and run your Android application in Eclipse you can get the following error message:

...res\layout\main.out.xml:1: error: Error parsing XML: no element found

This occurs when you try and run the application from the main.xml layout file. The application cannot run from here and needs to be run from the java file.

The answer is to ensure that a java file is selected when you hit run, as you should run the java not the xml file.  The easiest way to ensure you don’t do this is to use the Run History options in Eclipse.

Error registering WCF host in Windows Vista (HTTP could not register URL http://+:80)

March 27, 2010 | In Development | No Comments

This is an error encountered by one of my team when trying to run up a WCF host on a Windows Vista machine.  The actual exception is an

AddressAccessDeniedException

with the error message

HTTP could not register URL http://+:80/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)

The Microsoft site (http://go.microsoft.com/fwlink/?LinkId=70353) does have a solution to the problem using httpcfg and netsh. However the far simpler solution is to run Visual Studio as Administrator

You can do that by right-clicking the shortcut for Visual Studio and selecting Run as adminstrator, or to permanently run as Administrator, right-click and select Properties. Find the Compatibility tab and check the Run this program as administrator checkbo€x.

Next Page »

Login | XFN| WP
Powered by WordPress with cmb-web Theme design by Christian Bridge-Harrington.
Blog feed. Valid XHTML and CSS. ^Top^