-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditFacultyActivity.java
104 lines (81 loc) · 3.42 KB
/
EditFacultyActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.tracking.ebridge;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import static com.tracking.ebridge.R.id.edit;
public class EditFacultyActivity extends Activity {
EditText fnEdit,fmEdit,feEdit,fdEdit;
Button editButton;
JSONParser parser=new JSONParser();
public String editUrl="http://www.wikihands.com/ebridge/editfaculty.php";
String fnameString,fmobileString,femailString,fdepartString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_edit_faculty);
fnEdit= (EditText) findViewById(R.id.facultyname);
fmEdit= (EditText) findViewById(R.id.facultymobile);
feEdit= (EditText) findViewById(R.id.facultyemail);
fdEdit= (EditText) findViewById(R.id.facultydepartment);
String name=getIntent().getStringExtra("NAME");
String mobile=getIntent().getStringExtra("MOBILE");
String mail=getIntent().getStringExtra("EMAIL");
String depart=getIntent().getStringExtra("DEPART");
fnEdit.setText(name);
fmEdit.setText(mobile);
feEdit.setText(mail);
fdEdit.setText(depart);
editButton= (Button) findViewById(edit);
editButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fnameString=fnEdit.getText().toString();
fmobileString=fmEdit.getText().toString();
femailString=feEdit.getText().toString();
fdepartString=fdEdit.getText().toString();
if (fnameString.length()>0&&fmobileString.length()>0&&femailString.length()>0&&fdepartString.length()>0)
{
new FacultyEdit().execute();
}
else
{
Toast.makeText(EditFacultyActivity.this,"Fields not be empty",Toast.LENGTH_LONG).show();
}
}
});
}
public class FacultyEdit extends AsyncTask<String,String,String>
{
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected String doInBackground(String... params) {
List<NameValuePair> args=new ArrayList<>();
String username=getIntent().getStringExtra("USERNAME");
args.add(new BasicNameValuePair("username",username));
args.add(new BasicNameValuePair("name",fnameString));
args.add(new BasicNameValuePair("mobile",fmobileString));
args.add(new BasicNameValuePair("mail",femailString));
args.add(new BasicNameValuePair("depart",fdepartString));
JSONObject object=parser.makeHttpRequest(editUrl,"POST",args);
return null;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
}
}
}