ANDROID Random heroes Apk all devices qvga wvga hvga wsvga

Download ANDROID Random heroes

http://androidgamesofworld.blogspot.com/
Random heroes A group of heroes have to save the world. Monsters from another dimension try to seize the Earth. Run, jump and destroy monsters. Collect coins for modernization of your weapon and purchase of new regimentals.

Features:
  • More than 40 levels
  • 24 symbols
  • 17 types of weapon
  • Various achievements

Android 2.2 and higher. [15.2 MB][apk] Download Here
Read More..

Free Download com ea games simsfreeplay row 1005014

com ea games simsfreeplay row 1005014

Type : apk
Size : 26 MB
Artis :
Apk Games
Rating :






Similar Post




Description


com ea games simsfreeplay row get on 4-shared.eu search engine - com ea games simsfreeplay row Adreno,com ea games simsfreeplay row,com ea games simsfreeplay row ...,Ea Games Android Apk get from FileCrop.com, Mediafire Hotfile and Rapidshare files. ... com.ea.games.simsfreeplay row PowerVR.rar: 318,35 MB:,Ea Games Apk for Android, Ea Games Apk get from FileCrop.com, Mediafire Hotfile and Rapidshare files. ... com.ea.games.simsfreeplay row Adreno.rar: 321,02 MB:,The Sims FreePlay EA Swiss Sarl. Top Developer (396,704) Install. Overview; User Reviews; ... Get inside EA info on great deals, plus the latest game updates, ...,com ea games meinfiltrator row part2 com ea games meinfiltrator row part2 Uploaded by Indowebster Desktop Uploader v ... com ea games simsfreeplay row Adreno by xtrymind,Com Ea Games Simsfreeplay Row Adreno - com ea games r3 na apk, com ea games meinfiltrator row rar, com ea games simsfreeplay row rar,,com.ea.games.simsfreeplay_row-1003003 get from 4shared Files Photo Music Books Video Games. Sign ...,Size: 321.02 MB | Server: 86 | Tags: | Statistic: 37 views, 5 gets | Last viewed: 29 May 2013 Description: com ea games simsfreeplay row Adreno Uploaded By IDWS ...,com.ea.games.simsfreeplay-row-1005014.apk File size: 25.67 Mb | Last checked: 12 Aug 2012: Download Great Big War Game v1.1.1.apk File size: 7 ...,... com ea games simsfreeplay row 1003003,com ea games simsfreeplay row 1003003,com ea game realracing2. ... com ea games simsfreeplay row 1005014.


Search Result


Ea games apk - Download - FilesTube - Files Search Engine, Search ...
... com ea games simsfreeplay row 1003003,com ea games simsfreeplay row 1003003,com ea game realracing2. ... com ea games simsfreeplay row 1005014.

apk games - RooMyShare.com - Most Popular
com.ea.games.simsfreeplay-row-1005014.apk File size: 25.67 Mb | Last checked: 12 Aug 2012: Download Great Big War Game v1.1.1.apk File size: 7 ...

com ea games simsfreeplay row Adreno - Indowebster.com
Size: 321.02 MB | Server: 86 | Tags: | Statistic: 37 views, 5 gets | Last viewed: 29 May 2013 Description: com ea games simsfreeplay row Adreno Uploaded By IDWS ...

com.ea.games.simsfreeplay_row-1003003 - Download - 4shared
com.ea.games.simsfreeplay_row-1003003 get from 4shared Files Photo Music Books Video Games. Sign ...

Com Ea Games Simsfreeplay Row Adreno get - 1982930 files
Com Ea Games Simsfreeplay Row Adreno - com ea games r3 na apk, com ea games meinfiltrator row rar, com ea games simsfreeplay row rar,

com ea games meinfiltrator row part2 - Indowebster.com
com ea games meinfiltrator row part2 com ea games meinfiltrator row part2 Uploaded by Indowebster Desktop Uploader v ... com ea games simsfreeplay row Adreno by xtrymind

The Sims FreePlay - Android Apps on Google Play
The Sims FreePlay EA Swiss Sarl. Top Developer (396,704) Install. Overview; User Reviews; ... Get inside EA info on great deals, plus the latest game updates, ...

Ea Games Apk - Download - FileCrop - Search and Download ...
Ea Games Apk for Android, Ea Games Apk get from FileCrop.com, Mediafire Hotfile and Rapidshare files. ... com.ea.games.simsfreeplay row Adreno.rar: 321,02 MB:

Ea Games Android Apk - Download - FileCrop - Search and Download ...
Ea Games Android Apk get from FileCrop.com, Mediafire Hotfile and Rapidshare files. ... com.ea.games.simsfreeplay row PowerVR.rar: 318,35 MB:

Com ea games simsfreeplay row - free get 4shared - (3 files)
com ea games simsfreeplay row get on 4-shared.eu search engine - com ea games simsfreeplay row Adreno,com ea games simsfreeplay row,com ea games simsfreeplay row ...


Read More..

New Download Asphalt 5 apk datos sd

Asphalt 5 (apk + datos sd)

Type : rar
Size : 102 MB
Artis :
Apk Mediafire
Rating :






Similar Post




Description


