0

Please i am having a disturbing issue about a listView java code that kept failing on compilation with error message about code too large.

I have this code below up to 800 on count. If i reduce the code to 600 the compilation will not fail. Please tell me what to do. I have 835 lists of song lyrics, This is my code below

                    //start NewActivity with title for actionbar and text for textview
                    Intent intent = new Intent(mContext, LyricsActivity.class);
                    intent.putExtra("actionBarTitle", "New songs 001");
                    intent.putExtra("contentTv", "The lyrics in full details");
                    mContext.startActivity(intent);


                }
                if (modellist.get(i).getTitle().equals("Song 002 | New ways of living")) {
                    //start NewActivity with title for actionbar and text for textview
                    Intent intent = new Intent(mContext, LyricsActivity.class);
                    intent.putExtra("actionBarTitle", "New songs 001");
                    intent.putExtra("contentTv", "he lyrics in full details");
                    mContext.startActivity(intent);
.
.
.
.
.
.
.
.
etc.. to 835 example codes of these examples above causes the error

Please help to me what to do so as to complete my songs. Thanks

Joseph
  • 400
  • 4
  • 19
  • 3
    You should not hardcode all songs in your java code, but instead learn how to create a database with songs content. Then learn how to load data from database to listview (or better - recyclerview). – wilddev Dec 10 '19 at 23:02
  • Please check this link. https://stackoverflow.com/questions/2407912/code-too-large-compilation-error-in-java – dilip Dec 11 '19 at 02:31
  • Can you help me with link to youtube tutorial Thanks a lot Sirs!! – Joseph Dec 11 '19 at 21:28

0 Answers0