java - Is it possible to reduce number of pages in android? -


i making android app. app consist of list. clicking each item of list new page opens. list contains 50 items.i should make 50 activity , corresponding xml file. so, there way make process easier don't force me make 50 activity 1 one? reputation not enough. upload related picture. http://uupload.ir/files/oh1o_1.png http://uupload.ir/files/zam9_2.png

if have list of items means have list of objects of same kind same structure.

due this, have 50 pages show user same item different values variables, same structure.

you can make objects in list parcelable (refer this), pass intent second activity create, receive it, , @ last populate screen item passed.

if have troubles or doubts feel free ask :)

edit: imagine listview called listview, , list of items used fill listview called list in mainactivity this:

listview listview = (listview) findviewbyid(r.id.listview); listview.setonitemclicklistener(new onitemclicklistener() {       public void onitemclick(adapterview<?> parent, view view,           int position, long id) {           // position index of selected item           // launching new activity on selecting single list item           intent = new intent(mainactivity.this, secondactivity.class);           // sending data new activity           i.putextra("item", list.get(position));           startactivity(i);       }   }); 

in secondactivity, getparcelableextra("item") retreieve item clicked. here variables of item can populate page.

here doc intents.

in secondactivity, if must disappear if variable has value or null, play visibility or fragment: create activity case shown, work visibility or fragments , adjust ;)


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -