使用翻新版使用两个界面登录

时间:2019-04-04 11:49:30

标签: android api retrofit

我有两个没有相同属性的界面,我需要它们使用Retrofit登录。如何实现另一个接口使用相同的按钮? 我想对接口IEnfant和IAssistant都使用此登录方法:

docker run

我的意思是我需要在一个活动中执行许多回调,这可能吗? 这是我的两个界面:

button.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View v) {


           IEnfant iEnfant= APIClient.getClient().create(IEnfant.class);


           iEnfant.login(editText1.getText().toString(),editText2.getText().toString()).enqueue(new Callback<Enfant>() {
                @Override
                public void onResponse(retrofit2.Call<Enfant> call, Response<Enfant> response) {
                    Toast.makeText(getApplicationContext(),"enfant"+response.body().getNom(),Toast.LENGTH_LONG).show();

                    startActivity(new Intent(getApplicationContext(), CategoriesActivity.class));
                }

                @Override
                public void onFailure(retrofit2.Call<Enfant> call, Throwable t) {
                    Toast.makeText(getApplicationContext(),"'error",Toast.LENGTH_LONG).show();
                    Log.v("tag!!!!!!!!!!","error"+t.getMessage());

                }
            });

0 个答案:

没有答案
相关问题