android - how to copy back button action to another button -


i have button in want have same feature of usual button. calling finish() not doing required.

i tried calling onbackpressed() needs create separate method. solution?

t1.setonclicklistener(new onclicklistener() {          @override         public void onclick(view arg0) {             // todo auto-generated method stub             /*intent i1=new intent(getapplicationcontext(), mainview.class);             startactivity(i1); */             //finish();              this.onbackpressed() ;          }       }); 

in code this.onbackpressed(); implies calling method of onclicklistener, not exists. instead call this:

your_activity_name.this.onbackpressed(); 

where your_activity_name name of activity.


Comments