Cannot make a static reference to the non-static method getRemoteInfo(String, String) from the type MainActivity 不能做一个静态引用非静态方法getRemoteInfo MainActivity类型(字符串,字符串) 你在静态方法里面调用了非静态方法
public static class PlaceholderFragment extends Fragment 你为什么要把它定义成static的? 没有理解;去掉static 应该就没问题了;static 的话说明这个类 是不属于MainActivity,你不能直接调用MainActivity的方法
public void getRemoteInfo(String username,String password){.....} 改成 public static void getRemoteInfo(String username,String password){.....}TextViewResult.setText(msg.obj.toString()) 改成TextViewResult.setText((String)msg.obj);感觉你不需要把那个类定义成静态的,不知道你的代码是哪里来的
String Pwd = PassEditText.getText().toString().trim();
TextViewResult.setText("用户名" + UserName + "," + "密码" + Pwd);
Thread th= new Thread(new Runnable() {
@Override
public void run() {
getRemoteInfo(UserName,Pwd);
}
});
th.start();你确定这段能编译通过?
不能做一个静态引用非静态方法getRemoteInfo MainActivity类型(字符串,字符串)
你在静态方法里面调用了非静态方法
改成 public static void getRemoteInfo(String username,String password){.....}TextViewResult.setText(msg.obj.toString())
改成TextViewResult.setText((String)msg.obj);感觉你不需要把那个类定义成静态的,不知道你的代码是哪里来的