Posts

Showing posts with the label android

Create An Android Screaming App [SMS HotWord]

Image
In this post you will learn how to create an android app which will scream aloud no mater if the mobile is in silent or in general mode. This will work even if the app isnt in the open state. The screaming gets triggered when someone sends " scream " to your mobile as SMS. That is basically the hot word for triggering the screaming sound. Screenshots[Demo] The Code: The SMSReciever Broadcast Class: public class RecieveSMS extends BroadcastReceiver { public static final String SMS_BUNDLE = "pdus"; MediaPlayer mp; @Override public void onReceive(Context context, Intent intent) { Bundle intentExtras = intent.getExtras(); if (intentExtras != null) { Object[] sms = (Object[]) intentExtras.get(SMS_BUNDLE); for (int i = 0; i < sms.length; ++i) { SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) sms[i]); String smsBody = smsMessage.getMessa...

Create Brain Overdrive Game in Android

Image
This is yet another game like the 123Game . This game generates a single character which may be a Vowel, a Consonant, an Odd Number or may be an Even Number. The theme is you will get 3 seconds for each questions, you have to select the right option for it. If selected the right one then you will get 3 marks and the game gets over if u opt a wrong one ! Screenshots[Demo] The Code: For Generating Characters: void calc() { es="02468";os="13579";vs="AEIOU";ks="BCDFGHJKLMNPQRSTVWXYZ";k=""; Random rand=new Random(); k=k+es.charAt(rand.nextInt((4 - 0) + 1)); k=k+os.charAt(rand.nextInt((4 - 0) + 1)); k=k+vs.charAt(rand.nextInt((4 - 0) + 1)); k=k+ks.charAt(rand.nextInt((20 - 0) + 1)); String input=k; List<Character> characters = new ArrayList<Character>(); for(char c:input.toCharArray()){ characters.add(c); } StringBuilder output = new StringBuilder(input.length()); ...

Create 1+2=3 Android Game

Image
This post will guide you to create a highly interactive 1+2=3 Game. This game is based on a simple logic. Basically you have 3 number 1,2,3 which will be shuffled each time with a randomly generated operator ( +,-,*,/ ) placed in between. Screenshots: Lets go through important section of the project. Code for fetching Highscore : public int chec() { SQLiteDatabase SQLiteDb = mh.getWritableDatabase(); String [] col1 = {"_id","score"}; int ch=0; Cursor cu1 = SQLiteDb.query("scr", col1, null, null, null, null, null); while(cu1.moveToNext()) { ch=Integer.parseInt(cu1.getString(1)); } return ch; } Code For Generating Expression : void calc() { String st="123",op="+-*/",z="",y=""; p=0; Random rand=new Random(); for(int i=0;i<3;i++) z=z+st.charAt(rand.nextInt((2 - 0) + 1)); for(int i=0;i<2;i++) y=y+op.charAt(rand.nextInt((3 - 0) + 1)); switch(...

Create a Simple Color Picker Android App [Seekbar Support]

Image
This post will let you create a simple Color picker android application which will return the HEX code from the values set by R,G, and B labeled seekbars. In this application you can not only get the HEX value of the color generated but you can also set the color as the application background. This app is created by 3 seekbars and 1 EditText and 2 buttons. The value of the seekbars are extracted form the  getProgress() method. and the obtained values from R,G, and B are converted to hex using  toHexString() method and finally they are concatenated together for the HEX code of the RGB. Demo: The Hex Code generated when tapped on the generate Button The Background Color changes with corresponding value of Hex code when tapped on Set It  Lets have a glimpse on the basic concepts of the MainActivity.java Fetching values from the Seekbars r=sb1.getProgress(); g=sb2.getProgress(); b=sb3.getProgress(); Setting the value of the Hex Code box from ...

Create an app which can change Ringer mode through SMS

Image
Its been a common problem for all people, specially the young generation to locate their mobile when it's in Silent ringer mode. This app let you change your mobiles ringer mode through a SMS from some other mobile. Yes, you can trigger to general mode by just sending a HOT WORD from any mobile to your number. This app reads all your message and scans for that HOT WORD when found, performs operation with the AudioManager of your Android Smartphone. In this post, you will be guided how to create such application, not only that you can also extend its features by adding extra hot words. Basically all you need to know is about android Intent, which will be available soon on dProBuk. Well lets see some ScrrenShots. Checking The Current Mode Of The SmartPhone. No Background App Running, When received sms Vibrate, Changed to Vibrate mode Confrmed That Ringer Mode has changed ! Now Lets have a glance on the Important Sections of the Application: Code Snippet...

Create a simple app which reads out what you write

Image
In this post you will be guided to create a simple android application which reads out loud the text you write. This application uses Text To Speech (TTS) class. This is a basic application which has 1 EditText field and a single button. The EditText field is basically takes input and once you tap that button, it will read the entered text. This program uses your default TTS output voice. Demo: When tapped on Speak, It reads loudly "Hello I'm Sid". Implementing TTS Class: public class MainActivity extends Activity implements TextToSpeech.OnInitListener Overriding TTS onInit method: @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { int result = tts.setLanguage(Locale.US); if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { Log.e("TTS", "This Language is not supported"); } else { buttonSpeak.setEnabled(tru...

Build a Simple Contact Application With Calling Feature

Image
This post will help you to create your own Simple contact application which fetches all the contacts from the database and display it in a ListView. This actually accesses the contact database of the phone by a cursor adapter. Then it stores The name and the phone number associated in a listview using base adapter class. The basic function of this app is to call that number when clicked on a specific contact. Demo:   (a) The MainActivity, showing the List Of Contacts.              (b) When tapped, a call is placed by Intent. The Contact fetching code... public void addi() { Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null, null); while (phones.moveToNext()) { //get name and number from cursor using column index String name=phones.getString(phones.getColumnIndex( ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); ...

Build Simple Calculator with basic operations

Image
This is a Simple calculator android app which performs basic add, sub, mul and div operations. This app displays the result as well as stores the history which can be erased when desired. The digits of the calculator are basically buttons as well as the operators. The zip includes the source code of this application The MainActivity Of The Application Storing The Calculations in the History Finding the answer of the expression in the History You can download the whole project here . Found Bugs? Comment Them, we shall be glad to fix them ! :)

Build Simple Music Player With AlbumArt Support

Image
This is a sample music player app which has play, pause and seek features. This is just a basic music player with a little customization. This type of app is suitable for mini projects. This basic music player also displays the default album art of the selected song. The app basically scans your whole External SD card recursively and add the songs to a Listview using a BaseAdapter class. Main Activity showing the list of Songs present in the SD Card.   M2Activity, Playing the song clicked on the Main Activity. Understanding In Detailed The src folder contains 4 java classes, the MainActivity.java which performs the adding of the songs in the ListView, ListData.java is just a structure class which handles operations of Song Name and Song Path. MyBaseAdapter.java is a baseadapter implemented class and the last, M2Activity.java is the class which does the rest of the work, i.e playing the clicked song. You can find the .apk file which is located in the /Sampl...