incentivelabs.de

Blog about nerd stuff, programming and related tools

Author: glethien

Android Splash Screen

Published / by glethien / Leave a Comment

Recently Ive came across a minior discussion about Splash Screen in Android.

We talked about the usefulness of those splash screens. Some want to use them to display the company logo or app logo, so the user has to stare several seconds on the logo. If the screen stays for 3 secs and the user opens the app 3 times a day, this makes 9 seconds of waiting or 35 secs a week. If you have 1 million users, your users will wait for 35000000 secs or 583333 minutes or  9722 hours A WEEK! Just let this huge numbers sink in

What a waste of time!

On the other hand Google advocates using splash screens. You can find it here in the material design guidelines. All Google apps like Youtube, Mail or others using splash screens! But they only let the user wait the minimal time necessary for the app to load! Not a second longer.

 

Implement a splash screen

 

So at first you will need a simple layout in xml which defines your splash screen. A minimal one with the app logo centered is enough! This could look like this:

  1. <?xml version=”1.0″ encoding=”utf-8″?>
  2. <LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
  3. xmlns:tools=“http://schemas.android.com/tools”
  4. android:layout_width=“match_parent”
  5. android:layout_height=“match_parent”
  6. android:paddingBottom=“@dimen/activity_vertical_margin”
  7. android:paddingLeft=“@dimen/activity_horizontal_margin”
  8. android:paddingRight=“@dimen/activity_horizontal_margin”
  9. android:paddingTop=“@dimen/activity_vertical_margin”
  10. android:orientation=“vertical”
  11. tools:context=“.SplashActivity”
  12. android:gravity=“center_vertical|center_horizontal”>
  13. <ImageView
  14. android:layout_width=“200dp”
  15. android:layout_height=“200dp”
  16. android:id=“@+id/imageView”
  17. android:layout_centerHorizontal=“true”
  18. android:layout_alignParentBottom=“false”
  19. android:background=“@drawable/logo” />
  20. </LinearLayout>

This will create an layout with a 200dp squared logo centered. Dont overload the screen with text, logo and other stuff! In the best case this screen will stay less than a second and the user dont have enough time to read everything!

In Java you just load your app and then proceed to the next activity as soon as possible

  1. protected void onCreate(Bundle savedInstanceState) {
  2. super.onCreate(savedInstanceState);
  3. setContentView(R.layout.activity_splash);
  4. // Here do some bootup stuff, but nothing long loading.
  5. Intent intent = new Intent(this, MainActivity.class);
  6. startActivity(intent);
  7. finish();
  8. }

And thats it. You may request the permissions before calling the intent, but there is no more magic. With this you have an activity as splash screen which only stays for the minimal needed time and not wasting your users time.

Day in a life: Android Developer

Published / by glethien / Leave a Comment

Let us talk about what I did for the last year. After college Ive started working as Android Consultant, which had its ups and downs. This is what I want to talk about today and how a normal day looked like.

A normal day for the last year

As being a consultant normally includes a lot of travelling I will devide this into two subsections. The first for the time I was at our office and the other section about travelling.

For the whole time I was assigned to the same project. This project includes travelling every second weeks. I am not allowed to talk about the project or for which company weve worked, but I will try to give a general overview about how such a project works.

Weve used SCRUM for organizing our daily work. SCRUM is an agile framework for managing software projects which short, normally two weeks, iterations. The big advantage is that the customer or project owner can change his mind about nearly every detail every two weeks. This two weeks iteration is called SPRINT. Each sprint contains several tasks. The amount of tasks depends on the velocity of the team and the complexity for each single task. We need to keep this in mind for later. For more details about SCRUM, just ask Google or Wikipedia. One little and important thing: Each day the team has a short meeting about the progress. In this meeting you are just telling the team what you did yesterday, what you are planning for the current day and if you have any problems.

Office days

Normally, during the days in our office, Ive started the day which slack. Slack was our main tool for communication. As I started working early, I was also the first person to leave work. So I started with reading the messages and mails when I was gone. Depending on the problem this took up to 10 minutes each day. After this Ive logged in to the VPN and took a look at our SCRUM board. The board contains the tasks for the sprint and you can see which developer is working on which tasks. It also provides a basic idea about the progress for each task.

If I was done with my tasks and there were unfinished tasks left, I started working on a new tasks or told my coworkers that I have some capacity left and could help them, if needed. A task was done when a short Definition of Done was completed. This means that the Unit tests are green, the merge request was successful and at least one developer took a short look at your code, regarding style, bugs, smells and so on. After all this was completed the task had to be burned, which means that we presented our work to the customer. If he was statisfied with our work, he approved the task otherwise we had to do some refactoring. We called this process burning. Depending on the complexity of a task this could take about one hour.

Slack was present nearly every minute. Asking coworkers, the product owner or sometimes the SCRUM Master is a very important part of being a developer, regardless for which platform or programming language! We used slack also for discussing how to implement things, asking questions about parts of the code you dont know and where to find something.

