Thursday, 19 January 2017

Understanding API

API is an acronym for “application program interface.” It’s a technical development environment that enables access to third party’s application or platform. An API also specifies how software components should interact. The most famous, and most often used by mobile developers, is Facebook’s API. It allows mobile developers limited access to the profile identity of Facebook members to verify identification on login. It also enable Facebook members to sign up for a third-party app like Candy Crush using their Facebook account. Facebook’s API also allows their own users to post content to their News Feed from third-party mobile applications they’re using. Like Facebook, Twitter has an API that can also be used by third-party mobile developers to identify their users on sign up and to enable users to post content easily from an app to their Twitter account.

In layman term, it's basically a collection of methods. As we know, in order to use any method we need to pass some arguments in most of the cases. Which, in turn, returns some results based upon the arguments passed. So is the case with APIs. We don't use APIs only for sign up or login but also for the interactions with databases. Say, I have an Android App and I want to use MySQL database for my app. I would love to have an API through which I can interact with my database for this App. Like, I just need to pass my values to a given method of the API and my data will be saved into the database. On the other hand, we can also fetch the data from the MySQL database by calling the appropriate method with the correct request parameter.  If you are writing an API then it's a good practice to perform all the validation or verification by your end as well. It will prevent your database from storing any irrelevant entries in the database.

 

Thursday, 12 January 2017

Concept of Adapter in Android



Use of Adapter is a very common practice in Android development. As per the standard definition,

An Adapter object acts as a bridge between an AdapterView and the underlying data for that view. The Adapter provides access to the data items. The Adapter is also responsible for making a View for each item in the data set.

In a layman term, we use an adapter to place data from one place to another place. Here in the definition above, “Adapter View” can be considered as the source and the “underlying data” as a destination. We generally use an adapter for the dynamic data. For example, let’s say we have a list view of tcountry name. As we all know, a list view is nothing but a collection of items(or rows). Where the structure of each row remains same. When we use an adapter, we create just one item’s structure and pass this structure to list view. All we need to do is to design just one ROW of a list view. Depending upon that row, we decide which kind of adapter to be used. We need to create a new XML file for the designing of our row (or the item of a list view). Also, It’s a good practice if we keep adapter operations in a different class(or .java file).

There are so many types of available in android, like...




Array Adapter and Custom Adapter are the most used Adapter(at least in my case). We can use Array Adapter if we have only one item. It could be of any type like <String>,<Integers> etc., While we use custom Adapter if we have more than one item.

Let’s say we have to show the list of user name in a list view(only Name) which Adapter should we use ?
----> ArrayAdapter

Now, what if we also need to display the profile pic along with the name of the users ?
----> Use CustomAdapter

The layout which we create (i.e., a separate XML file also called AdapterView), defines the content of the rows for any list view. The ListView waits for its row in another XML file. And then the role of Adapter comes into play. We write Adapter.java(Obviously, you can name it anything) file which acts as an interface between these two XML files. Means, through our code we change the data for each row of the list view.

It took a great amount of time for me to clear this Adapter concept. I thought of sharing my understanding with you all. Please comment below for any further clarity or modifications required to this post.





Thursday, 5 January 2017

Welcome 2017


Welcome 2017
Hello Guys,
First of all, Happy New Year to all my readers. This month(on 19th of Jan) I will complete my 6 months with HeaderLabs. In this blog, I would like to share my experiences of past year which includes the last five months with HeaderLabs as well.

Jan-June, 2016
I was pursuing my final semester of Masters of Engineering. I was preparing hard for the placements along with my thesis work. Though it was hectic, but I didn’t mind. I knew life would be even harder in coming future. Looking at the present scenario, I am proud of my prediction skills. It wasn’t easy for me to get a placement due to eligibility criteria's which I already knew. I was still working hard coz you never know....things can be changed anytime. Finally, in the month of June, HeaderLabs visited our campus for the first time. I was eligible, that’s perhaps the best part for me. I appeared, gone through all the rounds, and the best part was I got selected. I was extremely happy. Why shouldn’t I ? I had opted for double Masters only for a technical career. So, 2016 was the year which is hard to forget for me.

July-Dec, 2016
My joining date was 19th of July, 2016. I have already written about my first 3 months experience at HeaderLabs here. I would like to talk about the journey here at HeaderLabs after September. I was still learning Android and was working parallelly on a module as well. When you learn something, get an opportunity to apply your learning instantly, I think it's the best case. I was lucky enough to get that opportunity.

Year 2017
This year some new leave policies, working hours and an interesting activity like silence zone have been introduced and applied. You must have heard about all but the silence zone. Well, It's like during 08:30 AM - 11:00 AM we are not supposed to make any kind of noise and the same applies to our belonging devices as well.

I have set some targets which I will accomplish by the end of this year. It's basically mix up of both professional and personal targets. I'll keep posting about my learnings and experiences in my coming blogs.
Have a good day !