This document provides an overview of developing applications for the Android platform. It discusses trends in the mobile internet and smartphone market in India. It then covers the Android architecture, including activities, views, services, notifications, content providers, and intents. It demonstrates how to set up an Android development environment and build a simple "Hello World" app. Finally, it walks through developing a sample SMS app to send text messages.
73. Edit String Resources Open res/values/strings.xml and add the following string resources <stringname="enter_sms">Enter SMS Text</string> <stringname="confirm">Send SMS</string>
74. Activity Coding Open src/com.tpm.android.sms/MySMS.java and insert a class member privateEditTextmSmsText; Create a new OnClick Event Listener Class publicclassOnClickListenerimplementsView.OnClickListener { @OverridepublicvoidonClick(View v) { String sms = mSmsText.getText().toString(); if (sms == null || sms.trim().length() ==0) { Toast.makeText(v.getContext(), "Enter a message", Toast.LENGTH_LONG).show(); } else { Toast.makeText(v.getContext(), "SMS Sent : " + sms , Toast.LENGTH_LONG).show(); } } }
75. Activity Coding Edit OnClick Method as shown below public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mSmsText = (EditText)findViewById(R.id.body); Button confirmButton = (Button) findViewById(R.id.confirm); confirmButton.setOnClickListener(new OnClickListener()); } Compile and Run.
76. For on More Android http://developer.android.com Or you can reach us at http://thagatpam.com