2 0 1 3 M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 2 Android Application Step by Step Eleonora Todorova Boyan Iliev.

Slides:



Advertisements
Similar presentations
Android Application Development Tutorial. Topics Lecture 6 Overview Programming Tutorial 3: Sending/Receiving SMS Messages.
Advertisements

1 Android Introduction Hello Threads. 2 Goal Create an application that uses a background thread as a UDP server to receive messages from the UDP client.
Android Application Development Tutorial. Topics Lecture 4 Overview Overview of Sensors Programming Tutorial 1: Tracking location with GPS and Google.
0 - 0.
Addition Facts
Services. Application component No user interface Two main uses Performing background processing Supporting remote method execution.
CE881: Mobile and Social Application Programming Simon M. Lucas Quiz, Walkthrough, Exercise, Lifecycles, Intents.
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
Addition 1’s to 20.
Test B, 100 Subtraction Facts
1 | 2010 Activity og GUI Android Brugergrænseflade.
Tackling Android Fragmentation Dev:Mobile Inmeta consulting 16 klocs – not rocket science.
Android basics. About Android Linux based operating system Open source Designed for handheld devices Developed by Android Inc. Google (2005) Open Handset.
Android Selection Widgets Yuliana Setiowati Rizky Yuniar Hakkun 1Politeknik Elektronika Negeri Surabaya.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
Android Development (Basics)
Better reference the original webpage :
CS5103 Software Engineering Lecture 08 Android Development II.
Chapter 2: Simplify! The Android User Interface
Mobile Programming Lecture 6
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Create Navigation Drawer Team 2 Zhong Wang Jiaming Dong Philip Wu Lingduo Kong.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
Android Boot Camp for Developers Using Java, 3E
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Cosc 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
Copyright© Jeffrey Jongko, Ateneo de Manila University Custom ListAdapters.
Styles, Dialog Boxes, and Menus. Styles Allow creation of a common format – placed in res/values/styles.xml – file name is incidental Can be applied.
Applications with Multiple Activities. Most applications will have more than one activity. The main activity is started when the application is started.
Mobile Programming Lecture 7 Dialogs, Menus, and SharedPreferences.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
ListView and ExpandableListView
Android Application Lifecycle and Menus
User Interface Layout Interaction. EventsEvent Handlers/Listeners Interacting with a user.
Flag Quiz Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
School of Engineering and Information and Communication Technology KIT305/KIT607 Mobile Application Development Android OS –Permissions (cont.), Fragments,
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Why Learn Android? Largest installation base of any operating system Over 20,000 Android devices exist Businesses will likely move more to device-based.
Menus. Menus are a common user interface component in many types of applications. The options menu is the primary collection of menu items for an activity.
Chapter 2: Simplify! The Android User Interface
Lab7 – Appendix.
Introduction to android
Android Programming - Features
CS499 – Mobile Application Development
UNIT 11 로봇 전화번호부 3/4 로봇 SW 콘텐츠 교육원 조용수.
CS240: Advanced Programming Concepts
GUI Programming Fundamentals
Further android gui programming
ListView: Part 2.
Mobile Application Development Chapter 3 [Using Eclipse Android Studio for Android Development] IT448-Fall 2017 IT448- Fall2017.
CS499 – Mobile Application Development
Android Widgets 1 7 August 2018
Android Introduction Camera.
תכנות ב android אליהו חלסצ'י.
Picasso Revisted.
Android Programming Lecture 6
Chapter 9: Fragments.
null, true, and false are also reserved.
Many thanks to Jun Bum Lim for his help with this tutorial.
Android Topics Custom ArrayAdapters
Activities and Intents
Objects First with Java
ListView ? BaseAdapter ?.
Activities and Fragments
CA16R405 - Mobile Application Development (Theory)
CA16R405 - Mobile Application Development (Theory)
Presentation transcript:

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 2 Android Application Step by Step Eleonora Todorova Boyan Iliev

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 3 Mobile Devices Today

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 4 Android Evolution

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 5 Android in a Glance Android SDK Dalvik Eclipse vs. Android Studio ADT Debug & Testing Tools DDMS Open Source Libraries

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 6 Android Step by Step

