Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
package com.bhutanNEWS.bhtnews;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class ApiUtilities {

private static Retrofit retrofit=null;

public static getApiInterface();
{

if (retrofit==null)
{

retrofit= new Retrofit.Builder().baseUrl(ApiInterface.BASE_URL).
addConverterFactory(GsonConverterFactory.create()).build();

}

return retrofit.create(ApiInterface.class);


}


}

What I have tried:

i tried finding the usage of ApiInterface but it requires a usage to get the return type.
Posted
Updated 28-Jul-21 6:38am

1 solution

Look at your definition, it needs a return type on the method declaration. And the return statement tells you what type it is actually returning.
Java
public static getApiInterface(); // this needs a return type
{

if (retrofit==null)
{

retrofit= new Retrofit.Builder().baseUrl(ApiInterface.BASE_URL).
addConverterFactory(GsonConverterFactory.create()).build();

}

return retrofit.create(ApiInterface.class); // and this is what you are trying to return


}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900