我正在寫一個android應用程序在c#中,與服務器通信。c#android訪問另一個類的textview
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
Button button = FindViewById<Button>(Resource.Id.button1);
TextView txt = FindViewById<TextView>(Resource.Id.textView1);
Client client = new Client();
client.Setup("ws://192.168.0.14:8001", "basic", WebSocketVersion.Rfc6455);
client.Start();
...
在啓動時,它應該在TextView上顯示一個標準。
class Client : Activity{
private WebSocket websocketClient;
...
public void Setup(string url, string protocol, WebSocketVersion version)
{
...
websocketClient.Opened += new EventHandler(websocketClient_Opened);
}
private void websocketClient_Opened(object sender, EventArgs e){
txt.Text = ("Client successfully connected."); // this line is wrong
websocketClient.Send("Hello World!");
}
}
的問題是,我不知道,如何存取權限TextView的。我發現this,但我不知道我應該如何使用它在我的情況下