Activity ANDROID CLUB 2015. Сегодня  Основные компоненты Android  Activity  Layout для Activity  Создание Activity  Launcher Activity  Activity.

Slides:



Advertisements
Similar presentations
Programming with Android: Activities
Advertisements

Android 02: Activities David Meredith
The Android Activity Lifecycle. Slide 2 Introduction Working with the Android logging system Rotation and multiple layouts Understanding the Android activity.
Manifest File, Intents, and Multiple Activities. Manifest File.
The Activity Class 1.  One application component type  Provides a visual interface for a single screen  Typically supports one thing a user can do,
@2011 Mihail L. Sichitiu1 Android Introduction Communication between Activities.
@2011 Mihail L. Sichitiu1 Android Introduction Hello Views Part 1.
Getting Started with Android APIs Ivan Wong. Motivation - “Datasheet” - Recently exposed to what’s available in Android - So let’s see what API’s are.
Mobile Programming Lecture 9 Bound Service, Location, Sensors, IntentFilter.
Android Mobile computing for the rest of us.* *Prepare to be sued by Apple.
1 Announcements Homework #2 due Feb 7 at 1:30pm Submit the entire Eclipse project in Blackboard Please fill out the when2meets when your Project Manager.
Copyright© Jeffrey Jongko, Ateneo de Manila University Of Activities, Intents and Applications.
Android Programming-Activity Lecture 4. Activity Inside java folder Public class MainActivity extends ActionBarActivity(Ctrl + Click will give you the.
Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml.
Mobile Programming Lecture 5 Composite Views, Activities, Intents and Filters.
Linking Activities using Intents How to navigate between Android Activities 1Linking Activities using Intents.
Noname. Conceptual Parts States of Activities Active Pause Stop Inactive.
Activity 생명주기 UNIT 13 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Logcat 액티비티 생명주기를 설명할 수 있다. 현재 상태를 저장할 수 있다. 2.
User Interface Android Club Agenda Button OnClickListener OnLongClickListener ToggleButton Checkbox RatingBar AutoCompleteTextView.
Activity Android Club Agenda Hello Android application Application components Activity StartActivity.
Mobile Programming Midterm Review
HTTP ANDROID CLUB 2015.
Service ANDROID CLUB Сегодня  Service Service - служба  Работает в фоновом режиме  Не имеет пользовательского интерфейса.
1 CMSC 628: Introduction to Mobile Computing Nilanjan Banerjee Introduction to Mobile Computing University of Maryland Baltimore County
Applications with Multiple Activities. Most applications will have more than one activity. The main activity is started when the application is started.
Android Application Lifecycle and Menus
Activities and Intents Richard S. Stansbury 2015.
Intents 1 CS440. Intents  Message passing mechanism  Most common uses:  starting an Activity (open an , contact, etc.)  starting an Activity.
Anekdot ANDROID CLUB Сегодня  Navigation Drawer  CardView  Calligraphy  TextToSpeech.
로봇을 조종하자 4/4 UNIT 18 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 Intent Activity 호출 2.
아주대학교 LifecareScienceLAB Android Seminar 3 rd class Android Software Development 2011/05/04 – p.m. 06:00 – 팔달관 409 호 아주대학교.
Lecture 2: Android Concepts
Android Alert Dialog. Alert Dialog Place Button to open the dialog. public class MainActivity extends ActionBarActivity { private static Button button_sbm;
Technische Universität München Services, IPC and RPC Gökhan Yilmaz, Benedikt Brück.
Уведомление пользователя ANDROID CLUB Сегодня  Toast  Диалог  Уведомление.
Contents Searches related to Android RatingBar Basics Android ratingbar example Android custom ratingbar.
Activities and Intents Chapter 3 1. Objectives Explore an activity’s lifecycle Learn about saving and restoring an activity Understand intents and how.
Intents and Broadcast Receivers Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution.
Activity and Fragment.
Java Examples Embedded System Software
Programming with Android:
Linking Activities using Intents
Android – Event Handling
CS499 – Mobile Application Development
Tashkent Weather ANDROID CLUB 2015.
Communication between Activities
CS499 – Mobile Application Development
Picasso Revisted.
CIS 470 Mobile App Development
Android Programming Lecture 4
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Activity Lifecycle Fall 2012 CS2302: Programming Principles.
CMPE419 Mobile Application Development
UNIT 08 그림책 만들기 2/2 로봇 SW 콘텐츠 교육원 조용수.
Activities and Intents
Activities and Intents
CIS 470 Mobile App Development
Activity Lifecycle.
CIS 493/EEC 492 Android Sensor Programming
CIS 470 Mobile App Development
Objects First with Java
ארועים ומאזינים android.
Activities and Intents
SE4S701 Mobile Application Development
Objects First with Java
Activities and Fragments
Activities, Fragments, and Intents
CIS 694/EEC 693 Android Sensor Programming
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Activity ANDROID CLUB 2015

Сегодня  Основные компоненты Android  Activity  Layout для Activity  Создание Activity  Launcher Activity  Activity Lifecycle  Activity Backstack  Переход с одного Activity на другой  Как передать данные с одного Activity на другой  Закрыть Activity  startActivityForResult

Основные компоненты Android  Activity  Service  BroadcastReceiver  ContentProvider

Activity  Окно где пользователь может взаимодействовать с системой  Одно действие

Activity: пример 2

Activity: пример 3

Activity: пример 4

Activity: пример 5

Layout для Activity: пример

Layout для Activity: практика  Откройте layout для MainActivity  Добавьте в layout: 1. CheckBox 2. Switch 3. ProgressBar 4. RatingBar 5. EditText(Plain Text)

Создание Activity: пример  public class SecondActivity extends AppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout. activity_second ); } }