Money Making - Asphalt 6 Adrenaline Android QVGA, HVGA, APK Y Datos SD - HowToMakeOnline.org,Asphalt 5 apk sd free get - Asphalt 5 (apk + datos sd),System App,Watching ASPHALT 6 Adrenaline HD apk + Datos sd on GameTVOnline. GameTVOnline is your source for the latest videos game trailers, xbox video reviews, gameplay videos,,Asphalt 5 apk free get - Asphalt 5 (apk + datos sd),Asphalt 5 Apk V3 2 1,Asphalt 5 APK,asphalt 5 apk+datos sd get from 4shared ... asphalt 5 apk+datos sd - get at 4shared. asphalt 5 apk+datos sd is hosted at free file sharing service 4shared.,Asphalt 5 (apk + datos sd).rar [info] Aplicaciones y Juegos - Taringa! Download from Mediafire.com:,http://www.4shared.com/rar/6GSWQw4g/a... gracias por ver el video jajajaja,asphalt 5 apk+datos sd.rar: 102,12 MB: http://www.yo... 0: ASPHALT 5.apk: 4,75 MB: http://rappel... 0: Asphalt 5.apk: 4,75 MB: http://identi... 0: Asphalt 5 HVGA v3.4 ...,::http://www.filestube.com/erfAvFArzTaeQbaKvSGiGB#af=518360870638f:: http://adf.ly/Dl84Q E-mail: AndroideWTF@gmail.com Visita mi Nuevo Blog: http://androidewtf.blogspot.com/ "instalar asphalt 5""asphalt gama media ...,


Search Result


Asphalt 5 ( apk + datos sd) crix2


Asphalt 5 Para Android | Datos SD + APK - YouTube
::http://www.filestube.com/erfAvFArzTaeQbaKvSGiGB#af=518360870638f:: http://adf.ly/Dl84Q E-mail: AndroideWTF@gmail.com Visita mi Nuevo Blog: http://androidewtf.blogspot.com/ "instalar asphalt 5""asphalt gama media ...

Asphalt 5.apk - Download - FileCrop - Search and Download ...
asphalt 5 apk+datos sd.rar: 102,12 MB: http://www.yo... 0: ASPHALT 5.apk: 4,75 MB: http://rappel... 0: Asphalt 5.apk: 4,75 MB: http://identi... 0: Asphalt 5 HVGA v3.4 ...

descargar e instalar asphalt 5 para android apk+datos sd - YouTube
http://www.4shared.com/rar/6GSWQw4g/a... gracias por ver el video jajajaja

Downloading - Asphalt 5 (apk + datos sd) rar
Asphalt 5 (apk + datos sd).rar [info] Aplicaciones y Juegos - Taringa! Download from Mediafire.com:

asphalt 5 apk+datos sd - Download - 4shared - cris Larios Corona
asphalt 5 apk+datos sd get from 4shared ... asphalt 5 apk+datos sd - get at 4shared. asphalt 5 apk+datos sd is hosted at free file sharing service 4shared.

Asphalt 5 apk - Download
Asphalt 5 apk free get - Asphalt 5 (apk + datos sd),Asphalt 5 Apk V3 2 1,Asphalt 5 APK

ASPHALT 6 Adrenaline HD apk + Datos sd - Video ejhpRdyBvEc ...
Watching ASPHALT 6 Adrenaline HD apk + Datos sd on GameTVOnline. GameTVOnline is your source for the latest videos game trailers, xbox video reviews, gameplay videos,

Asphalt 5 apk sd - Download - FilesTube - Files Search Engine ...
Asphalt 5 apk sd free get - Asphalt 5 (apk + datos sd),System App

Asphalt 6 Adrenaline Android QVGA, HVGA, APK Y Datos SD | How To ...
Money Making - Asphalt 6 Adrenaline Android QVGA, HVGA, APK Y Datos SD - HowToMakeOnline.org


Read More..

DEAD TRIGGER 2 v0 02 2 MOD APK DATA Unlimited MONEY for Gingerbread 2 3

Dead Trigger 2 MOD APK+DATA FILES
Dead Trigger 2 for Gingerbread 2.3+

Whats New: v0.02.2
Gameplay Balancing
* Kamikadze - Decrease Damage done by explosion
* Infectator - Lowered aiming capability
* Berserker - Decrease HP
* ScientFist - Balanced radioactivity damage
* Zombies difficulty was rebalanced
* Several missions were rebalanced
BugFixing
* Samsung S III and S IV crashes fixed
* Broken fonts fixed
* Produced chain-saw is visible in Inventory
* Inactive boosters is not visible anymore
* Pain-Killer upgrade works correctly

Requires Android: 2.3 and Up

Version: 0.02.2

PLAY LINK: DEAD TRIGGER 2

Whats In The Rar File:
1)MOD APK (Unlimited Money and Ammo) Requires Android 2.3+
2)NORMAL APK(Original From PLAY STORE) Requires Android 2.3+
3)Data Files

Download Links:
TusFiles:

HUGEFILES:
Read More..

Racing Moto 1 2 0 Android Game Apk Free Download

Racing Moto 1.2.0
Requirements: Android 2.1 or higher
Overview: Fast paced racing game! You never dare drive so fast in the real world!
Racing Moto is a fast paced racing game. You never dare drive so fast in the real world! Control your moto with incredible fast speed during traffic rush time! Also enjoy beautiful view during the journey - desert, city, bridge, sea and forest!

More Info:
Intuitive game rules:
# Tilt phone to control moto direction
# Tap screen to accelerate

Tips to win high score:
# Keep accelerating moto so that the score will be boosted. The boost factor is shown on the right top of the screen.
# Watch out indicator light. Vehicles may turn left or right.


Enjoy feeling super speedy moto racing! Please give us your feedback, rate or comment if you like this game!


Code:

https://play.google.com/store/apps/details?id=com.droidhen.game.racingmoto&feature=search_result#?t=W251bGwsMSwyLDEsImNvbS5kcm9pZGhlbi5nYW1lLnJhY2luZ21vdG8iXQ..

