Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
846 views
in Technique[技术] by (71.8m points)

android studio - 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...