【发布时间】:2021-02-04 10:26:13
【问题描述】:
我正在创建一个从我的数据库(000webhost)连接的应用程序,我正在使用它 对于http url connection。
这是我的代码
public class RegisterFragment extends Fragment {
public RegisterFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_register, container, false);
//Start ProgressBar first (Set visibility VISIBLE)
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
FetchData fetchData = new FetchData("https://projects.vishnusivadas.com/AdvancedHttpURLConnection/readTest.php");
if (fetchData.startFetch()) {
if (fetchData.onComplete()) {
String result = fetchData.getResult();
//End ProgressBar (Set visibility to GONE)
}
}
}
});
}
}
它告诉我Handler 部分是
无法访问的语句
有人可以指出为什么它有错误。 提前谢谢你
【问题讨论】:
-
您的处理程序代码之前有一个返回语句......
标签: java android mysql android-studio