Download Instructions:
http://rapidgator.net/file/22538389/...e.APk.rar.html
http://1hostclick.com/81qj9hjq3wts/R...e.APk.rar.html
Read More..

Onet Fruit apk android lounge blogspot com

Onet Fruit apk
Onet Fruit apk

Current Version : 1.5.1
Requires Android : 2.2 and up
Category : Brain And Puzzle
Size : 1.3M





Recommended Links

  • ebay.com
  • half.com
  • store.apple.com

Description

An addictive image matching game. Play all three levels and master your consentration.


Videos


Search Result

Fruit Ninja THD.apk works on all version of ANdroid Adfree Apk Download For Android + IPA Fruit Ninja, one of the most popular smartphone game ever made ,Fruit Ninja Apk is a juicy action game with squishy, splatty and satisfying fruit carnage! Become the ultimate bringer of sweet, tasty destruction with every slash.,Questions : fruit ninja 1.7.6 apk get, get fruit ninja apk android. Fruit Ninja is one of the most popular android game in android market, ,Fruit Ninja Thd 1.2.0 .apk for Android, Fruit Ninja Thd 1.2.0 .apk get from FileCrop.com, Mediafire Hotfile and Rapidshare files.,Onet Fruit.apkFruit Pop! 1.2.12,Fruit Ninja 1.7.13,Fruit Heroes 2.1,Fruit Devil 1.01,Fruit Slice 1.4.4 ,,Download and install Onet Fruit - Free Game for Android - Download Onet Fruit.apk (com.grafian.onet),FRUIT BOMB IS COMING! Fruit Bomb one of the most entertaining and addictive puzzle games for your Android phone! Simply Click one fruit, all fruits of ,game onet fruit apk Download Crack, full free get, game onet fruit apk torrent get, Software with crack serial - Rapidshare Mediafire keygen - , and free ,Free Download Game Onet Fruit Apk For Android yang dipublikasikan pada 7 July 2013 pukul 18:22 WIB dan merupakan bagian dari informasi mengenai free get game ,Onet Fruit Apk yang dipublikasikan pada 1 July 2013 pukul 18:23 WIB dan merupakan bagian dari informasi mengenai onet fruit apk. Buka artikel terbaik lainnya yang

Read More..

One Piece ARCarddass Formation v1 01 Android Game Apk Free Download

One Piece ARCarddass Formation v1.01 by Namco-Bandai
Requirements:Android 2.2+


*Points of caution
・Supporting Device: L-01D(optimus LTE),GALAXY S(SC-02B),Xperia acro(SO-02C),GALAXY SⅡ(SC-02C),htc EVO 3D(ISW12HT)
(To use this App, you need to update to Android OS 2.2 or later.)
■One Piece AR Carddass Formation (Ver1.0.1)
Scan the AR(Augmented Reality) marker printed on the back of the card, and characters pop up!
In addition, scan the unique Card ID on the back of the card to register the character into Digital Binder in app, and a player can use the character for battle!!
Use three registered characters to form the 3-men team, now you are ready for challenging a super-strong BOSS!


This is an exclusive application with which you can scan and play with trading cards from “One Piece AR Carddass Formation”, to be released by Bandai on June 22nd 2012.
To get the most out of this App, you need “One Piece AR Carddass Formation” cards.
*If you do not have any cards at hand, you can also use round objects like coins to battle with Zoro or to make use of the collection function by gathering items from treasure boxes.
*When using a round objects like coins, please select [Coin AR] from [AR Scan] on the main menu, which is displayed on the right hand side of the HOME screen.
Check out more detailed information on the “One Piece AR Carddass Formation” at Official Homepage!
http://AR.carddas.com/


More info:
https://play.google.com/store/apps/d...FyY2FyZF93dyJd

Download Instructions:
Download all parts and extract the apk
http://www.mediafire.com/?pykk1c272vcvbmq part1
http://www.mediafire.com/?z85iivw4iu74u5p part2
http://www.mediafire.com/?pmuup35q3d7stve part3

Notes:
This apk is as big as cow(406mb) ,please make sure your device have enough space to install the apk.
Installation may takes 10 minutes or more,so be patient and wait,do keep the screen awake to prevent the app not installed problem.supports app2sd after installed.
*First run may needs internet connection*

ARcard collections:
http://www.mediafire.com/?a8ovnobibloz9a1

Gameplay video on my M7:
<iframe class="restrain c15" frameborder="0" height="390" id="yui-gen0" src="http://www.youtube.com/embed/DoVB7x7T414?wmode=opaque" title="YouTube video player" width="640" name="yui-gen0">></iframe>

Read More..

Downloads Descargas APK Taringa

Descargas APK Taringa

Type : txt
Size : 0 B
Artis :
Apk Mediafire
Rating :






Similar Post




Description


provide info about Descarga Z4root Android Taringa. read full post about Descarga Z4root Android Taringa at balah.info /> http ... [full apk] [1 link] - taringa!, ...,If you searching for Descargar Pou Apk Mediafire Taringa, you come to the right place. Here you can read or get Descargar Pou Apk Mediafire Taringa directly from ...,audio gur apk descarga taringa Download Crack, full free get, audio gur apk descarga taringa torrent get, Software with crack serial - Rapidshare Mediafire ...,We would like to show you a description here, but the site youre looking at wont allow us.,Bienvenidos a la comunidad para nuestros telefonos LG-P350 Optimus ME, en esta comunidad puedes postear tus dudas, compartir juegos, aplicaciones, etc. de tus post ...,If you searching for Taringa Descargar Doubletwist Pro Apk Gratis, you come to the right place. Here you can read or get Taringa Descargar Doubletwist Pro Apk ...,If you searching for Sygic Apk Descarga Taringa, you come to the right place. Here you can read or get Sygic Apk Descarga Taringa directly from the official website.,Comunidad N° 1 de Taringa a nivel global. Esta comunidad se basa en el sistema operativo Android, donde consultamos, aportamos, respondemos y aprendemos todo sobre ...,Taringa Descargas Gratis, una comunidad libre para crear ideas colectivas, tu portal de descargas de programas. ... Pocket Girlfriend v1.29 [APK] [Android] [ZS],Taringa Descargas. Inicio | Imagenes Gratis. Twittear. Principal; Musica; Peliculas; Juegos; ... Descarga una parte de cada servidor para descargar todas a la vez, ...


