Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onClick(View view) {
- if (btnLock.getText().equals("Enabled")) {
- btnLock.setText("Disable");
- txtStatus.setText("Status: Lock");
- OkHttpClient httpClient = new OkHttpClient();
- String url = "magilock.epizy.com/ChangeStatus.php?lock=1";
- Request request = new Request.Builder()
- .url(url)
- .build();
- Response response = null;
- try {
- response = httpClient.newCall(request).execute();
- Toast.makeText(getActivity(), response.body().toString(), Toast.LENGTH_SHORT).show();
- } catch (IOException e) {
- Log.e(TAG, "error in getting response get request okhttp");
- }
- }
- else
- {
- btnLock.setText("Enable");
- txtStatus.setText("Status: Unlock");
- OkHttpClient httpClient = new OkHttpClient();
- String url = "magilock.epizy.com/ChangeStatus.php?lock=0";
- Request request = new Request.Builder()
- .url(url)
- .build();
- Response response = null;
- try {
- response = httpClient.newCall(request).execute();
- Toast.makeText(getActivity(), response.body().toString(), Toast.LENGTH_SHORT).show();
- } catch (IOException e) {
- Log.e(TAG, "error in getting response get request okhttp");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement