有没有太多列表视图或适配器这样的东西?

时间:2015-03-25 23:32:54

标签: java android android-listview

public class MyActivity extends Activity {
    //listviews
    ListView list;
    ListView torahList;
    ListView naviList;
    ListView ketuvimList;
    ListView bereshitList;
    ListView shemotList;
    ListView vayikraList;
    ListView bamidbarList;
    ListView devarimList;
    ListView yehoshuaList;
    ListView shoftimList;
    ListView shmuelAList;
    ListView shmuelBList;
    ListView melachimAList;
    ListView melachimBList;
    ListView yishayaList;
    ListView yirmiyahuList;
    ListView yechezkelList;
    ListView treiasarList;
    ListView hosheaList;
    ListView yoelList;
    ListView amosList;
    ListView ovadiyahList;
    ListView yonahList;
    ListView michahList;
    ListView nachumList;
    ListView chabakukList;
    ListView tzefaniyahList;
    ListView chaggaiList;
    ListView zechariyahList;
    ListView malachiList;
    ListView tehilimList;
    ListView mishleiList;
    ListView iyovList;
    ListView shirList;
    ListView rutList;
    ListView eichaList;
    ListView koheletList;
    ListView estherList;
    ListView danielList;
    ListView ezraList;
    ListView nechamyaList;
    ListView divreiaList;
    ListView divreibList;
//textviews
TextView hebrew;
TextView english;

//scrollview
ScrollView scroll;

//strings
String[] tanakh = {"Torah", "Navi", "Ketuvim"};
String[] torah = {"Bereshit", "Shemot", "Vayikra", "Bamidbar", "Devarim"};
String[] navi = {"Yehoshua", "Shoftim", "Shmuel Alef", "Shmuel Bet", "Melachim Alef", "Melachim Bet", "Yeshayahu", "Yirmayahu", "Yechezkel", "Trei-Asar"};
String[] ketuvim = {"Tehilim", "Mishlei", "Iyov", "Shir Hashirim", "Rut", "Eicha", "Kohelet", "Esther", "Daniel", "Ezra", "Nechamya", "Divrei Hayamim Alef", "Divrei Hayamim Bet"};
String[] bereshit = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav", "Perek Lamed Zayin", "Perek Lamed Chet", "Perek Lamed Tet", "Perek Mem", "Perek Mem Alef", "Perek Mem Bet", "Perek Mem Gimel", "Perek Mem Daled", "Perek Mem Hey", "Perek Mem Vav", "Perek Mem Zayin", "Perek Mem Chet", "Perek Mem Tet", "Perek Nun"};
String[] shemot = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav", "Perek Lamed Zayin", "Perek Lamed Chet", "Perek Lamed Tet", "Perek Mem"};
String[] vayikra = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin"};
String[] bamidbar = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav"};
String[] devarim = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled"};
String[] yehoshua = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled"};
String[] shoftim = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef"};
String[] shmuela = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef"};
String[] shmuelb = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled"};
String[] melachima = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet"};
String[] melachimb = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey"};
String[] yishaya = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav", "Perek Lamed Zayin", "Perek Lamed Chet", "Perek Lamed Tet", "Perek Mem", "Perek Mem Alef", "Perek Mem Bet", "Perek Mem Gimel", "Perek Mem Daled", "Perek Mem Hey", "Perek Mem Vav", "Perek Mem Zayin", "Perek Mem Chet", "Perek Mem Tet", "Perek Nun", "Perek Nun Alef", "Perek Nun Bet", "Perek Nun Gimel", "Perek Nun Daled", "Perek Nun Hey", "Perek Nun Vav", "Perek Nun Zayin", "Perek Nun Chet", "Perek Nun Tet", "Perek Samech", "Perek Samech Alef", "Perek Samech Bet", "Perek Samech Gimel", "Perek Samech Daled", "Perek Samech Hey", "Perek Samech Vav"};
String[] yirmiyahu = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav", "Perek Lamed Zayin", "Perek Lamed Chet", "Perek Lamed Tet", "Perek Mem", "Perek Mem Alef", "Perek Mem Bet", "Perek Mem Gimel", "Perek Mem Daled", "Perek Mem Hey", "Perek Mem Vav", "Perek Mem Zayin", "Perek Mem Chet", "Perek Mem Tet", "Perek Nun", "Perek Nun Alef", "Perek Nun Bet"};
String[] yechezkel = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav", "Perek Lamed Zayin", "Perek Lamed Chet", "Perek Lamed Tet", "Perek Mem", "Perek Mem Alef", "Perek Mem Bet", "Perek Mem Gimel", "Perek Mem Daled", "Perek Mem Hey", "Perek Mem Vav", "Perek Mem Zayin", "Perek Mem Chet"};
String[] treiasar = {"Hoshea", "Yoel", "Amos", "Ovadiyah", "Yonah", "Michah", "Nachum", "Chabakuk", "Tzefaniyah", "Chaggi", "Zechariyah", "Malachi"};
String[] hoshea = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled"};
String[] yoel = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled"};
String[] amos = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet"};
String[] ovadiyah = {"Perek Alef"};
String[] yonah = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled"};
String[] michah = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin"};
String[] nachum = {"Perek Alef", "Perek Bet", "Perek Gimel"};
String[] chabakuk = {"Perek Alef", "Perek Bet", "Perek Gimel"};
String[] tzefaniyah = {"Perek Alef", "Perek Bet", "Perek Gimel"};
String[] chaggai = {"Perek Alef", "Perek Bet"};
String[] zechariyah = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled"};
String[] malachi = {"Perek Alef", "Perek Bet", "Perek Gimel"};
String[] tehilim = {"1-50", "51-100", "101-150"};
String[] mishlei = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef"};
String[] iyov = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav", "Perek Lamed Zayin", "Perek Lamed Chet", "Perek Lamed Tet", "Perek Mem", "Perek Mem Alef", "Perek Mem Bet"};
String[] shir = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet"};
String[] rut = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled"};
String[] eicha = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey"};
String[] kohelet = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet"};
String[] esther = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud"};
String[] daniel = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet"};
String[] ezra = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud"};
String[] nechamya = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel"};
String[] divreia = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet"};
String[] divreib = {"Perek Alef", "Perek Bet", "Perek Gimel", "Perek Daled", "Perek Hey", "Perek Perek Vav", "Perek Zayin", "Perek Chet", "Perek Tet", "Perek Yud", "Perek Yud Alef", "Perek Yud Bet", "Perek Yud Gimel", "Perek Yud Daled", "Perek Tet Vav", "Perek Tet Zayin", "Perek Yud Zayin", "Perek Yud Chet", "Perek Yud Tet", "Perek Kuf", "Perek Kuf Alef", "Perek Kuf Bet", "Perek Kuf Gimel", "Perek Kuf Daled", "Perek Kuf Hey", "Perek Kuf Vav", "Perek Kuf Zayin", "Perek Kuf Chet", "Perek Kuf Tet", "Perek Lamed", "Perek Lamed Alef", "Perek Lamed Bet", "Perek Lamed Gimel", "Perek Lamed Daled", "Perek Lamed Hey", "Perek Lamed Vav"};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    hebrew = (TextView) findViewById(R.id.Hebrew);
    english = (TextView) findViewById(R.id.English);
    scroll = (ScrollView) findViewById(R.id.scrollview);