Search Result


Taringa Juegos, Peliculas, Musica y Programas Descargar Gratis
Taringa Descargas. Inicio | Imagenes Gratis. Twittear. Principal; Musica; Peliculas; Juegos; ... Descarga una parte de cada servidor para descargar todas a la vez, ...

Taringa Descargas Gratis
Taringa Descargas Gratis, una comunidad libre para crear ideas colectivas, tu portal de descargas de programas. ... Pocket Girlfriend v1.29 [APK] [Android] [ZS]

(aporte) Merkamarket descargas apk gratis - Taringa!
Comunidad N° 1 de Taringa a nivel global. Esta comunidad se basa en el sistema operativo Android, donde consultamos, aportamos, respondemos y aprendemos todo sobre ...

Sygic Apk Descarga Taringa - Apps, Games, Launcher, Widget
If you searching for Sygic Apk Descarga Taringa, you come to the right place. Here you can read or get Sygic Apk Descarga Taringa directly from the official website.

Taringa Descargar Doubletwist Pro Apk Gratis - Apkforandroids.com
If you searching for Taringa Descargar Doubletwist Pro Apk Gratis, you come to the right place. Here you can read or get Taringa Descargar Doubletwist Pro Apk ...

(Info) Paginas para descargar APK - Taringa!
Bienvenidos a la comunidad para nuestros telefonos LG-P350 Optimus ME, en esta comunidad puedes postear tus dudas, compartir juegos, aplicaciones, etc. de tus post ...

neetdescargas.com
We would like to show you a description here, but the site youre looking at wont allow us.

audio gur apk descarga taringa get serial, crack keygen ...
audio gur apk descarga taringa Download Crack, full free get, audio gur apk descarga taringa torrent get, Software with crack serial - Rapidshare Mediafire ...

Descargar Pou Apk Mediafire Taringa - Apkforandroids.com
If you searching for Descargar Pou Apk Mediafire Taringa, you come to the right place. Here you can read or get Descargar Pou Apk Mediafire Taringa directly from ...

Descarga Z4root Android Taringa | Android App, Android Smartphone ...
provide info about Descarga Z4root Android Taringa. read full post about Descarga Z4root Android Taringa at balah.info /> http ... [full apk] [1 link] - taringa!, ...


Read More..

Runtastic PRO v3 1 4 3 1 4 Android App Apk Free Download


Runtastic PRO v3.1.4 Android Application



Recommended device requirements:

Requires Android : 2.1 and up






  • Voice feedback during a workout: Get audio feedback for each mile or kilometer

  • Live tracking: Show your friends and family where you are

  • Cheering: Hear cheers and receive messages live from your friends and be motivated to go even further

  • Heart rate support: runtastic chest strap

  • Split table with dynamic mile and kilometer split

  • Calorie goal: Set a specific calorie goal and use the voice feedback to reach your workout goal

  • Pace goal: Define your favorite pace

  • Geotagging: Take pictures during a workout and see these pictures online at your map trace

  • Weather and Temperature: Receive live weather information and save weather data automatically after a workout

  • Prediction of sunset and sunrise


  • Map your workouts in real-time with built-in GPS and monitor your progress (time, distance, speed, pace, calories, altitude, etc.)

  • Personal workout diary and metrics

  • Mapping: Detailed live mapping and historic mapping of previous sessions (Google maps)

  • Dashboard configuration: Display preferred statistics

  • Graphs: Get charts with altitude, pace, speed and heart rate information

  • Performance analysis with lap times

  • Enjoy your workouts with the integrated music player

  • Set goals for time and distance

  • Accurate calculation of elevation gain and loss

  • Manual entry of workouts: Add treadmill, spinning and weightlifting workouts

  • Monthly and overall metrics for distance, number of workouts, duration and calories

  • Share your success on Facebook and Twitter

Read More..

Save state of ActionBar visibility

Last exercise demonstrate how to "Show and hide ActionBar using Java code". But, once configuration changed (such as orientation change), ActionBar will return to setting in AndroidManifest.xml. To resume the user set visibility of ActionBar, we can save it in onSaveInstanceState() and restore it in onCreate().

Please notice that it can save state for configuration change only: if the app is killed or finished, then re-started, it will return to AndroidManifest.xml set visibility.

Save state of ActionBar visibility


package com.example.androidactionbar;

import android.os.Bundle;
import android.app.ActionBar;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button buttonToggleActionBar = (Button)findViewById(R.id.toggleactionbar);
buttonToggleActionBar.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {
ActionBar myActionBar = getActionBar();
boolean myActionBarisShowing = myActionBar.isShowing();
if(myActionBarisShowing){
myActionBar.hide();
Toast.makeText(getApplicationContext(),
"Hide ActionBar",
Toast.LENGTH_LONG).show();
}else{
myActionBar.show();
Toast.makeText(getApplicationContext(),
"Show ActionBar",
Toast.LENGTH_LONG).show();
}
}});

