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
  • 398,947
  • 96
  • 818
  • 769
yashbinani
  • 387
  • 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,607
  • 11
  • 48
  • 75
-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,301
  • 4
  • 32
  • 49