Sunday , November 28 2021

Android AdapterViewFlipper Example using Retrofit and Glide – Android Coding by DMTechnolab

The package The trap.Simplified coding.viewflipperexample;

Import Android.Support.v7.App.AppCompatActivity;

Import Android.The.Bundle;

Import Android.Widget.AdapterViewFlipper;

Import Android.Widget.Toast;

Import Java.Useful.array list;

Import Retrofit 2.Call out;

Import Retrofit back;

Import Retrofit 2.Feedback;

Import Retrofit 2.move back;

Import Retrofit 2.Converter.the resurrection.GsonConverterFactory;

public class Main activity Is spread AppCompatActivity {{

// base URL

public Fixed The last String BASE_URL = “”;

// adapterviewflipper object

Private AdapterViewFlipper Adapter viewfinder;

@ Override

Protected Zero Go ahead()Bundle saveInstanceState) {{

Super.Go ahead()saveInstanceState);


// Adapterviewflipper getting

Adapter viewfinder = ()AdapterViewFlipper) findViewById()R.Id.Adapter viewfinder);

// Creating the retrofit object

move back move back = New move back.Builder())


.addConverterFactory()GsonConverterFactory.To create()))


// Defining Retrofit App Service

APIService Service = move back.To create()APIService.class);

// create an API call

Call out call = Service.getHeroes());

// is calling

call.Begrudge()New call back()) {{

@ Override

public Zero Treason()Call out call, Feedback Feedback) {{

// Getting the list of heroes

array list Heron = Feedback.Body()).getHeros());

// Creating an adapter object

FlipperAdapter Adopter = New FlipperAdapter()getApplicationContext()), Heron);

// add it to the adapterview flipper

Adapter viewfinder.setAdapter()Adopter);

Adapter viewfinder.setFlipInterval()1000);

Adapter viewfinder.To start());



public Zero Failure()Call out call, Throwable T) {{

Toast.Makeup()getApplicationContext()), T.getMessage()), Toast.LENGTH_LONG).Display());





Source link

About dmtechnolab

Check Also

Simplified Coding

Android Espresso Tutorial – Testing Fragment in Isolation – Android Coding by DMTechnolab

Welcome to another tutorial in the Android test series. And this post is called Android …

Leave a Reply

Your email address will not be published. Required fields are marked *