7 Android Step by Step Create an Android Project

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 8 Android Step by Step Project Architecture Manifest File <manifest xmlns:android=" package="com.mentormate.java2days" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <application android:allowBackup="true" > <activity android:name="com.mentormate.java2days.MainActivity" >

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 9 Android Step by Step MainActivity & main_layuout Show main screen without anything in it Add Volley and gson libs

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 10 Android Step by Step Application class & App start point Application class public class LabsApp extends Application { private static Gson sGson; private static RequestQueue sRequestQueue; private static ImageLoader sImageLoader; private ImageLoader.ImageCache mImageCache; private ImageLoader.ImageCache public void onCreate() { super.onCreate(); // init everything sRequestQueue = Volley.newRequestQueue(getApplicationContext()); sGson = new Gson(); // super simple image cache mImageCache = new ImageLoader.ImageCache() { private final LruCache mCache = new LruCache public void putBitmap(String url, Bitmap bitmap) public Bitmap getBitmap(String url) {...} }; mDiskCache = new ImageLoader.ImageCache() { private final DiskBasedCache mCache = new iskBasedCache(getCacheDir(), public void putBitmap(String url, Bitmap bitmap) public Bitmap getBitmap(String url) {... return getBitmapFromBytes(entry.data); } // can't be simpler than this sImageLoader = new ImageLoader(sRequestQueue, Constants.USE_DISK_CACHE ? mDiskCache : mImageCache); } public static ImageLoader getImageLoader() {...} public static RequestQueue getRequestQueue() {...} public static Gson getGsonInstance() {...} }

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 11 Android Step by Step - B TBD Copy data classes & RegexUtils and show them briefly Implement Volley and gson – copy most of the content describing what it is

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 12 Android Step by Step List View MainActivity public class MainActivity extends Activity { private ListView mListView; protected GalleryAdapter mAdapter; private RequestQueue mQueue; private MenuItem protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_volley); mQueue = LabsApp.getRequestQueue(); mListView = (ListView) findViewById(android.R.id.list); refreshData(); } private void refreshData() {...} public void onStop() { super.onStop(); mQueue.cancelAll(Constants.TAG_IMAGE_REQUEST); public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.volley, menu); return true; public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_refresh: refreshItem = item; refresh(); break; default: break; } return true; }

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 13 Android Step by Step List View ListAdapter public class ListAdapter extends BaseAdapter { private Context mContext; private List mOriginalLis;...t public ListAdapter(Context context, List list) {...} public void loadMoreData() public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; ViewHolder viewHolder; if(v == null){ LayoutInflater inflater = (LayoutInflater) getContext(). getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(R.layout.list_item_photo_gallery, null, false); viewHolder = new ViewHolder(); if (v != null) { viewHolder.thumbnail = (NetworkImageView) v.findViewById(R.id.thumbnail); viewHolder.description = (TextView) v.findViewById(R.id.description); v.setTag(viewHolder); } } else { viewHolder = (ViewHolder) v.getTag(); } final Result result = mOriginalList.get(position); viewHolder.thumbnail.setDefaultImageResId(android.R.drawable.ic_menu_gallery); viewHolder.thumbnail.setErrorImageResId(android.R.drawable.ic_menu_delete); if (result != null) { if (Constants.USER_NETWORK_IMAGE_VIEWS) { viewHolder.thumbnail.setImageUrl(result.getTbUrl(), LabsApp.getImageLoader()); } else { requestImage(viewHolder.thumbnail, result.getTbUrl()); } viewHolder.description.setText(result.getTitleNoFormatting()); if(closeToEnd(position)) { loadMoreData(); } v.setOnClickListener(new OnClickListener() {…}); return v; } public void requestImage(final ImageView niv, final String imgUrl) {...} private boolean shouldLoadData(long position) {...} }

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 14 Android Step by Step Refresh Button Animation <rotate xmlns:android=" android:duration="1000" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:toDegrees="360" /> private void startAnimation() { /* Attach a rotating ImageView to the refresh item as an ActionView */ LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(layout.action_refresh, null); Animation rotation = AnimationUtils.loadAnimation(this, anim.refresh_rotate); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation); if(refreshItem != null && iv != null) refreshItem.setActionView(iv); } private void stopAnimation() { if (refreshItem != null && refreshItem.getActionView() != null) { refreshItem.getActionView().clearAnimation(); refreshItem.setActionView(null); }

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 15 Android Step by Step Navigate to the Second screen DetailsActivity v.setOnClickListener(new OnClickListener() public void onClick(View v) { Intent intent = new Intent(mContext, DetailsActivity.class); intent.putExtra("image_url", result.getUrl()); mContext.startActivity(intent); } }); /** * MentorMate LLC * */ public class DetailsActivity extends Activity { private NetworkImageView ivImage; private ProgressBar protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_photo_details); mLoadingBar = (ProgressBar) findViewById(R.id.loading); ivImage = (NetworkImageView) findViewById(R.id.image); ivImage.setImageUrl(getIntent().getExtras().getString("image_url"), LabsApp.getImageLoader()); }

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 16 Android Step by Step Add Progress loader Details layout <RelativeLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="match_parent" > <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" /> <com.android.volley.toolbox.NetworkImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="5dp" android:adjustViewBounds="true" android:scaleType="fitCenter" />

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 17 Android Step by Step Talk about resources (dimensions, strings, styles) in more details if there is any time

M E N T O R M A T E, L L C. A L L R I G H T S R E S E R V E D. 18 QUESTIONS

Thank you!