Lucky Silva
Lucky Silva

Reputation: 21

Android - transfer data via TCP/IP

I want to ask about android application.

How to transfer data via WIFI(TCP/IP) when the button is pressed?

For example: when I push the button1, then it send number 1 and when I push the button2, then it send number 2..

Please help me..Thank You


how to display texs when the button is pressed and if button is released, the text is missing? if there are tutorials out here please .. thanks a lot

Upvotes: 2

Views: 6939

Answers (1)

songyy
songyy

Reputation: 4563

You may add an "OnClickListener" to the button, so that after you pressed the button it can do something. (search for "Android button onClickListener" you can find some example)

In order to change text after you button clicked, in your program you need to hold an instance of TextView (calling findInstanceById(textViewId) you can get your textView), then in your button-click you can do setText for the textView.

If you want to transfer some data to another phone via WiFi, you need to make sure the two phones are connected. Here you may refer to the WiFi-Direct tutorial section from Google

Happy Hacking ~:)

Upvotes: 1

Related Questions