SOFTWARE ISLAND
For Android developers .... Especially for Android beginners !
TWO THRONES
DUSK N DAMN
Monday, March 11, 2013
Saravanan 's Dream: Regular Expression - Introduction
Saravanan 's Dream: Regular Expression - Introduction: Hi friends, I hope, We are all know how to create at least a log in page in any one or more programming language or using tool. But th...
Saturday, December 8, 2012
Android SMS Send and Receive.
you can check this sms send receive local emulator.
just create two emulator .where you give phone no that place you have pass that receiving emulator no:5556
Example:
1) Ffirst emulator no:5554(sms sent)
2) Second emulator no:5556(receive sms) .
Source Code:
serbt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
EditText no=(EditText)findViewById(R.id.no);
EditText name=(EditText)findViewById(R.id.name);
EditText author=(EditText)findViewById(R.id.author);
EditText version=(EditText)findViewById(R.id.version);
data.insertData(no.getText().toString(), name.getText().toString(), author.getText().toString(), version.getText().toString());
String phoneNo = "5556";
String message = "Books Succesfully Details Added!!!!"+","+no.getText().toString()+","+name.getText().toString()+","+author.getText().toString()+","+version.getText().toString();
if (phoneNo.length()>0 && message.length()>0)
sendSMS(phoneNo, message);
else
Toast.makeText(getBaseContext(),
"Please enter both phone number and message.",
Toast.LENGTH_SHORT).show();
Intent in=new Intent(AddBooksActivity.this,AddBooksActivity.class);
in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(in);
// ArrayList<String> getData = data.getAllData();
}
});
Source Code:
for receving purpose
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
//---get the SMS message passed in---
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
if (bundle != null)
{
//---retrieve the SMS message received---
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
str += "SMS from " + msgs[i].getOriginatingAddress();
str += " :";
str += msgs[i].getMessageBody().toString();
str += "\n";
}
//---display the new SMS message---
Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
}
}
Thursday, November 25, 2010
Subscribe to:
Comments (Atom)