我试图发送连接欢迎消息的用户,但这样的事情不会起作用:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
person.add(new Gender("35AE111", false, "60 km/h"));
final ListView listview= (ListView)getView().findViewById(R.id.liste);
CustomAdapter customAdapter=new CustomAdapter(getActivity(), kisiler);
listview.setAdapter(customAdapter);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_all_vehicles, container, false);
}
}
我知道这并不是我给你的很多信息,但我不知道你需要什么。 (我的前端是angularJs,这可能很有用)
答案 0 :(得分:1)
你可以做这样的事情
public override Task OnConnected()
{
string name = Context.User.Identity.Name;
Groups.Add(Context.ConnectionId, name);
Clients.Group(name).newMessage("Hello world!"); //Welcome message to current user
return base.OnConnected();
}