Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IP address textbox in Android?

Tags:

android

I'm totally new to Android.

I would like to put in a textbox where user can enter an IP address ... but how do I limit the user to only enter numbers? ... and how do I validate?

Is there a ready-made-ip-address-textbox "out there" I can use?

Thanks!

Mojo

like image 919
MojoDK Avatar asked Oct 07 '10 14:10

MojoDK


People also ask

How to get the IP address of Android device programmatically?

This example demonstrates how do I get the IP address of android device programmatically. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.java. ...

How to change the properties of the IP textbox?

Set a TextBox in your form or user control and clear its contents. Change the type of this TextBox from System.Windows.Forms.TextBox to rj2_cs.IPAddressTextBox in code editor. Then you can change the properties of the IP textbox like you want.

How to input IPv4 address in edittext?

What I've found that works is to set an EditText to use android:inputType="phone", so the input is restricted to digits, period, and a handful of other characters. However, this will only let you input IPV4 addresses, since it's digits only. For validation, you'll have to get the input text and parse it by hand.

What is a local IP address on a router?

The router automatically assigns a local IP address to every device that connects to it. This address can be used to identify each device on a network and connect them. For example, if you want to connect an app on your PC with your Android phone, then local IP address of at least one of the devices is needed.


1 Answers

What I've found that works is to set an EditText to use android:inputType="phone", so the input is restricted to digits, period, and a handful of other characters. However, this will only let you input IPV4 addresses, since it's digits only. For validation, you'll have to get the input text and parse it by hand.

As far as ready-made input widgets, I haven't come across one.

like image 159
Erich Douglass Avatar answered Sep 22 '22 03:09

Erich Douglass