gpt4 book ai didi

android - Movie() 在 adroid.graphics.Movie 中不公开 无法从包外访问

转载 作者:行者123 更新时间:2023-11-30 00:38:49 24 4
gpt4 key购买 nike

我正在开发一个显示即将上映和正在播放的电影列表的电影管理器应用。

这里的错误是 Movie() 在 android.graphics.Movie 中不公开,不能从外部包访问。

请帮忙。

包 com.example.android.movi​​emanager.activity.fragments;

import android.graphics.Movie;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.android.moviemanager.R;
import com.example.android.moviemanager.activity.adapters.MovieRecyclerViewAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
* A simple {@link Fragment} subclass.
*/
public class now_playing extends Fragment {

@BindView(R.id.rvMovie)
RecyclerView rvMovie;
List<Movie> movies;


public now_playing() {
// Required empty public constructor
}


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_now_playing, container, false);

ButterKnife.bind(this, view);
initializeData();

LinearLayoutManager llm=new LinearLayoutManager(this.getContext());

rvMovie.setHasFixedSize(true);
rvMovie.setLayoutManager(llm);
MovieRecyclerViewAdapter adapter= new MovieRecyclerViewAdapter(getContext(), movies);
rvMovie.setAdapter(adapter);
return view;
}

private void initializeData() {
movies = new ArrayList<Movie>();
movies.add(new Movie("277834", "Moana", "In Ancient Polynesia, when a terrible curse incurred by Maui reaches an impetuous Chieftain's daughter's island, she answers the Ocean's call to seek out the demigod to set things right.", 6.5f, 854, "/z4x0Bp48ar3Mda8KiPD1vwSY3D8.jpg", "/1qGzqGUd1pa05aqYXGSbLkiBlLB.jpg"));
movies.add(new Movie("121856", "Passengers", "A spacecraft traveling to a distant colony planet and transporting thousands of people has a malfunction in its sleep chambers. As a result, two passengers are awakened 90 years early.", 6.2f, 745, "/5gJkVIVU7FDp7AfRAbPSvvdbre2.jpg", "/5EW4TR3fWEqpKsWysNcBMtz9Sgp.jpg"));
movies.add(new Movie("330459", "Assassin's Creed", "Lynch discovers he is a descendant of the secret Assassins society through unlocked genetic memories that allow him to relive the adventures of his ancestor, Aguilar, in 15th Century Spain. After gaining incredible knowledge and skills he’s poised to take on the oppressive Knights Templar in the present day.", 5.3f, 691, "/tIKFBxBZhSXpIITiiB5Ws8VGXjt.jpg", "/5EW4TR3fWEqpKsWysNcBMtz9Sgp.jpg"));
movies.add(new Movie("283366", "Rogue One: A Star Wars Story", "A rogue band of resistance fighters unite for a mission to steal the Death Star plans and bring a new hope to the galaxy.", 7.2f, 1802, "/qjiskwlV1qQzRCjpV0cL9pEMF9a.jpg", "/tZjVVIYXACV4IIIhXeIM59ytqwS.jpg"));
movies.add(new Movie("313369", "La La Land", "Mia, an aspiring actress, serves lattes to movie stars in between auditions and Sebastian, a jazz musician, scrapes by playing cocktail party gigs in dingy bars, but as success mounts they are faced with decisions that begin to fray the fragile fabric of their love affair, and the dreams they worked so hard to maintain in each other threaten to rip them apart.", 8, 396, "/la-la-land-ryan-gosling-emma-stone-600x413.jpg", "/nadTlnTE6DdgmYsN4iWc2a2wiaI.jpg"));


}

}

最佳答案

您有两个同名 Movie 的类,这就是编译器不理解您要引用哪个 Movie 类的原因。

请使用完整的 android.graphics.MovieYour-Package-here.Movie 访问电影类。

但是,如果您重命名您的模型类 Movie,那么此问题将得到解决。

关于android - Movie() 在 adroid.graphics.Movie 中不公开 无法从包外访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42899653/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com