    //main listview
    list = (ListView) findViewById(R.id.Main);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, tanakh);
    list.setAdapter(adapter);
    list.setClickable(true);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            list.setVisibility(View.GONE);
            //tanakh
            if (position == 0) {
                torahList.setVisibility(View.VISIBLE);
            }
            //navi
            if (position == 1) {
                naviList.setVisibility(View.VISIBLE);
            }
            //ketuvim
            if (position == 2) {
                ketuvimList.setVisibility(View.VISIBLE);
            }
        }
    });

    //torah listview
    torahList = (ListView) findViewById(R.id.Torah);
    ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, torah);
    torahList.setAdapter(adapter2);
    torahList.setClickable(true);
    torahList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            torahList.setVisibility(View.GONE);
            //bereshit
            if (position == 0) {
                bereshitList.setVisibility(View.VISIBLE);
            }
            //shemot
            if (position == 1) {
                shemotList.setVisibility(View.VISIBLE);
            }
            //vayikra
            if (position == 2) {
                vayikraList.setVisibility(View.VISIBLE);
            }
            //bamidbar
            if (position == 3) {
                bamidbarList.setVisibility(View.VISIBLE);
            }
            //devarim
            if (position == 4) {
                devarimList.setVisibility(View.VISIBLE);
            }
        }
    });


    naviList = (ListView) findViewById(R.id.Navi);
    ArrayAdapter<String> adapter3 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, navi);
    naviList.setAdapter(adapter3);
    naviList.setClickable(true);
    naviList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            naviList.setVisibility(View.GONE);
            //yehoshua
            if (position == 0) {
                yehoshuaList.setVisibility(View.VISIBLE);
            }
            //shoftim
            if (position == 1) {
                shoftimList.setVisibility(View.VISIBLE);
            }
            //shmuel alef
            if (position == 2) {
                shmuelAList.setVisibility(View.VISIBLE);
            }
            //shmuel bet
            if (position == 3) {
                shmuelBList.setVisibility(View.VISIBLE);
            }
            //melachim alef
            if (position == 4) {
                melachimAList.setVisibility(View.VISIBLE);
            }
            //melachim bet
            if (position == 5) {
                melachimBList.setVisibility(View.VISIBLE);
            }
            //yeshayahu
            if (position == 6) {
                yishayaList.setVisibility(View.VISIBLE);
            }
            //yirmiyahu
            if (position == 7) {
                yirmiyahuList.setVisibility(View.VISIBLE);
            }
            //yechezkel
            if (position == 8) {
                yechezkelList.setVisibility(View.VISIBLE);
            }
            //trei-asaar
            if (position == 9) {
                treiasarList.setVisibility(View.VISIBLE);
            }
        }
    });

    ketuvimList = (ListView) findViewById(R.id.Ketuvim);
    ArrayAdapter<String> adapter4 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ketuvim);
    ketuvimList.setAdapter(adapter4);
    ketuvimList.setClickable(true);
    ketuvimList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            ketuvimList.setVisibility(View.GONE);
            //tehilim
            if (position == 0) {
                tehilimList.setVisibility(View.VISIBLE);
            }
            //mishlei
            if (position == 1) {
                mishleiList.setVisibility(View.VISIBLE);
            }
            //iyov
            if (position == 2) {
                iyovList.setVisibility(View.VISIBLE);
            }
            //shir hashirim
            if (position == 3) {
                shirList.setVisibility(View.VISIBLE);
            }
            //rut
            if (position == 4) {
                rutList.setVisibility(View.VISIBLE);
            }
            //eicha
            if (position == 5) {
                eichaList.setVisibility(View.VISIBLE);
            }
            //kohelet
            if (position == 6) {
                koheletList.setVisibility(View.VISIBLE);
            }
            //esther
            if (position == 7) {
                estherList.setVisibility(View.VISIBLE);
            }
            //daniel
            if (position == 8) {
                danielList.setVisibility(View.VISIBLE);
            }
            //ezra
            if (position == 9) {
                ezraList.setVisibility(View.VISIBLE);
            }
            //nechamya
            if (position == 10) {
                nechamyaList.setVisibility(View.VISIBLE);
            }
            //divrei hayamim alef
            if (position == 11) {
            }
            //divrei hayamim bet
            if (position == 12) {
            }
        }
    });
    bereshitList = (ListView) findViewById(R.id.Bereshit);
    ArrayAdapter<String> adapter5 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, bereshit);
    bereshitList.setAdapter(adapter5);
    bereshitList.setClickable(true);
    bereshitList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            scroll.setVisibility(View.VISIBLE);
            bereshitList.setVisibility(View.GONE);
            english.setVisibility(View.VISIBLE);
            hebrew.setVisibility(View.VISIBLE);
            if (position == 0) {
                hebrew.setText(getString(R.string.Bereshit1h));
                english.setText(getString(R.string.Bereshit1e));
            }
            if (position == 1) {
                hebrew.setText(getString(R.string.Bereshit2h));
                english.setText(getString(R.string.Bereshit2e));
            }
            if (position == 2) {
                hebrew.setText(getString(R.string.Bereshit3h));
                english.setText(getString(R.string.Bereshit3e));
            }
            if (position == 3) {
                hebrew.setText(getString(R.string.Bereshit4h));
                english.setText(getString(R.string.Bereshit4e));
            }
            if (position == 4) {
                hebrew.setText(getString(R.string.Bereshit5h));
                english.setText(getString(R.string.Bereshit5e));
            }
            if (position == 5) {
                hebrew.setText(getString(R.string.Bereshit6h));
                english.setText(getString(R.string.Bereshit6e));
            }
            if (position == 6) {
                hebrew.setText(getString(R.string.Bereshit7h));
                english.setText(getString(R.string.Bereshit7e));
            }
            if (position == 7) {
                hebrew.setText(getString(R.string.Bereshit8h));
                english.setText(getString(R.string.Bereshit8e));
            }
            if (position == 8) {
                hebrew.setText(getString(R.string.Bereshit9h));
                english.setText(getString(R.string.Bereshit9e));
            }

`我已经开始从模拟器中获取消息,说跳过了50帧!我的应用目前有45个适配器和45个列表视图。我一直试图建立的是一个菜单 - 首先它有3个选项,如果选择第一个,然后打开这些菜单,这将导致更多选项。就好像他们每个人都有一个孩子,但那个孩子有两个孩子的类比。在我使用的适配器中if语句来获取每个按钮的位置。某些适配器的某些if语句最多可以达到50个if语句,而有些只有10个。我应该为每个listview创建一个片段,以便它不仅仅在onCreate方法上运行吗?是不是我有很多字符串?

0 个答案:

没有答案