15
Session 3 Chap-1 Basic Android Prepared By, NicheTech http ://www.nichetechsolutions.com/

Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Embed Size (px)

DESCRIPTION

NicheTech is the best web development company in India. We are offering Android live project training Ahmedabad. MSC IT students can select Android for final sem project. MSC IT students can also get live project training Ahmedabad. http://www.nichetechsolutions.com/ http://www.liveprojecttraining.in/

Citation preview

Page 1: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Session 3 Chap-1 Basic Android

Prepared By,NicheTech

http://www.nichetechsolutions.com/

Page 2: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Display a Progress Dialog Progress Dialog basically used for showing the status of our download operation.

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 3: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti…

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 4: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti…

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 5: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Let’s Understand the coding If we are interested to perform the progress dialog, then what we suppose to do is first create the instance or object of a class named ProgressDialog class and then after set the various properties of it.

_progressDialog = new ProgressDialog(this);_progressDialog.setIcon(R.drawable.icon);_progressDialog.setTitle(“Downloading files...”);

_progressDialog.setProgressStyle(ProgressDialog.STYLE_ HORIZONTAL);

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 6: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti… Then set the two button .

Next is if you want to display the progress status in the progress dialog , you need to use a Handler Object to run the background thread.

The background thread counts up to 100, with each count delayed by 100 milliseconds.

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 7: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Linking Activity Using Intents Our mobile application Android, contain zero or more than one activity.

Using the Intents, we can navigate between activities.

Please check out the image in the next slide.

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 8: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti…

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 9: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti… Write the code inside AndroidManifest.xml file The name of the new activity added is “Activity2”. The label for the activity is named “Activity 2”. The intent filter name for the activity is “net.learn2develop.ACTIVITY2”. Other activities that

wish to call this activity will invoke it via this name. The category for the intent filter is “android.intent.category.DEFAULT”. You need to add this to the intent filter so that this activity can be started by another activity using the startActivity()

method.Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 10: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti… Right Click on the src folder and create new class and give the name Activity2.

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 11: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti… Create one copy of main.xml file by right click on the res/layout folder, and click on the paste button and give the file name activity2.xml.

Now it is the time to modify the activity2.xml file.

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 12: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti… Inside the Activity2.java file write the code below

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 13: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti… Here come the main file FirstBasicAndroidActivity.java

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 14: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Conti… In the FirstBasicAndroidActivity.java file, you

implemented the onKeyDown event handler. This event is fired whenever the user presses one of the keys on the device. When the user presses the center key on the directional

pad (as represented by the KeyEvent.KEYCODE_DPAD_CENTER constant), you use the startActivity() method to display Activity2 by creating an instance of the Intent class and passing it the intent filter name of Activity2 (which is net.learn2develop.ACTIVITY2):

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Page 15: Android Training Ahmedabad , Android Course Ahmedabad, Android Live Project Training Ahmedabad

Prepared By, NicheTech (C) Nichetech Com. Sol. Pvt. Ltd

Thanks NicheTech