android - changing activity on sliding the screen -
i have 3 activities in application .
first 1 default activity when slide right left second activity should open layout , when slide left right third 1 should open layout want change activities on sliding not background or layout.. give me appropriate way this.
i m using tab view not giving slider functionality
public class tabdemo extends tabactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.tab_host); tabhost tabhost=gettabhost(); // no need call tabhost.setup() //first tab tabspec spec1=tabhost.newtabspec("activity 1"); spec1.setindicator("activity 1"); intent in1=new intent(this, activity 1); spec1.setcontent(in1); tabspec spec2=tabhost.newtabspec("activity 2"); spec2.setindicator("activity 2"); intent in2=new intent(this,activity 2); spec2.setcontent(in2); toast toast = toast.maketext(getapplicationcontext(), "welcome in resident center",toast.length_short); toast.show(); tabspec spec3=tabhost.newtabspec("activity 3"); spec3.setindicator("activity 3"); intent in3=new intent(this,activity 3); spec3.setcontent(in3); tabhost.addtab(spec1); tabhost.addtab(spec2); tabhost.addtab(spec3); tabhost.setcurrenttab(1); } }
simplest way create app swiping functionality in opinion create new android application via eclipse wizard following options selected:
- create
activity
-> blankactivity - navigation type = tabs + swipe
this create application (i think) 3 pages can swipe through. can check created files/code , change whatever want/need to.
and mentioned in comments answer, isn't possible activites
, need use fragments
!
Comments
Post a Comment