Back to project page LinuxZaSve_mobile.
The source code is released under:
Apache License
If you think the Android project LinuxZaSve_mobile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.linuxzasve.mobile.googl; /*from w w w.ja v a2 s. co m*/ import com.linuxzasve.mobile.googl.model.GooGlRequest; import com.linuxzasve.mobile.googl.model.GooGlResponse; import retrofit.Callback; import retrofit.RestAdapter; /** * Class is used to shorten URL via goo.gl service. * * @author dejan */ public class GoogleUrlShortener { private static final String BASE_URL = "https://www.googleapis.com"; /** * Method shortens url * * @param longUrl long url to be shortened * @param callback response handler */ public void shortenUrl(final String longUrl, final Callback<GooGlResponse> callback) { GooGlRequest r = new GooGlRequest(); r.setLongUrl(longUrl); RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(BASE_URL) .build(); GooGlService service = restAdapter.create(GooGlService.class); service.shortenUrl(r, callback); } }