Posts

Showing posts with the label Israel

The SELA Developer Practice Android app

Image
  For the last couple of weeks, I’ve been working on an App which offers the users interactive information regarding the Sela Developer Practice conference to take place on may 5th and will include dozens of lectures and international speakers which will present new technologies and trends, as well as advanced topics in the fields of Client/Server and Cloud/ALM and VS. The app communicates with couple of web services to consume the JSON data which is than processed on the client to show it from different points of view and arrange it in dynamically generated views. I took the inspiration from both the official website http://www.seladeveloperpractice.com and the app for Google’s IO which is published every year. The app shows info on the Speakers including twitter and blogs, as well as extensive info on the abstract of each session. You are welcome to try the app and rate in on Google Play: https://play.google.com/store/apps/details?id=com.selagroup.sdpmay2013

Testing Android Applications

Android Testing testing in Android application can be really tricky, there’s a lot to test if we want to deliver a proper application which supports as much users as posible, here are a few tips on the what to test and how to test: Testing in Android: · Screen sizes Testing how the app is shown in different screen sizes · OS versions Apps can behave differently or even crush in some OSD versions due to lack of targeting to specific device · Densities Screen densities change from device to device, and from a UI point of view this can be real issues, having apps to look far from the designers aim · Resolutions When not targeting a specific resolution the graphics are used with OS manipulations like stretch and scale, which can be resulting in a disastrous UI and UX for the user · Functionality Basic functionality testing of the app in terms of business logic · Usability The usability angle is very important once we are handling a small device, a lack of attention to the UI and user e...

תכנות לאנדרואיד בקלות פרק 12 – מיקבול תהליכים - Threads

בכל פעם שאנו יוצרים אפליקציית אנדרואיד, Thread שנקרא "main" נוצר באופן אוטומטי. Thread זה המכונה גם UI THREAD, הוא חשוב מאוד משום שהוא אחראי על שיגור האירועים ליישומונים המתאימים וזה כולל את אירועי ה draw. זה גם Thread שמנהל אינטראקציה עם פקדים באנדרואיד. לדוגמה, אם אתה נוגע בכפתור על מסך, Thread UI משגר אירוע שבעצם נותן פקודה למערכת ההפעלה לפעול בהתאם. מודל Thread זה יכול להניב ביצועים גרועים ביישומי אנדרואיד מכיוון שכל הפעולות מתבצעות על אותו ה Thread, כגון עבודות חישוב ארוכות, גישה לשרת, הורדה של קבצים. אלה תהליכים שחייבים לפעול באופן מקביל ולא על ה UI thread , זאת על מנת לשמר מצב שבו האפליקציה מגיבה ולא קורסת. במידה וה UI THREAD תפוס למשך 5 שניות, אנו נקבל תוצאת ANR- Application not responding שיתבטא בקריסה של האפליקציה. מכאן מגיעה החשיבות הגדולה בעבודה Multi threaded , ותיכף נדגים כיצד זה מתבצע. public void onClick(View v) { new Thread(new Runnable() { public void run() { Bitmap b = loadImageFromNetwork(); mImageView.setImageBitmap(b); } }).start(); } ...

תכנות לאנדרואיד בקלות פרק 11 – בסיסי נתונים Sqlite

