package ru.analgin.love; import android.app.*; import android.os.*; import android.view.*; import android.widget.*; import android.content.Intent; import ru.analgin.love.Connector; import java.io.*; public class ChatActivity extends Activity { TextView msg; private String whois(String login, String pwds) { Connector conn = new Connector(); try { conn.send("login:"+login+",password:"+pwds); while(conn.connect("185.28.21.26",40404).getKeepAlive()) { Toast.makeText(this,conn.read(),Toast.LENGTH_SHORT); } } catch(IOException x) { return "Except: "+x.toString(); } catch(IOError e) { return "Error: "+e.toString(); } return "Result: "+conn.toString(); } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.n); msg=(TextView)findViewById(R.id.msg); ImageView mybg = (ImageView)findViewById(R.id.bgim); mybg.setImageResource(R.drawable.bg); Intent intent = getIntent(); String log = intent.getStringExtra("login"); String pwd = intent.getStringExtra("password"); Toast.makeText(this,whois(log,pwd),Toast.LENGTH_LONG).show(); } }