Each week when I was in the office contained the grooming. Grooming is a relativly long meeting with the analysts in which the developer team is sizing the tasks for the upcoming sprint.

The days in the office were pretty straight forward: Searching for a free place to work, setting up notebook, putting on headphones and starting the daily routine describes above.

Travelling week

As a sprint is two weeks long, we need to plan the next sprint every two weeks. As the customer was part of this meeting and the planning is very boring aswell as time consuming, we all meet in person.

For me this means a lot of travelling and a lot of time in the air. Our first meeting was at 10:30 am which means I had to get up at 4:30 am, starting with my morning routine (sometimes a bit slower) and leaving at 5:40 heading to th airport. At the airport go throu security check, waiting in line at the gate and finally getting into the plane. The flight was about 50 minutes, then leaving the plane at roughly 9:00 am. I personally made use of the public transportation system as much as possible but other colleges prefered to get to the customer by taxi.

The first meeting was a presentation of the work done last sprint for the customer. Each workbench (iOS and Android) presented their work in a 15 20 minutes timeslot. Normally the customer is asking questions about the layout, behaviour or other little things afterwards.

When the presentation was done, we meet in private without the customer for our retrosepctive. We talked about the good things and the bad things, problems of the last sprint and wishes for the upcoming sprint. In average I was able to be at the hotel at 16:30 pm. Most of the time I was really tired and exhausted so I wasnt in the mood to leave the hotel. Most of the time I went to the next grocery store and bought myself dinner. Later when I got used to this routine I started running and afterwards enjoying my dinner on the bed and watching TV. Ive seen a lot of different hotels which are close to the customer and most of the time it was not possible to watch Netflix or something similar.

The next day was breakfast between 7.30 am and 8:00 am and heading back to the customers HQ for Planning 1 and Planning 2. So a day full of sitting around and talking with others. This may sounds interessting but I can tell you, noone (not even the customer) was enjoying this. I was long, boring and full with senseless discussions. If you have some people with economical background in your team, I feel sorry for you At roughly 4 pm I was heading back to the airport. Same airport routine as the day before. It was very exhausting so when I was back home at 9pm (planned) I got directly into my bed. Most of the time the organization at german airports is very bad, so the planned time of departure was nearly never correct. Planes got cancelled or delayed one or two hours, which means spending more time at the airport, without getting much overtime.

 

Conclusion

The part about programming and development was very cool with nerdy coworkes. The other things like wasting my lifetime at airports, in hotels or in senseless and boring meetings made me rethink my descision about being a consultant. On the one hand you get into very different projects with different technology, on the other hand you will loose a lot of your sparetime. I think this is just a personal descision. I am happy and exited to start my new inhouse job next month!

Things every new Android Developer should be aware of

Published / by glethien / Leave a Comment

Walking through the world you can see mobile devices everywhere and if you are a developer or want to become one, you may come to the conclusion that development for mobile devices seems to be a great idea. You are right! But first make sure you know the following things, which I think are essential for every android developer!

 

Basic understanding of Android Architecture

If you start working on a new platform you should at least read one or two articles about the platform. This applies to android too. You can start with this tutorial which will give you a basic understanding. From my point of view this should be more than enough to know. With this knowledge you are able to understand what is happening and why something works as it is. This leads to better source code and more stable apps!

Java

As you will use Java for developing your apps, you will need a good skillset in Java. If you do not feel secure using asynchrous thinks, listener and other basic Java funcionalities, you should read about basic Java topics and gain confidence, so you can focus on the android related things.

Android Studio

You have the possibility to choose between Android Studio and Eclipse as you IDE. I highly recommend using Android Studio! Its based on IntelliJ and Google implenented a lot of nice features into Android Studio which will make your development much easier and enjoyable. Learn the shortcuts and where to find the important settings, files and make yourself known to the UI tools.

Activity and Fragment Lifecycle

Activites and Fragments will be your be your daily bread. Both of them have a slightly different lifecycle which you should know. The lifecycle is important to know when to load, when to unload or when to cancel open network connection as well as database handler. The official documentation for Android does have a very good description which you can read here. In short: When the system calls the onResume() you should open the database connection and when onPause() is called you should close the connection again (if you havent done before). This ensures that there is no leaked connection which can be abused.

Passing data between Fragments

There are a lot of ways to pass data between Fragments and I would say there are a lot of advantages and disadvantages for each method. Here is the one method I am using.

First I create the Fragement and in give it a static method.

  1. public static MyFancyFragment newInstance(final DataModel model) {
  2. MyFancyFragment instance = new MyFancyFragment ();
  3. instance.setArguments(new Bundle());
  4. instance.getArguments().putSerializable(“DataModelField”,model);
  5. return instance;
  6. }

