How does one get the Host Name

Status
Not open for further replies.

myriaddev

Active Member
Licensed User
Longtime User
Hi.
1.) I can get the Host address, but how do you
get the Host Name of the local network such as "jerryN" ?

2.) Android 2.2 asks user to login by sliding a slider. How
can one force the user to login using a password ?

Thanks, Jerry
 

hamidmohammadi

New Member
Licensed User
Hi
I used Erel code (#6) for finding host name but received this error
B4X:
192.168.1.5
main_gethostname (java line: 520)
android.os.NetworkOnMainThreadException
    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1144)
    at java.net.InetAddress.getHostByAddrImpl(InetAddress.java:438)
    at java.net.InetAddress.getCanonicalHostName(InetAddress.java:320)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:216)
    at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod(Reflection.java:802)
    at anywheresoftware.b4a.samples.camera.main._gethostname(main.java:520)
    at anywheresoftware.b4a.samples.camera.main._changecamera_click(main.java:472)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:4475)
    at android.view.View$PerformClick.run(View.java:18786)
    at android.os.Handler.handleCallback(Handler.java:730)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:5419)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)

what is the problem ?
what should I do?
With thanks
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Status
Not open for further replies.
Top