我刚接触Android Studio,我想将Android Studio连接到另一个编译器创建的数据库。当我执行调试器并到达de line&#34; BufferedReader bf = new BufferedReader(new InputStreamReader(conn.getInputStream()));&#34;时,我得到和Exception调用&#34; FileNotFoundException&#34;。< / p>
有人可以帮助我吗?
非常感谢。
公共类Menu_Login扩展了AppCompatActivity {
EditText usuario, password;
Button login;
String url_login;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_login);
usuario = (EditText) findViewById(R.id.escribir_nombre); // COMO DECLARAR UN EDIT TEXT
password = (EditText) findViewById(R.id.escribir_contraseña);
login = (Button) findViewById(R.id.click_boton);
final Context context = this;
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
String user = usuario.getText().toString();
String pass = password.getText().toString();
url_login = String.format("http://192.168.1.35/loguear?nombre=%s&password=%s",user,pass);
new MultiplyTask(context).execute(user);
}
});
}
public class MultiplyTask extends AsyncTask <String,Void,String>
{
Context context;
private MultiplyTask(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected void onPostExecute(String value) {
TextView n = (TextView) findViewById (R.id.mostrar_resultado);
n.setText(value);
}
@Override
protected String doInBackground(String... params) {
try
{
URL url = new URL(url_login);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000 );
conn.setConnectTimeout(15000);
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.connect();
BufferedReader bf = new BufferedReader(new InputStreamReader(conn.getInputStream()));
int status = conn.getResponseCode();
InputStream error = conn.getErrorStream();
String value = bf.readLine();
return value;
}
catch (Exception e)
{
System.out.println(e);
e.printStackTrace();
}
return null;
}
}
}