Screen Crack Android App

Last modified on August 1st, 2014 by Joe.

Lets have some fun. All study and no play makes jack a dull boy. Let us create a quick android app and have some fun. How will it feel to crack your mobile screen? Let us create an android app to give that screen crack effect (visual and sound). Shall we jump direct to the steps and leave the gyan.

First step, we should create a layout with a image view with transparent background. This image view is for the broken screen effect. Source code for this layout is as follows,


<RelativeLayout xmlns:android=""
    tools:context=".MainActivity" >

        android:src="@drawable/screen_crack_transparent" />

It will be cool if we add some nice sound effect. The sound will be added with java class file by using the MediaPlayer class. We should use a nice sound file which mimics the sound when a glass cracks.

In a previous tutorial we have seen about how to play audio in android and that will come handy now.

Complete source code for the java class is shown below,


import android.os.Bundle;


public class MainActivity extends Activity {
	MediaPlayer objPlayer;

	protected void onCreate(Bundle savedInstanceState) {
		objPlayer = MediaPlayer.create(this,R.raw.breakingscreen);


Android Output

Android Screen Crack

By running this android app with your real mobile device you can have great fun, than in the emulator.

How to Test Run an Android App in Mobile?

  1. Install the driver needed to synchronize your PC and your mobile device. For example, HTC sync for HTC Explorer mobile phone.
  2. Connect the android mobile device with the PC.
  3. Select the connection type of the driver software needed for synchronization.
  4. Enable USB debugging by Setting->Applications->Development-> USB debugging.
  5. Set target to run application by Run Configuration->Target and then select option and then Apply->Run, as shown below.

Android Run

Comments on "Screen Crack Android App"

  1. S khan says:

    Hi Joe i need your help.would you know how to auto answer the call in android 3.0+

    please reply…………

  2. Anonymous says:

    its very nice and so simple thanks for posting

  3. Karesh says:

    Is it possible simulate some kind of vibration or shock along with this?

  4. satish says:

    Can you share the code ?

  5. kartik says:

    hello, where i can get the image screen_crack_transparent ?

  6. Rashi.. Coorg.. says:

    Nice one.. Thank u.. :)

  7. suresh says:

    Could u please Explain briefly hashcode-and-equals concept.

  8. Praveen S M says:

    Hash code and equals are overridden methods form the object class. These methods will be overridded when you want to get the hashcode of the object and equals method which returns boolean for comparing objects

  9. Praveen says:

    Very nyc

  10. Rajat says:

    Code not working
    and please please explain me this line–>
    objPlayer = MediaPlayer.create(this,R.raw.breakingscreen);

  11. varun says:

    Code not working
    and please please explain me this line–>
    objPlayer = MediaPlayer.create(this,R.raw.breakingscreen);

  12. Anonymous says:

    You are clearing my concepts & it helping me lot…Thanks

  13. Muzamal says:

    can we add shocking music are vibrating in it?

  14. Joe says:

    Yes Muzamal, sure thats possible. Shortly I will add that code too.

  15. bhavesh says:

    how to get this example code..

Comments are closed for "Screen Crack Android App".