0

I want to add a button on the home screen and want to code in the click event of that button. I have an application which has an activate button,As soon as this activate button is clicked i want that a Button gets created on the home screen and i want to code some database queries in its click event.I have already created that application,Now i want to place the button on the home screen.How do i do that.

Thanks in Anticipation.

skaffman
  • 390,936
  • 96
  • 800
  • 764
yashbinani
  • 287
  • 2
  • 10
  • 24

2 Answers2

1

I don't think you can create a button on the Home Screen on-the-fly by coding. In my book, the only way to get a button on the Home Screen is if the user adds it as a widget.

Espen
  • 3,479
  • 11
  • 45
  • 71
-1

If you are using xml layout for it add the button widget you needed and set it's visibility by android:visibility="gone",when you clicked the first button to activate the button to display,make it to visible by getting the id of the corresponding button for eg: btn2.setVisibility(View.VISIBLE);

Senthil Mg
  • 3,271
  • 4
  • 30
  • 49