2016-10-28 2 views
-7
final List<Data> data = new ArrayList<>(); 

     data.add(new Data("Batman vs Superman", "Following the destruction of Metropolis, Batman embarks on a personal vendetta against Superman ", R.mipmap.ic_apps)); 
     data.add(new Data("X-Men: Apocalypse", "X-Men: Apocalypse is an upcoming American superhero film based on the X-Men characters that appear in Marvel Comics ",R.mipmap.ic_apps)); 
     data.add(new Data("Captain America: Civil War", "A feud between Captain America and Iron Man leaves the Avengers in turmoil. ", R.mipmap.ic_apps)); 
     data.add(new Data("Kung Fu Panda 3", "After reuniting with his long-lost father, Po must train a village of pandas", R.mipmap.ic_apps)); 
     data.add(new Data("Warcraft", "Fleeing their dying home to colonize another, fearsome orc warriors invade the peaceful realm of Azeroth. ", R.mipmap.ic_apps)); 
     data.add(new Data("Alice in Wonderland", "Alice in Wonderland: Through the Looking Glass ", R.mipmap.ic_apps)); 

を取得するリストの場所で最初のパラメータ<>コードとデータクラス上でAndroidのJavaの

public class Data implements Comparable<Data>{ 
    public String title; 
    public String description; 
    public int imageId; 

    Data(String title, String description, int imageId) { 
     this.title = title; 
     this.description = description; 
     this.imageId = imageId; 
    } 
} 

今私が唯一 がどのように私はタイトルだけを取得することができ、リストデータの位置を知っています例: - 「バットマン対スーパーマン」の位置?

+5

'data.get(position).title;'。 Javaについての良い本を購入してくださいそれを読む – Blackbelt

答えて

0

data.get(pos).titleあなたのために仕事をします。

そして、私はここに投稿する前に、あなたの基礎やatleast googleをクリアすることをお勧めします。

+0

は期待どおりに動作します – AndroidGuy007

関連する問題