IP Editor

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

IP Editor

Postby taisa.santos » Fri Nov 14, 2008 12:08 pm

Is there an IP Editor in Android? :roll:
Taisa Cristina
taisa.santos
Freshman
Freshman
 
Posts: 8
Joined: Mon Oct 27, 2008 5:51 pm

Top

Postby MrSnowflake » Fri Nov 14, 2008 12:10 pm

What's an IP editor? You mean a IP Address view or something? If so, you could use EditTexts, though a real IPView would indeed be nicer.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby taisa.santos » Fri Nov 14, 2008 12:51 pm

Yes, IP Address Editor.
So I'll need to implement a listener to format and validate the input :(
Taisa Cristina
taisa.santos
Freshman
Freshman
 
Posts: 8
Joined: Mon Oct 27, 2008 5:51 pm

Postby MrSnowflake » Fri Nov 14, 2008 1:07 pm

Something like that. Or you could just use a EditText en when the user finishes entering, or goes to the next screen, you can try to make a socket with that address (Socket testSocket = new Socket(editText.getText().toString()). If an illegalformatexception is thrown, you know the address/ip format is invalid. But then you have a hostname/ip address input box, but I think that's easiers, as IPV6 IP addresses are a lot more difficult to correctly parse/check.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby taisa.santos » Fri Nov 14, 2008 1:31 pm

Good tip!
Thanks!!! :wink:
Taisa Cristina
taisa.santos
Freshman
Freshman
 
Posts: 8
Joined: Mon Oct 27, 2008 5:51 pm

Postby MrSnowflake » Fri Nov 14, 2008 1:54 pm

Just so you know: it's bad practice to use Exceptions for functional stuff :).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests