Langsung ke konten utama

Postingan

Menampilkan postingan dari Juli, 2016

Image loading with Glide

Image loading seems like an easy task at the first glance but as every task, it has its' own caveats. First of all, you probably want to do this asynchronously because you don't want to flood your main thread with that kind of tasks. Then, you want to cache images so you don't load them every time your activity of fragment resumes. You need to handle error cases when the network is not available or server is sending you garbage or doesn't send anything at all. If you don't do this it will definitely harm the user-experience. After all, you probably need to do some pre-processing steps before showing the image to the user such as cropping, resizing, reversing etc. Also, it would be convenient to have an easy way to set an image in an ImageView. You may ask: "Why do you think that you know what I need and want?". The answer is that you're not alone. Android developers already made tons of apps that use pictures from the network. And what happens when man

Introduction to Firebase Database for Android

I've already written a post about Firebase and its' features but features highlighted in the post are additional to the core functionality of Firebase. What is this core functionality? Well, this is the thing that Firebase started from. It's Realtime Database . A real-time database is, basically, the database that can effectively store dynamic data. By dynamic, I mean data that is constantly changing for example stocks prices. Firebase Database So Firebase has its' own built-in real-time database which you can use as a backend for your app. Let's consider the structure of this database. First of all, it's worth to mention that this database is not relational and doesn't use tables as you might expect. It uses JavaScript Object Notation (JSON)  to store the data so it's kinda "object-oriented" database.  I think that this it an advantage at least for developers because JSON, in my opinion, is easier to understand than relational tables if you&#

What is Content Provider

Today I will continue my "What is *Android component*" series and tell you about one of the essentials parts of an Android application a content provider. Previous posts from this series: What is Activity What is Fragment The problem First of all, let's consider the problem that this component is meant to solve. It's often useful for applications to retrieve data from other apps on the smartphone. Many pre-installed Android apps have the data that can improve the user experience of other apps.  For example, phone book has information about the people that are probably your friends and it can be used by social networking app like LinkedIn to connect with someone you know in this social network. User dictionary has information that can help users type faster by providing them with the most used words when they use a custom keyboard. So, it would be convenient to have some tool that can share those kinds of data. Something that would provide a consistent interface across

QR-Code Generator - Library

In this Post, I introduce my new Gradle Library. This Library is used to Generate QR Code Automatically for our specified input. How to Import the Library: Gradle: compile 'androidmads.library.qrgenearator:QRGenearator:1.0.0' Permission: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> How to use this Library: After importing this library, use the following lines to use this library. The following lines are used to generated the QR Code // Initializing the QR Encoder with your value to be encoded, type you required and Dimension QRGEncoder qrgEncoder = new QRGEncoder(inputValue, null, QRGContents.Type.TEXT, smallerDimension); try { // Getting QR-Code as Bitmap bitmap = qrgEncoder.encodeAsBitmap(); // Setting Bitmap to ImageView qrImage.setImageBitmap(bitmap); } catch (WriterException e) { Log.v(TAG, e.toString()); } Save QR Code as Image // Save with location, value, bitmap returned and type of Image(JPG/PNG). QRGSaver.save(s

Top 6 learning resources for Android Developers

In my opinion, learning is a lifelong process, and that's a popular point of view today mainly because it's information age. Knowledge now is the most powerful tool, not the only one that is needed for success, though. Furthermore, without it, no other tool can help you achieve it. I think that you already know the importance of learning if you read this blog. So today I'll give you my top 10 learning resources for Android Developers. 1. Udacity Udacity  is my favorite online-learning platform. And I think it'll always be. The enthusiasm and passion with which its' CEO and co-founder Sebastian Thrun develops and maintains the platform are encouraging. First of all, it worth to mention that Udacity is not an Android tutorials platform. There are a plethora of courses and nanodegrees for different professions and specialties, such as iOS, web development, tech entrepreneurship, machine learning, cloud computing and so on and so forth. With his platform, Sebastian Thru

What is Fragment

The concept of a fragment is tied very tight with the concept of an activity. And if you don't understand clearly what activity is I encourage you to read last week's post first and then return to fragments. Also, here's the post that will help you to get a nice overview of basic Android classes such as Context, Activity, Fragment, Thread etc. What is the problem With the growth of popularity of Android system more and more developers started to pay attention to it. More and more apps were developed for Android and it entailed more and more complexity in these apps. In particular, this complexity was growing in activities and layouts. Possible solutions First of all, developers wanted something that would be reusable in several activities. And this, as I think, gave a birth to ActivityGroup .  As the documentation says it's A screen that contains and runs multiple embedded activities which seems like a bit overhead. In this implementation, every activity has its'

Java Mail API using GMAIL OAuth API in Android

Hello friends, In this post, I will show how to send mail with GMail using OAuth2.0 in Android. This Project contains a lot of steps like Permission, Google Play Service check to do. So, please download the project to perform GMail API completely. First of All, we have to generate OAuth key in Google API Console . To Generate OAuth Key , use your SHA1 key and your app's Package Name as in your Manifest.Paste Following code in your Command Prompt to get SHA1 key in Windows keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android Project Structure Create a new Project in Android Studio with the required Specifications. AndroidManifest.xml Don't forget to add the following permission in your manifest file. <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <!--Added for Accessing External