The other important part is to parse the serializable back into the DataModel and store it in the fragment.

  1. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  2. View view = super.onCreateView(R.layout.my_fancy_fragment_layout, inflater, container, savedInstanceState);
  3. dataMode = (DataModel) getArguments().getSerializable(“DataModelField”);
  4. return view;
  5. }

Thats it. If you want to create a new instance of the fragment, just call newInstance and pass the DataModel as parameter into the fragment. Your data will be available after onCreateView is called. As this is part of the lifecycle, this method is called for sure! This isnt the best way or the worst way, it is just one way to do it. I recommend to take a look at other approaches and adapt the one which fits most for you.

dp vs pixels

Pixels are the actual pixel on the screen. Pretty straight forward. Problem is that nearly every device has a different resolution. Using pixel it will be impossible to create a resolution independent layout. Therefore Android introduces dp. dp stands for Density-independent Pixels and is a fictional unit for creating UIs. 1dp is roughly 1px on a 160 dpi screen. For any other screen the actual amout of pixel for 1 dp is calculated by the device.

Debugging your app

Android proves the serveral methods for debugging. You have the full log in AndroidStudio, you get crash reports in you GooglePlay Console after youve released you app, but most important is to write your own log outputs. Luckily this is very easy as you just need to call the static method

  1. Log.d(TAG, “onCreate() No saved state available”);

You can set a specific TAG, which is maybe something like network, database, fancyShit or everything else. After that just add a filter for the logcat and you will only see messages with the specific tag. In addition AndroidStudio provides methods for CPU usage, GPU usage and finding memory leaks. You should make yourself familiar with those tools! It will save you a lot of time.

Googles Plans

Currently the process in the world of mobility is very fast, so as a professional android developer you should know what the next fancy stuff is and when it will be available, so you can make use of it. For starters you can checkout the android twitter account or the android developers Youtube channel. Once a year Google is host of the Google IO, a annual developer conference with focus on sessions and lesson about developing for mobile and web with Google.

Material Design guidelinbttes

Users expect a specific behaviour of an app and where to find what. Google tried to make a standart for the layout. I advise you to follow those guidelines, as it will improve the user experience. A coworker once said, that you must assume that the human cursor has at least a 1cm diameter. Image having tiny buttons close together Most likely you will never hit the right one and getting frustrated. You can find the material design guidelines here

Most likely: you wont be successfull

For each of you the most important point: YOU MAY WONT BE SUCCESSFULL

This sounds harsh but this might be the only truth you will need. Currently there are more than 2 million apps! Dont expect to publish one or two apps and land the next hit! This CAN happen and I would be very happy for you if it does, but dont relay on it. Maybe you idea isnt even new. Just take a look at how many clones of CandyCrush you can find on Google Play Store. With more than 2 million apps available, its very hard to find your app! Do it just for you! If you really want to have some more downloads, think about spending money into marketing your app!

Crazy Chicken

Published / by glethien

This game was created during the summers semester course “Softwareentwicklungspraktikum”. It was a collaboration with Dennis Franke, Sören Petersen, Ariana Prekazi, Maximilian Töpfer and Vildan Bagyetistiren and myself. The aim was to develop a relativ big software. In this case we had to create a game using the first version of the kinect. We also had to do the documentation and everything that has to do with professional software development.

ccmenuThe software was written using C++ and an older version Ogre3D. As
you can see the main character is a bird which is controlled using your arms.

 

This game also includes a minor story which is roughly that the bird died and finds himself in heaven. The only question is: Why am I here?!

With this question in mind he heads back to earth to find out why.

 

 

The first level takes places above the clouds. It is designed to make yourself familiar with the controlls. ccstoryJust collect as much fruits as you want. As soon as you heading downwards beneath the clouds, you will find youself in the 2nd level.

Here you have cclevel2to escape the darker clouds, and collect fruits until you reach a specific score. Hitting a dark bad cloud will draw you energy.

 

The last level will take place in a maze where you’ve found your enemies: The moles! For an unknown reason they killed you! You know have to take revenge! With a special gesture you poop eggs! You have to hit the moles in this level! But attention, the moles are throwing coffe machines at you!!!
cclevel3

Master thesis

Published / by glethien

AGTReha is a computer-based TeleReha application, which is designed to support and guide rehabilitants after their stationary therapy in their home environments. Long term secondary prevention in home environments is a very important aspect in maintaining the newly recovered functionality of the locomotory system. The learnt exercises have to be integrated into the daily routine of the rehabilitant. For making the integration and surveillance much easier, AGTReha has been developed.
In this master thesis the first version of AGTReha will be analyzed regarding the weaknesses and possible improvements. Based on this analysis new challenges for the in this thesis developed second version of AGTReha are extracted.
After the implementation of the new version an open, anonymous, experimental and not controlled study will be performed. The study should verify the quality of the user interaction and the graphical user interface for maximizing the positive experience of the user.

 

Download the thesis here

Link to project page