简体   繁体   中英

Can't Cannot resolve constructor 'SlideModel(java.lang.String, java.lang.String)'?

I want to add auto slider image with indicator using image link inside my android application, but the error i got is here

Cannot resolve constructor 'SlideModel(java.lang.String, java.lang.String)

Main Activity

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<com.denzcoskun.imageslider.ImageSlider
    android:id="@+id/image_slider"
    android:layout_width="wrap_content"
    android:layout_height="250dp"
    app:iss_auto_cycle="true"
    app:iss_period="1000"
    app:iss_delay="0"
    tools:ignore="MissingConstraints" />

</androidx.constraintlayout.widget.ConstraintLayout>

Main Activity java

package com.example.imageslider;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import com.denzcoskun.imageslider.ImageSlider;
import com.denzcoskun.imageslider.models.SlideModel;
import java.util.ArrayList;
import java.util.List;

public class MainActivity<val> extends AppCompatActivity {
ImageSlider imageSlider;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
    WindowManager.LayoutParams.FLAG_FULLSCREEN);

    imageSlider = (ImageSlider) findViewById(R.id.image_slider);
    final List<com.denzcoskun.imageslider.models.SlideModel> remoteImg = new ArrayList<>();

    remoteImg.add(new SlideModel(R.drawable.banner_img, "The animal population decreased by 58 
    percent in 42 years."));

    }
 }

I am a beginner in Android Studio Please help me to fix this problem. I will be very Thanks for them

  • Use version ' 0.0.6 ' of denzconkun:ImageSlideshow

    dependencies { implementation 'com.github.denzcoskun:ImageSlideshow:0.0.6' }

https://youtu.be/1AS5HcXPpqk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM