-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainActivity1.java
54 lines (38 loc) · 1.59 KB
/
MainActivity1.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.fanaticaltechnology.retrofitdemohighmountains;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity {
RecyclerView recyclerview;
APIInterface apiInterface;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerview=(RecyclerView)findViewById(R.id.recyclerview);
apiInterface = APIClient.getClient().create(APIInterface.class);
API();
}
private void API() {
Call<PostDataClass> call = apiInterface.getDestinationsList("1");
call.enqueue(new Callback<PostDataClass>() {
@Override
public void onResponse(Call<PostDataClass> call, Response<PostDataClass> response) {
Log.e("reponse","response"+response);
String message= response.body().getMessage().toString();
Log.e("stat","stat"+response.body().getSuccess()+"mesage"+message);
List<PostDataClass.DataBean> list1= response.body().getData();
Log.e("resultdestination",list1.get(0).getEmail());
}
@Override
public void onFailure(Call<PostDataClass> call, Throwable t) {
call.cancel();
}
});
}
}