באפליקציית mobile יש חשיבות רבה לשמירת נתונים, החשיבות נובעת מכמה סיבות עיקריות: 1. שמירה של נתונים עבור המשתמש, העדפות שלו, הגדרות וכו. 2. במידה ואין חיבור זמין לרשת, יש לאפשר לו לעבוד במצב לא מקוון. 3. תוצאות משחקים, data של אפליקצייה – יש לשמור אותם מקומית. 4. להמעיט את הגישה לשרת לצורך אחזור של מידע קבוע, זאת על מנת לחסוך גם בסוללה וגם בעלויות של מפעיל סלולרי. ישנן כמה דרכים לשמור מידע במכשיר שלנו, בפרק זה נתרכז בבסיס נתונים רלציוני מאוד נפוץ בשם sqlite Sqlite נפוצה בהרבה פלטפורמות והיא מאוד רזה, אך מאפשרת פונקציונאליות כמעט מלאה כפי שתצפו מכל בסיס נתונים רלציוני. class DB extends SQLiteOpenHelper {     final static int DB_VERSION = 1; final static String DB_NAME = "mydb.db";     Context context;     public DB(Context context) {         super(context, DB_NAME, null, DB_VERSION);         // Store the context for later use     ...

On{x} – notes from GDG October – Tel Aviv

Image
on{x} is a new product by Microsoft (yes, Microsoft) for Android which is made out of basically two components: 1. An Android app 2. A web interface the web interface allows you to add and send java script based commands to the android app which enable you to automate your smartphone to do something automatically based on events, such as: 1. send an SMS to my wife when I get in my car saying “I’m on my way” 2. start the Waze app when starting to drive for over miles an hour 3. turn on the lights on my garage when I’m 100 feet from there (based on some hardware/software support which must be present at home) this platform uses anode.js which is somewhat an expansion of node.js (Event-driven I/O server-side JavaScript environment) supported by Azure for scalability etc.. the product as weird as it may seem is for developers only, due to the fact that normal everyday users won’t be able to construct js scripts to control different elements on the Android. of course that I can s...

best phone for developing?

       So you are an Android developer now? great. you’ll probably start to develop using eclipse and some emulators (probably min 2.2). most of the developers I know are a bit fed up by the fact that the emulator suffers from a “few” cons. like what? You can’t really use an emulator with a mouse and get a real feel the same way you’ll do using your fingers and the various gestures you’ll use on an actual phone – get a real phone if you’re developing an app which includes picture taking/video recording or sound even, then you’ll find yourself guessing – get a real phone Locations – yes, if you’re developing an application which includes locations and maps, you’ll probably want to test it out. yes, the DDMS offers such emulation of Geolocations but it’s not so fun to use – get a real phone pretty much any sensor that you can’t think about needs a real phone in order to develop it the proper way – get a real phone   ok, we got it, you need to get a ph...

Boil an egg app - step by step (step 3 – code)

Image
  After reviewing part 2 of the tutorial, it’s time for coding. let’s get started. In the main activity class we’ll have the following things to do: 1. set some private variables to be accessed from different places in the class. 2. bind some variables to views from the xml reviewed in part 2 3. set listeners for the different buttons on the screen 4. handle timer changing and displaying time remained   let’s elaborate on this : 1. initialize some variables in the main class, place those prior to the onCreate() method:     private Button btnSmallEgg,btnMediumEgg,btnLargeEgg;     private Button btnCookAnEggTimer,btnResetTimer;     private TextView btnSoftEgg,btnHardEgg;     private TextView tvTimer,tvTimerLabel;     private TextView tvChooseEggSize,tvChooseEggType,tvIntro ;         long minutes;     long seconds;     long maxTimer=600...

How to upload an app to the Google Play store?

     You wrote an amazing app, it works on various resolutions and many tested and trusted devices, so the next step is to upload it to the Google Play store ! but wait, what's the best way to do it? This link explains all the important things you should do in order to prepare your app for publishing we'll cover the more important stuff. follow these next steps and you'll be on the market in no time: 1. Go over the code and remove all unnecessary code (Logs..unused code, unused     resources..etc..) 2. Choose a good package name - this will be your identifier for the store (on upgrade/update     we must use the same package name) 3. remove the android:debuggable attribute from your manifest file if exists 4. Don't forget an icon for the app 5. If you're supporting different resolutions - include matching graphics resources for them 6. We'll be using Eclipse's export wizard in order to get our app to "release" mode  ...

A simple Countdown Timer in Android

Of course we can implement a simple timer using threads but there's a better way out of the box.      The Android SDK offers us a rather simple way to use timers in our apps, Let's see how it works: CountDownTimer timer = new CountDownTimer(maxmillis, 1000) { @Override public void onTick(long lastknowtimer) { int seconds = (int) (lastknowtimer / 1000) % 60 ; int minutes = (int) ((lastknowtimer / (1000*60)) % 60);   tvTimerLabel.setVisibility(View.VISIBLE); tvTimer.setText(String.valueOf(minuts*seconds));     } @Override public void onFinish() { tvTimer.setText("finished"); } }; The  abstract class -  CountdownTimer's constructor receives two parameters (maxmillis which is the amount of milliseconds to countdown from, and the second parameter is the interval in which the tick happens). It has two methods which must be implemented:   1. onTick()   - the ac...

How to play a simple audio file in android

     In our application, it's sometimes necessary to play an audio file. The android sdk offers us a simple way to do it. let's examine the small snippet of code which does it: MediaPlayer mPlayer = MediaPlayer.create(getApplicationContext(), R.raw.audiofile); try { mPlayer.prepare();      } catch (IllegalStateException e) { e.printStackTrace();      } catch (IOException e) {         e.printStackTrace();      } mPlayer.start(); explanation: MediaPlayer -  MediaPlayer class can be used to control playback of audio/video files and   streams.  we need to pass : context and an id of the audio file, we will save the  f ile under the "raw" folder under the familiar "res" folder. after which we must call mPlayer.prepare() -  Prepares the player for playback, synchronously.  After setting the datasource and the display surface, you need to either call prepare...

Android Annotations - cleans your code

     Did you ever find yourself starting a new project or even a new activity and going through all the tiring process off binding UI controls to XML elements such as TextView , EditTexts , ListView etc .. ? I know I did. but there's a solution for this, along with some other code shortening elements for us to use. presenting : Android Annotations -  http://androidannotations.org/ A free to use library which can be added quite easily to an Android project with some minor calibrations. what does it allow us to do ? (taken from the androidannotations website) Dependency injection : inject views, extras, system services, resources, ... Simplified threading model : annotate your methods so that they execute on the UI thread or on a background thread. Event binding : annotate methods to handle events on views,   no more ugly anonymous listener classes ! REST client : create a client interface, AndroidAnnotations generates the implementatio...