Posts

Showing posts from June, 2016

How to send SMS in android? Explain with example.

How to send SMS in android? Explain with example. <Button android:id="@+id/btnSendSMS" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:onClick="sendmySMS" android:text="sendSMS" /> According to above code when user clicks the button sendmySMS method will be called. sendmySMS is user defined method. In the AndroidManifest.xml file, add the following statements <uses-permissionandroid:name="android.permission.SEND_SMS"/> Now we write the final step. Write the given below method in MainActivity,java file publicvoidsendmySMS(View v) { SmsManagersms = SmsManager.getDefault();  sms.sendTextMessage("5556", null, "Hello from careerRide", null, null); } In this example I have used two emulator. On the first Android emulator (5554), click the Send SMSbutton to send an SM

Describe Intents in detail.

Describe Intents in detail. An Android application can contain zero or more activities. If you want to navigate fromone activity to another then android provides you Intent class. This class is available inandroid.content.Intent package.One of the most common uses for Intents is to start new activities. There are two types of Intents. Explicit Intents Implicit Intents Intents works in pairs: actionand data. The action defines what you want to do, such as editing an item, viewingthe content of an item etc. The dataspecifies what is affected,such as a person in the Contacts database. The data is specified as anUri object.

Describe android Activities in brief.

Describe android Activities in brief. Activity provides the user interface. When you create an android application in eclipse through the wizard it asks you the name of the activity. Default name is MainActivity. You can provide any name according to the need. Basically it is a class (MainActivity) that is inherited automatically from Activity class. Mostly, applications have oneor more activities; and the main purpose of an activity is to interact with the user. Activity goes through a numberof stages, known as an activity's life cycle. Example: packagecom.example.careerride; //Application name careerride importandroid.os.Bundle; // Default packages importandroid.app.Activity; // Default packages importandroid.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override publicbooleanonCreateOpti

Explain in brief about the important file and folder when you create new android application.

Explain in brief about the important file and folder when you create new android application. When you create android application the following folders are created in the package explorer in eclipse which are as follows: src : Contains the .java source files for your project. You write the code for your application in this file. This file is available under the package name for your project. gen —This folder contains the R.java file. It is compiler-generated file that references all the resources found in your project. You should not modify this file. Android 4.0 library : This folder contains android.jar file, which contains all the class libraries needed for an Android application. assets : This folder contains all the information about HTML file, text files, databases, etc. bin : It contains the .apk file (Android Package) that is generated by the ADT during the build process. An .apk file is the application binary file. It contains everything needed to