我修改了我的最后一个代码,但此代码仍然显示找到网络
final ConnectivityManager connMgr = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
final android.net.NetworkInfo mobile1 =
connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mobile1.isAvailable()) {
Toast.makeText(LoginScreen.this," other Connection Found
",Toast.LENGTH_LONG).show();
btnLogin.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
String pinemptycheck = pin.getText().toString();
String mobileemptycheck = mobile.getText().toString();
if (pinemptycheck.trim().equals("")||(mobileemptycheck.trim().equals("")))
{
Toast.makeText(getApplicationContext(), "Please Enter Correct Information",
Toast.LENGTH_LONG).show();
}
else
{
showProgress();
postLoginData();
}
}
});
}
else if (!mobile1.isAvailable()) {
Toast.makeText(LoginScreen.this,"No other Connection Found ",Toast.LENGTH_LONG).show();
btnLogin.setOnClickListener(new OnClickListener() {
public void onClick(View v)
{
Toast.makeText(LoginScreen.this," No other Connection Found", Toast.LENGTH_LONG).show();
}
});
}}