Button buttonFinish = (Button)findViewById(R.id.finish);
buttonFinish.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
finish();
}});

if (savedInstanceState != null) {
Boolean savedActionBarisShowing =
savedInstanceState.getBoolean("KEY_ACTIONBAR_ISSHOWING", true);
if(savedActionBarisShowing){
getActionBar().show();
}else{
getActionBar().hide();
}
}
}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean("KEY_ACTIONBAR_ISSHOWING", getActionBar().isShowing());
}

}


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:id="@+id/toggleactionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Toggle ActionBar" />
<Button
android:id="@+id/finish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="finish()" />

</LinearLayout>


Read More..

More example of Synchronized Statements with separate objects for locking

Last example compare between Synchronization with single lock object and separate lock objects, one-on-one; one thread access one object and another object access another object. This example demonstrate a more complicated case, two threads access one object, and other two thread access another object.

Synchronized Statements with single object, this.
package com.example.androidthread;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.app.Activity;

public class MainActivity extends Activity {

Button buttonStart;
TextView textInfoA, textInfoB, textInfoC, textInfoD;
TextView textDuration1, textDuration2;
TextView textDuration3, textDuration4;

String infoMsgA;
String infoMsgB;
String infoMsgC;
String infoMsgD;

ShareClass shareObj = new ShareClass(10);
long startingTime;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonStart = (Button) findViewById(R.id.buttonstart);
textInfoA = (TextView) findViewById(R.id.infoa);
textInfoB = (TextView) findViewById(R.id.infob);
textInfoC = (TextView) findViewById(R.id.infoc);
textInfoD = (TextView) findViewById(R.id.infod);
textDuration1 = (TextView) findViewById(R.id.duration1);
textDuration2 = (TextView) findViewById(R.id.duration2);
textDuration3 = (TextView) findViewById(R.id.duration3);
textDuration4 = (TextView) findViewById(R.id.duration4);

buttonStart.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

infoMsgA = "Thread A
";
infoMsgB = "Thread B
";
infoMsgC = "Thread C
";
infoMsgD = "Thread D
";
textInfoA.setText(infoMsgA);
textInfoB.setText(infoMsgB);
textInfoC.setText(infoMsgC);
textInfoD.setText(infoMsgD);

Thread thread1 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter1() > 0) {

//caution:
//shareObj.counter1 may change here

infoMsgA += "A 1: "
+ shareObj.delayDecCounter1(500) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoA.setText(infoMsgA);
}

});

} else {
stop = true;
final long endTime1 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration1.setText("Duration 1 (reference only): "
+ (endTime1 - startingTime));
}

});
}
}
}
});

Thread thread2 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter2() > 0) {

//caution:
//shareObj.counter2 may change here

infoMsgB += "B 2: "
+ shareObj.delayDecCounter2(500) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoB.setText(infoMsgB);
}

});

} else {
stop = true;
final long endTime2 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration2.setText("Duration 2 (reference only): "
+ (endTime2 - startingTime));
}

});
}
}
}
});

//
Thread thread3 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter1() > 0) {

//caution:
//shareObj.counter1 may change here

infoMsgC += "C 1: "
+ shareObj.delayDecCounter1(200) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoC.setText(infoMsgC);
}

});

} else {
stop = true;
final long endTime3 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration3.setText("Duration 3 (reference only): "
+ (endTime3 - startingTime));
}

});
}
}
}
});

Thread thread4 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter2() > 0) {

//caution:
//shareObj.counter2 may change here

infoMsgD += "D 2: "
+ shareObj.delayDecCounter2(1100) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoD.setText(infoMsgD);
}

});

} else {
stop = true;
final long endTime4 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration4.setText("Duration 4 (reference only): "
+ (endTime4 - startingTime));
}

});
}
}
}
});
//

startingTime = System.currentTimeMillis();
thread1.start();
thread2.start();
thread3.start();
thread4.start();
}
});

}

public class ShareClass {

int counter1;
int counter2;

Object lock1;
Object lock2;

ShareClass(int c) {
counter1 = c;
counter2 = c;
lock1 = new Object();
lock2 = new Object();
}

public int getCounter1() {
return counter1;
}

public int getCounter2() {
return counter2;
}

public int delayDecCounter1(int delay) {

//do something not access the share obj
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

synchronized (this) {
int tmpCounter = counter1;

try {
Thread.sleep(delay);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

tmpCounter--;
counter1 = tmpCounter;

return counter1;
}

}

public int delayDecCounter2(int delay) {

//do something not access the share obj
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

synchronized (this) {
int tmpCounter = counter2;

try {
Thread.sleep(delay);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

tmpCounter--;
counter2 = tmpCounter;

return counter2;
}

}
}

}



Synchronized Statements with separate objects, lock1 and lock2.
package com.example.androidthread;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.app.Activity;

public class MainActivity extends Activity {

Button buttonStart;
TextView textInfoA, textInfoB, textInfoC, textInfoD;
TextView textDuration1, textDuration2;
TextView textDuration3, textDuration4;

String infoMsgA;
String infoMsgB;
String infoMsgC;
String infoMsgD;

ShareClass shareObj = new ShareClass(10);
long startingTime;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonStart = (Button) findViewById(R.id.buttonstart);
textInfoA = (TextView) findViewById(R.id.infoa);
textInfoB = (TextView) findViewById(R.id.infob);
textInfoC = (TextView) findViewById(R.id.infoc);
textInfoD = (TextView) findViewById(R.id.infod);
textDuration1 = (TextView) findViewById(R.id.duration1);
textDuration2 = (TextView) findViewById(R.id.duration2);
textDuration3 = (TextView) findViewById(R.id.duration3);
textDuration4 = (TextView) findViewById(R.id.duration4);

buttonStart.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

infoMsgA = "Thread A
";
infoMsgB = "Thread B
";
infoMsgC = "Thread C
";
infoMsgD = "Thread D
";
textInfoA.setText(infoMsgA);
textInfoB.setText(infoMsgB);
textInfoC.setText(infoMsgC);
textInfoD.setText(infoMsgD);

Thread thread1 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter1() > 0) {

//caution:
//shareObj.counter1 may change here

infoMsgA += "A 1: "
+ shareObj.delayDecCounter1(500) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoA.setText(infoMsgA);
}

});

} else {
stop = true;
final long endTime1 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration1.setText("Duration 1 (reference only): "
+ (endTime1 - startingTime));
}

});
}
}
}
});

