
How to use Toggle Button in Android from the best Training Institute
Create an Android Application name as ToggleButtonDemo.
Open activity_main.xml insert the each one Toggle Button and Button name as Submit.
After that come into MainActivity.java page. Create a global object for toggle and submit button.
And inside the onCreate method connect with the widget function to the java page like follow
then set the onClickListener for the submit button for when user click the submit button do some action behind the code on this event.
Next create a StringBuilder class and its object used to get the values whether the toggle button is on or off status.
StringBuilder result = new StringBuilder();
result.append(“TogguleButton :”).append(tbtn.getText().toString());
Toast.makeText(MainActivity.this, result, Toast.LENGTH_SHORT).show();
The string object “result” get the status of toggle button that will display using Toast widget. Then Click the run button or right click the project from project explore -> run as -> Android Application. The result will display in emulator.
Emulator shows the default first page of app like this.
After the click button when toggle is off the Toast result will display “ToggleButton: OFF” then click the Toggle button it will turn on then click again the click button result like “ToggleButton: ON”.
Thank you. This Android Application App designed & created by the XPLORE IT CORP Coimbatore.
http://recoverperu.org
Valuable information. Lucky me I found your site by accident, and I am shocked why this accident did not happened earlier! I bookmarked it. gckccccdbdeg
Howdy! I basically would like to give a huge thumbs up for the good data you’ve got here on this post. I will probably be coming once again to your weblog for far more soon. edkedebgeeccgaek
Im grateful for the blog article.Much thanks again. Cool. dgcgddeebeeg
very nice post, i certainly love this web site, keep on it edfkekddffffeade
Hello There. I found your blog using msn. This is a really well written article. Ill make sure to bookmark it and return to read more of your useful information. Thanks for the post. I will definitely return. bgadcebbeekc
I’m really impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the excellent quality writing, its rare to see a great blog like this one these days.. aacdaceeekeeeabe