Android Programmerguru Screen Crack Prank PDF
Android Programmerguru Screen Crack Prank PDF
You must have already seen such applications in Google play Search this site
but creating one such application is really fun!!
Powered by Google
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Powered by Google
Let us start creating the application:
Either you can proceed with the below listings, or you can directly download code.
Create new android project [File >> New >> Android New Visitor? Like what you
read? Then do subscribe to
Project] with project name TapperApp Follow us on G+
our blog
Click next and select target android device version [I
chose version 2.2]
Subscribe
Click next and enter package name –
‘com.prgguru.android’ More Interesting Tutorials
Click finish
Layout creation:
We will create a simple layout which has one textview to display instructions and one button who is
the hero of ‘Screen Crack Prank’ app.
Main.xml:
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
23 android:layout_margin="20dip"
24 android:text="INSTRUCTIONS:\n\nTry to tap the button 100 times within 30 seconds.\n\nBest of Luck!"
25 android:id="@+id/blurb"/>
26
27 <Button
28 android:layout_width="wrap_content"
29
30
android:layout_height="wrap_content"
android:layout_margin="20dip"
Recent posts
31 android:padding="25dip"
32 android:text="100"
33 android:layout_gravity="center" Android Autocomplete Textview Example
34 android:id="@+id/button"/>
35 Android JSON Web Service Tutorial
36 </LinearLayout>
jQuery Examples
The application layout should look like:
Recent comments
Archives
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
We have to add few resources before we proceed with writing logic for the application. August 2012 (9)
Load cracked_screen.png (crack image) under /res/drawable-hdpi folder and glass.ogg (glass July 2012 (9)
breaking sound file) under /res/raw folder. If raw folder is not created, create one under /res folder. June 2012 (7)
Application logic:
TapperAppActivity.java:
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
35 //Create Random object
36 Random gen = new Random(); Text to Speech (1)
37 //If random value btwn (0 - 9)+1 equals to 10 or i is lesser than 50
38 if ((gen.nextInt(10) + 1 == 10) || (i<50)) { Toast (1)
39 //Call crack method
40 crack(); Vibrate service (1)
41 //Make listener to button as null
42 ((Button) v).setOnClickListener(null); Web Service (4)
43 }
44 } widget (4)
45 }
Button (2)
46
47 private void crack() { seekbar (1)
48 //Call audio effects method
49 audibleFX(); TextView (1)
50 //Call visual effects method
51 visualFX();
52 //Call vibrate effects method
53 touchFX();
54
55
} Stay in touch!
56 private void audibleFX() {
57 //Play sound file
58 mPlayer.start(); Email: Enter your email Subscribe
59 }
60
61 private void visualFX() {
62 //Set background with broken glass image
63 findViewById(R.id.background).setBackgroundResource(R.drawable.cracked_screen);
64 //Set title textview with color 0x6400ff00 Blog links
65 ((TextView)findViewById(R.id.title)).setTextColor(0x6400ff00);
66 //Set blurb textview with color 0x64ffffff
67 ((TextView)findViewById(R.id.blurb)).setTextColor(0x64ffffff);
Android Home
68 //Set button with color 0x64cdc9c9
69 ((Button)findViewById(R.id.button)).setBackgroundColor(0x64cdc9c9 Google Play
70 }
71 Java blog
72 private void touchFX() {
73 //Create vibrator object
74 Vibrator mv = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
75 //Vibrate for 500 MS
76
77 }
mv.vibrate(new long[]{ 0, 500, 0 }, -1);
About Me
78
79 protected void onDestroy() {
80 super.onDestroy(); Hi, welcome to Android Tutorial
81 // Release mediaplayer
82 if (mPlayer != null) { Blog. I am Udhay - a software
83 mPlayer.release(); engineer. Let me introduce myself
84 mPlayer = null;
85 } more formally, I’m a normal guy,
86 }
engineer by education who is
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
86 }
engineer by education who is
87 }
passionate about Programming and Internet.
Add vibrate permission in Androidmanifest.xml: Here I am writing about Android and lot about
1 <uses-permission android:name="android.permission.VIBRATE" /> developing simple android applications. Are you
new/beginner to Android programming and want
To know more about how to use vibration service in Android, see Android vibrate example
to join with me in the journey of learning Android
Demo: application development? You are in the right
Congratulations, We are done. place then :) Keep me posted with your valuable
Let us test the application: feedback and comments. Happy learning!
Right click on the project >> Run as >> Android application >> Choose emulator or device
Tap on the button and see what happens.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Entire project is zipped and is available for download. Unzip the downloaded
project and to import the project into eclipse, launch eclipse >> File >> Import.. >>
Choose downloaded project(How to import android project in eclipse). If you just
want to run the application in your mobile and see the output but don’t want to hit
your head with source code, download application(apk) file and install it in your
mobile device.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Android Autocom plete Android JSON Web How to call Java w eb How to call asp.net
Textview Exam ple Service Tutorial service in android w eb service in android
5 Comments
aravind
NOVEMBER 30, 2012
nice post
reply
Samuel
NOVEMBER 24, 2012
Hi I’ve followed your instruction and have recreated the app using Eclipse, only changing
minor bits such as the “android:text=” part into using a @string method (This was flagged
by Eclipse) and the file name of the main.xml
After finishing that I tried to run it on an emulator as well as my own Android device.
While at first it runs, it force quitted after playing the glass sound, without displaying the
cracked_glass png as well as any vibration.
I tried using your source code provided at the end of this guide and it works.
MrCleanX
OCTOBER 30, 2012
Great post! Great Blog! Just what I need to get rolling in Droid programming. Thanks, and
keep it up!
reply
Wiltshire
OCTOBER 19, 2012
My brother recommended I might like this blog. He was entirely right. This publish truly
made my day. You can not imagine just how a lot time I had spent for this information!
Thank you!
reply
g.gopikrishna
SEPTEMBER 25, 2012
how to remove ram memory in android device using java code or phonegap code .please
provide slolution for me
reply
Leave a Reply
Your email address will not be published. Required fields are marked *
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Name *
Email *
Website
Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym
title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q
cite=""> <strike> <strong>
Submit Comment
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com