Thread thread2 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter2() > 0) {

//caution:
//shareObj.counter2 may change here

infoMsgB += "B 2: "
+ shareObj.delayDecCounter2(500) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoB.setText(infoMsgB);
}

});

} else {
stop = true;
final long endTime2 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration2.setText("Duration 2 (reference only): "
+ (endTime2 - startingTime));
}

});
}
}
}
});

//
Thread thread3 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter1() > 0) {

//caution:
//shareObj.counter1 may change here

infoMsgC += "C 1: "
+ shareObj.delayDecCounter1(200) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoC.setText(infoMsgC);
}

});

} else {
stop = true;
final long endTime3 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration3.setText("Duration 3 (reference only): "
+ (endTime3 - startingTime));
}

});
}
}
}
});

Thread thread4 = new Thread(new Runnable() {

boolean stop = false;

@Override
public void run() {

while (!stop) {
if (shareObj.getCounter2() > 0) {

//caution:
//shareObj.counter2 may change here

infoMsgD += "D 2: "
+ shareObj.delayDecCounter2(1100) + "
";

MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textInfoD.setText(infoMsgD);
}

});

} else {
stop = true;
final long endTime4 = System.currentTimeMillis();
MainActivity.this.runOnUiThread(new Runnable() {

@Override
public void run() {
textDuration4.setText("Duration 4 (reference only): "
+ (endTime4 - startingTime));
}

});
}
}
}
});
//

startingTime = System.currentTimeMillis();
thread1.start();
thread2.start();
thread3.start();
thread4.start();
}
});

}

public class ShareClass {

int counter1;
int counter2;

Object lock1;
Object lock2;

ShareClass(int c) {
counter1 = c;
counter2 = c;
lock1 = new Object();
lock2 = new Object();
}

public int getCounter1() {
return counter1;
}

public int getCounter2() {
return counter2;
}

public int delayDecCounter1(int delay) {

//do something not access the share obj
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

synchronized (lock1) {
int tmpCounter = counter1;

try {
Thread.sleep(delay);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

tmpCounter--;
counter1 = tmpCounter;

return counter1;
}

}

public int delayDecCounter2(int delay) {

//do something not access the share obj
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

synchronized (lock2) {
int tmpCounter = counter2;

try {
Thread.sleep(delay);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

tmpCounter--;
counter2 = tmpCounter;

return counter2;
}

}
}

}


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold" />

<Button
android:id="@+id/buttonstart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="start()" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<TextView
android:id="@+id/infoa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />

<TextView
android:id="@+id/infob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />

<TextView
android:id="@+id/infoc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />

<TextView
android:id="@+id/infod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>

<TextView
android:id="@+id/duration1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/duration2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/duration3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/duration4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</LinearLayout>




- More example about Thread

Read More..

C code to implement Link list with all operations

This program will show how to:

1. Append element at the end of link list
2. Concatenate two link lists
3. Free all nodes in a link list
4. Reverse a link list
5. Delete last element of link list
6. Delete nth element of link list
7. Combine two ordered link list into single ordered link list
8. Find union of two link lists
9. Find intersection of two link lists
10. Insert after nth element in a link list
11. Delete every second element of a link list
12. Place elements in order in a link list
13. Calculate sum of data of a link list
14. calculate number of elements in a link list
15. Make second copy of a link list
16. Move node forward to nth positions in a link list

#include <stdio.h>
#include <conio.h>

typedef struct node{
int info;
struct node *link;
}NODE;
 
NODE* create(NODE *start)//for creating a list
{
 NODE *temp,*t;
 int n,i;
 printf("Enter no of nodes you want to insert:");
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  temp=(NODE*) malloc(sizeof(NODE));
  printf("Enter data for node %d:",i+1);
  scanf("%d",&temp->info);
  temp->link=NULL;
  if(start==NULL) 
   start=temp;
  else
  {
   t=start;
   while(t->link!=NULL)
    t=t->link;
   t->link=temp;
  }
 }
 return start;
}

