So how you can do this ?
Ans: It's pretty simple!
Just find out the -- findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
It is generated by default in new android sdk. The bold portion is the touch listener for button which is implemented on bellow of your main activity class.
You can do your thing on overriden function OnTouch.
If you want to do it for click and many button here is the way --
findViewById(R.id.dummy_button).setOnClickListener(ButtonListener);
View.OnClickListener ButtonListener = new View.OnClickListener(){
public void onClick(View view) {
switch (view.getId()) {
case R.id.dummy_button:
setContentView(R.layout.newwindow);
break;
case R.id.dummy_button1:
setContentView(R.layout.newwindow1);
break;
case R.id.dummy_button2:
setContentView(R.layout.newwindow2);
break;
}
}
};
newwindow,
newwindow1,
newwindow2
are the layouts .
No comments:
Post a Comment