Создание Activity: практика  Создавайте Activity  Называйте Activity: ThirdActivity  В layout этого Activity добавьте TextView  Содержание TextView: “Это третий Activity”

Launcher Activity: пример

Launcher Activity: практика  Сделайте ThirdActivity Activity по умолчание

Жизненный цикл Activity

Жизненный цикл в примере  Машина

Жизненный цикл: protected void onStart() { super.onStart(); Log.d( "ActivityTutorial", "onStart" ); protected void onRestart() { super.onRestart(); Log.d( "ActivityTutorial", "onRestart" ); protected void onResume() { super.onResume(); Log.d( "ActivityTutorial", "onResume" ); }

Жизненный цикл Activity: практика  В logcat показывайте, сколько раз вызвано каждый метод  Пример: onCreate:1 onStart:3 onRestart:2 onResume:3 onPause:2 onStop:2 onDestroy:0

Activity Backstack

startActivity(): пример Button button1 = (Button) findViewById(R.id. button1 ); button1.setOnClickListener( new View.OnClickListener() public void onClick(View v) { Intent intent = new Intent(MainActivity. this, SecondActivity. class ); startActivity(intent); } });

startActivity(): практика  В layout SecondActivity, поставьте кнопку с id – button2  При нажатии этой кнопки переходите ThirdActivity

Передать данные: пример //MainActivity.java Intent intent = new Intent(MainActivity. this, SecondActivity. class ); intent.putExtra( "parol", " " ); startActivity(intent); //SecondActivity.java Intent intent = getIntent(); String password = intent.getStringExtra( "parol" );

Передать данные: практика  Передавайте ваше имя с SecondActivity на ThirdActivity  Показывайте его с помощью Toast

Закрыть Activity: пример  finish();

Закрыть Activity: практика  Поставьте кнопку Закрыть для Main Activity

startActivityForResult(): пример  //MainActivity.java  Intent intent = new Intent(MainActivity. this, SecondActivity. class ); startActivityForResult(intent, 87);  //SecondActivity.java  Intent intent = new Intent(); intent.putExtra( "word", "Lamborghini" ); setResult( RESULT_OK, intent); finish();  //MainActivity.java protected void onActivityResult( int requestCode, int resultCode, Intent data) { if (data != null ) { if (requestCode == 87) { if (resultCode == RESULT_OK ) { String word = data.getStringExtra( "word" ); Toast.makeText(getApplicationContext(), word, Toast. LENGTH_LONG ).show(); } } } }

startActivityForResult(): практика  В layout SecondActivity, поставьте кнопку с id – button5  При нажатии этой кнопки переходите ThirdActivity  В ThirdActivity, поставьте 2 кнопки: bHead, bTail  Если нажимается bHead – в SecondActivity показывайте Орел  Если нажимается bTail– в SecondActivity показывайте Решка