void disp(NODE *start)//for printing a list
{
 NODE *t;
 printf("
Elements of the list:");
 for(t=start;t!=NULL;t=t->link)
 {
  if(t->link!=NULL)
   printf("%d->",t->info);
  else
   printf("%d",t->info);
 }
 printf("
");
}

NODE* append(NODE *start)//append element at end
{
 NODE *t,*temp;
 temp=(NODE*) malloc(sizeof(NODE));
 printf("Enter data to be appended:");
 scanf("%d",&temp->info);
 for(t=start;t->link!=NULL;t=t->link);
 t->link=temp;
 temp->link=NULL;
 return start;
}

NODE* concat(NODE *s1,NODE *s2)//concatenate 2 lists
{
 NODE *t;
 t=s1;
 while(t->link!=NULL)
  t=t->link;
 t->link=s2;
 return s1;
}
 
NODE* fr(NODE *start)//free all nodes in a list
{
 NODE *t;
 t=start;
 while(t!=NULL)
 {
  t=start;
  start=t->link;
  free(t);
 }
 return start;


NODE* rev(NODE *start)//to reverse a list

 NODE *t1,*t2,*s;
 for(t1=start;t1->link!=NULL;t1=t1->link);
 s=t1;
 while(t1!=start)
 { 
  for(t2=start;t2->link!=t1;t2=t2->link);
  t1->link=t2;
  t1=t2;
 }
 t1->link=NULL;
 return s;
}

NODE* dellast(NODE *start)//delete last element
{
 NODE *t,*t2;
 for(t=start;t->link->link!=NULL;t=t->link);
 t2=t->link;
 free(t2);
 t->link=NULL;
 return start;
}

NODE* deln(NODE *start)//delete nth element
{
 int i=1,n;
 NODE *t,*t2;
 printf("
Enter pos no of element to be deleted:");
 scanf("%d",&n);
 t=start;
 if(n!=1)
 {
  while(i<n-1)
  {
   t=t->link;
   i++;
  }
  t2=t->link;
  t->link=t2->link;
  free(t2);
 }
 else
 {
  start=t->link;
  free(t);
 }
 return start;
}
NODE* sort(NODE*);
//to combine 2 ordered lists into a single ordered list
NODE* comb(NODE *s1,NODE *s2)
{
 s1=concat(s1,s2);
 s1=sort(s1);
 return s1;
}
 
NODE* uni(NODE *s1,NODE *s2)//to find the union of 2 lists
{
 NODE *s3,*t,*t2,*t3,*temp;
 int flag=1;
 s3=(NODE*) malloc(sizeof(NODE));
 s3=NULL;
 t=s1;
 while(t!=NULL)
 {
  temp=(NODE*) malloc(sizeof(NODE));
  temp->info=t->info;
  temp->link=NULL;
  if(s3==NULL)
   s3=temp;
  else
  {
   t2=s3;
   while(t2->link!=NULL)
    t2=t2->link;
   t2->link=temp;
  }
  t=t->link;
 }
 
 t2=s2;
 while(t2!=NULL)
 {
  t=s1;
  flag=1;
  while(t!=NULL)
  {
   if(t->info==t2->info)
   {
    flag=0;
    break;
   }
   t=t->link;
  }
  if(flag==1)
  {
   for(t3=s3;t3->link!=NULL;t3=t3->link);
   temp=(NODE*) malloc(sizeof(NODE));
   temp->info=t2->info;
   t3->link=temp;
   temp->link=NULL;
  }   
  t2=t2->link;
 }
 return s3;
}

NODE* inter(NODE *s1,NODE *s2)//to find the intersection of 2 lists
{
 NODE *s3,*t1,*t2,*t3,*temp;
 s3=(NODE*) malloc(sizeof(NODE));
 s3=NULL;
 t1=s1;
 while(t1!=NULL)
 {
  t2=s2;
  while(t2!=NULL)
  {
   if(t1->info==t2->info)
   {
    temp=(NODE*) malloc(sizeof(NODE));
    temp->info=t1->info;
    temp->link=NULL;
    if(s3==NULL)
     s3=temp;
    else
    {
     for(t3=s3;t3->link!=NULL;t3=t3->link);
     t3->link=temp;
    }
    break;
   }
   t2=t2->link;
  }
  t1=t1->link;
 }  
 return s3;


NODE* insertn(NODE *s)//to insert at nth position
{
 NODE *t,*t2,*temp;
 int n,i=1;
 printf("Enter data:");
 temp=(NODE*) malloc(sizeof(NODE));
 scanf("%d",&temp->info);
 printf("Enter position no at which element has to be inserted:");
 scanf("%d",&n);
 t=s;
 if(n!=1)
 {
  while(i<n-1)
  {
   t=t->link;
   i++;
  }
  t2=t->link;
  t->link=temp;
  temp->link=t2;
 }
 else
 {
  temp->link=s;
  s=temp;
 }
 return s;
}
  
NODE* del2(NODE *s)//delete every 2nd element in a list
{
 NODE *t1,*t2;
 t1=s;
 while(t1!=NULL)
 {
  t2=t1->link;
  t1->link=t2->link;
  free(t2);
  t1=t1->link;
 }
 return s;


NODE* sort(NODE *s)//to place elements in increasing order
{
 NODE *t1,*t2;
 int temp;
 for(t1=s;t1->link!=NULL;t1=t1->link)
 {
  for(t2=t1->link;t2!=NULL;t2=t2->link)
  {
   if(t1->info>t2->info)
   {
    temp=t1->info;
    t1->info=t2->info;
    t2->info=temp;
   }
  }
 }
 return s;
}

int sum(NODE *s)//to find the sum of elements in a list
{
 int sum=0;
 NODE *t;
 for(t=s;t!=NULL;t=t->link)
  sum+=t->info;
 return sum;
}

int elements(NODE *s)//to find the number of elements in a list
{
 int n=0;
 NODE *t;
 for(t=s;t!=NULL;t=t->link)
  n++;
 return n;
}

NODE* copy(NODE *s1)//to make a second copy of the list
{
 NODE *s2,*t,*temp,*t2;
 s2=NULL;
 t=s1;
 while(t!=NULL)
 {
  temp=(NODE*) malloc(sizeof(NODE));
  temp->info=t->info;
  temp->link=NULL;
  if(s2==NULL)
   s2=temp;
  else
  {
   t2=s2;
   while(t2->link!=NULL)
    t2=t2->link;
   t2->link=temp;
  }
  t=t->link;
 }
 return s2;

   
NODE* forward(NODE *s)//to forward a node by n positions
{
 NODE *t1,*t2,*t3;
 int n1,n2,i;
 printf("Enter position of the node you want to move:");
 scanf("%d",&n1);
 printf("Enter no of positions you want to move:");
 scanf("%d",&n2);
  t1=s;
  i=1;
  while(i<n1)
  {
   t1=t1->link;
   i++;
  }
  t2=s;
  i=1;
  while(i<n1+n2)
  {
   t2=t2->link;
   i++;
  }
  t3=s;
  if(t1!=s)
  while(t3->link!=t1)
   t3=t3->link;
  t3->link=t1->link;
  if(t1==s)
   s=s->link;
  t1->link=t2->link;
  t2->link=t1; 
 return s;


  
void main()
{
 NODE *s1,*s2;
 int ch;
 s1=NULL;
 s2=NULL;
 while(1)
 {
  clrscr();
  printf("Enter choice:
");
  printf(" 1.Append element at end
2.Concatinate two lists
");
  printf(" 3.Free all nodes in a list
4.Reverse a list
");
  printf(" 5.Delete last element
6.Delete nth element
");
  printf(" 7.Combine two ordered list into single ordered list
");
  printf(" 8.Find union of two lists
9.Find intersection of two lists
");
  printf("10.Insert after nth element
11.Delete every second element
");
  printf("12.Place elements in order
13.Return sum of data
");
  printf("14.Return number of elements
15.Make second copy of list
");
  printf("16.Move node forward to n positions
17.Exit
");
  scanf("%d",&ch);
  clrscr();
  if(ch>0&&ch<=16)
   s1=create(s1);
   disp(s1);
  switch(ch)
  {
   case 1:s1=append(s1);break;
   case 2:s2=create(s2);disp(s2);s1=concat(s1,s2);break;

   case 3:s1=fr(s1);
   printf("List freed
");
   disp(s1);
   break;
   
   case 4:s1=rev(s1);break;
   case 5:s1=dellast(s1);break;
   case 6:s1=deln(s1);break;
   case 7:s2=create(s2);disp(s2);s1=comb(s1,s2);break;
   case 8:s2=create(s2);disp(s2);s1=uni(s1,s2);break;
   case 9:s2=create(s2);disp(s2);s1=inter(s1,s2);break;
   case 10:s1=insertn(s1);break;
   case 11:s1=del2(s1);break;
   case 12:s1=sort(s1);break;
   case 13:printf("Sum of elements=%d",sum(s1));break;
   case 14:printf("Number of elements=%d",elements(s1));break;
   
   case 15:
   s2=copy(s1);
   printf("Second list:
");
   disp(s2);
   break;
   
   case 16:s1=forward(s1);break;
   case 17:exit(0);break;
   default:printf("Wrong choice.Enter again");break;
  }
  if(ch!=3&&ch!=13&&ch!=14&&ch!=15&&ch>0&&ch<=16)
  {
   printf("
Result:");
   disp(s1);
  }
   s1=fr(s1);
   s2=fr(s2);
   getch();
 }   
}

Read More..

Release MediaPlayer in onDestroy and onPause

If you try run the last exercise of "Simple example of using MediaPlayer", you can notice that if you exit the app, the sound will still playing, and then switch back to the app, both old sound and new sound will overlap.

Actually, you have to release the MediaPlayer in onDestroy() and onPause(), when the app exit. Or any other handling method, depends on your own case.

 @Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
}

@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
}

Simple example of using MediaPlayer


Next:
- Get video size for MediaPlayer by implementing onVideoSizeChanged()


Read More..

How To Send SMS Message In Android


Android layout file to textboxes (phone no, sms message) and button to send the SMS message.
File : res/layout/main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
 
<TextView
android:id="@+id/textViewPhoneNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter Phone Number : "
android:textAppearance="?android:attr/textAppearanceLarge" />
 
<EditText
android:id="@+id/editTextPhoneNo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:phoneNumber="true" >
</EditText>
 
<TextView
android:id="@+id/textViewSMS"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter SMS Message : "
android:textAppearance="?android:attr/textAppearanceLarge" />
 
<EditText
android:id="@+id/editTextSMS"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="5"
android:gravity="top" />
 
<Button
android:id="@+id/buttonSend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send" />
 
</LinearLayout>
File : SendSMSActivity.java – Activity to send SMS via SmsManager.
package com.mkyong.android;
 
import android.app.Activity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
 
public class SendSMSActivity extends Activity {
 
Button buttonSend;
EditText textPhoneNo;
EditText textSMS;
 
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
 
buttonSend = (Button) findViewById(R.id.buttonSend);
textPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
textSMS = (EditText) findViewById(R.id.editTextSMS);
 
buttonSend.setOnClickListener(new OnClickListener() {
 
@Override
public void onClick(View v) {
 
String phoneNo = textPhoneNo.getText().toString();
String sms = textSMS.getText().toString();
 
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, sms, null, null);
Toast.makeText(getApplicationContext(), "SMS Sent!",
Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"SMS faild, please try again later!",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
 
}
});
}
}
File : AndroidManifest.xml , need SEND_SMS permission.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mkyong.android"
android:versionCode="1"
android:versionName="1.0" >
 
<uses-sdk android:minSdkVersion="10" />
 
<uses-permission android:name="android.permission.SEND_SMS" />
 
<application
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".SendSMSActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
 
</manifest>
See demo :
send sms message via smsmanager
Read More..

Powered by Blogger.