2017-03-20 7 views
1

ムービーマネージャーアプリを開発しています。ムービー()はadroid.graphics.Movieに公開されていません。パッケージ外からはアクセスできません。

Movie()がandroid.graphics.Movieに公開されておらず、外部のパッケージからアクセスできないというエラーが表示されます。

助けてください。

パッケージcom.example.android.movi​​emanager.activity.fragments;あなたが理由で、同じ名前Movie持つ2つのクラスを持っている

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")); 


    } 

} 

答えて

1

、コンパイラは、あなたが参照してくださいしたいMovieクラスを理解していません。

ムービークラスにアクセスするには、完全android.graphics.MovieまたはYour-Package-here.Movieを使用してください。

ただし、モデルクラスの名前を変更すると、この問題は解決されます。

関連する問題