link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>

Wednesday, June 11, 2014

Flashy the Flash Light: a tutorial to make your own flash light app Day 1


Hi Ya'll,
I'm going to be writing this AS i'm developing a very simple flashlight app that will turn on your phones LED so that you can see in the dark..  Are you afraid of the dark???

For this Tutorial, I'm going to assume that you know how to make a new android application.  So make one!! I'm naming mine flashy ;)  The layout will be very very simple because I'm more interested in teach you how to use the LED function

To start off go to your activity layout.  Flashy/res/layout/activity_flashy_main.xml (your's will most likely be something a little bit different.  Maybe even more creative.

First click on the toggle button icon and drag it to the screen. Then on the bottom left click on the activity.xml tab (next to 'Graphical Layout')







All we're going to do for now is change the size of the button so that it'll be easier to click on.  Were the code says (android:layout_width="wrap_content") lets change that to (android:layout_width="100dp").  Do the same thing to the height  (android:layout_height="100dp")

Your code should now look like this:


    




As far as the layout goes, that's pretty much it! Now lets move onto the android manifest file.  The first thing we want to do here is go into the code based tab.


On this page we are going to add 2 things: 1st being the the 'permission' so that we can use the LED feature.  add this code snippet right before '<application'





We're going to wait on the second thing for now so that I can show you exactly why we need to add it!

That's all for tonight ladies and gents.  I'll finish this tutorial up shortly, but in the mean time check out some of my apps :)       http://androiddabble.blogspot.com/2014/06/my-apps.html 

No comments:

Post a Comment