-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainActivity.java
54 lines (41 loc) · 1.4 KB
/
MainActivity.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
package com.example.ecelldictionary;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
String url;
Button search;
EditText word;
String s;
TextView result ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
search=(Button)findViewById(R.id.Search);
word=(EditText)findViewById(R.id.enterWord);
result=(TextView)findViewById(R.id.ResultShow);
s=word.toString();
url = inflections();
search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
requestAPIButtonClick(result);
}
});
}
public void requestAPIButtonClick(View v)
{
MyRequest myrequest =new MyRequest(this);
myrequest.execute(url);
}
private String inflections() {
final String language = "en";
final String word = s;
final String word_id = word.toLowerCase();
return "https://od-api.oxforddictionaries.com:443/api/v2/lemmas/" + language + "/" + word_id;
}
}