Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected String doInBackground(String[] arg0)
- {
- EditText et = (EditText) findViewById(R.id.email);
- String str = et.getText().toString();
- EditText et2 = (EditText) findViewById(R.id.Password);
- String str2 = et2.getText().toString();
- try{
- BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
- Socket clientSocket = new Socket("192.168.0.5", 6789);
- DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
- BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
- usrname = et.getText().toString();
- Log.w("app", "1");
- outToServer.writeBytes(str + " " + str2 + '\n');
- Log.w("app", "2");
- modifiedSentence = inFromServer.readLine();
- Log.w("app", "3");
- Log.w("app", "FROMSERVER: " + modifiedSentence);
- if(modifiedSentence.equals("1")){
- Intent i = new Intent(Login.this, Control_Panel.class);
- startActivity(i);
- }else if(modifiedSentence.equals("2")){
- message();
- text.setText("The password/username is incorrect");
- }
- clientSocket.close();
- } catch (IOException e) {
- Log.w("app", e.toString());
- return "Error";
- }
- return modifiedSentence;
- }
- protected void onPostExecute(String result)
- {
- Log.w("app", result);
- }
- }
- void message(String[] args){
- text = (TextView) findViewById(R.id.incorrect);
- text.setText("The password/username is incorrect");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement