<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Miguel Munoz</title>
    <description>The latest articles on DEV Community by Miguel Munoz (@mauriciomunoz).</description>
    <link>https://dev.to/mauriciomunoz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F407660%2F7ce4f35b-dd6e-4eb6-824c-02a0980a25fb.jpeg</url>
      <title>DEV Community: Miguel Munoz</title>
      <link>https://dev.to/mauriciomunoz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mauriciomunoz"/>
    <language>en</language>
    <item>
      <title>Android basics: Main components</title>
      <dc:creator>Miguel Munoz</dc:creator>
      <pubDate>Mon, 31 Aug 2020 17:03:57 +0000</pubDate>
      <link>https://dev.to/mauriciomunoz/android-basics-main-components-2hkk</link>
      <guid>https://dev.to/mauriciomunoz/android-basics-main-components-2hkk</guid>
      <description>&lt;p&gt;In my first post about the Android interviews I write about the Main components of an Android Application.&lt;/p&gt;

&lt;p&gt;All of us, we can read a lot of theory but sometimes is easier to see the code and test it. For me I learn better practicing.&lt;/p&gt;

&lt;p&gt;I decided to create a project showing how the main components works.&lt;/p&gt;

&lt;p&gt;If you want to check it this is the link:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Mauriciomunoz/AndroidComponents"&gt;Android components Project&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can do a fork and modify it.&lt;/p&gt;

&lt;p&gt;If you have any doubt feel free to contact me. I will be glad to share my knowledge and learn from others.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you and good coding!
&lt;/h2&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;p&gt;If you like my post and want to help me, you can buy me a coffee:&lt;br&gt;
&lt;a href="https://www.buymeacoffee.com/MiguelMMunoz"&gt;https://www.buymeacoffee.com/MiguelMMunoz&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If any of my post have mistakes, I am open to any feedback. Sometimes I could do bad explanation, so any comment is welcome. Together we can create a better guide to study and learn.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>project</category>
      <category>basics</category>
      <category>interview</category>
    </item>
    <item>
      <title>Android interview: ANR</title>
      <dc:creator>Miguel Munoz</dc:creator>
      <pubDate>Tue, 28 Jul 2020 23:16:50 +0000</pubDate>
      <link>https://dev.to/mauriciomunoz/android-interview-anr-12hb</link>
      <guid>https://dev.to/mauriciomunoz/android-interview-anr-12hb</guid>
      <description>&lt;p&gt;In the last days, my company gives me the task to do some short and simple interviews to applicants for the Android position.&lt;/p&gt;

&lt;p&gt;One of the questions is about ANR. This question is one of the main ways to know if a developer knows about Android and sometimes is one of the questions in the top companies.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;But, what is an ANR?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;An ANR or Application Not Responding, is a simple error caused by the block of the UI Thread.&lt;/p&gt;

&lt;p&gt;If the UI Thread is blocked for 5 seconds or more, we are going to get this issue and a Dialog will be showed asking if we want to wait or close the app.&lt;/p&gt;

&lt;p&gt;This happens because maybe we have a long-performance task and Android can't draw in the UI Thread or can't receive any event from the user.&lt;/p&gt;

&lt;p&gt;The cause of this could be a lot of things, but if you understand what is an ANR, you will be able to find the issue that is causing it. It could be a long task trying to do download something or maybe a large image trying to get showed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If any of my post have mistakes, I am open to any feedback. Sometimes I could do bad explanation, so any comment is welcome. Together we can create a better guide to study and learn.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>interview</category>
      <category>theory</category>
      <category>questions</category>
    </item>
    <item>
      <title>Android interview: Services, AsyncTask and Thread</title>
      <dc:creator>Miguel Munoz</dc:creator>
      <pubDate>Tue, 21 Jul 2020 15:37:15 +0000</pubDate>
      <link>https://dev.to/mauriciomunoz/android-interview-services-asynctask-and-thread-882</link>
      <guid>https://dev.to/mauriciomunoz/android-interview-services-asynctask-and-thread-882</guid>
      <description>&lt;p&gt;The next topic in my head is about other important question in the theory for Android: Services, AsyncTask and Thread.&lt;/p&gt;

&lt;h1&gt;
  
  
   &lt;strong&gt;What is a Service?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;In my own understanding and after I read a lot of documentation, a service is a task used to run for a long time in the background.&lt;/p&gt;

&lt;p&gt;An example of this, if you want to play music, download a big file, constantly checking an event, etc.&lt;/p&gt;

&lt;p&gt;There are a different kind of services:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Foreground service:&lt;/strong&gt; this kind of service notify to the user that the service is running. Usually with a notification. When you download an image in any browser you can see a notification for it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Background service:&lt;/strong&gt; this service no shows anything. Is used to perform tasks as compress data or upload some status or information to a server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bound service:&lt;/strong&gt; A service doesn't have a UI. So, if you need to inform something to the user, you will need to Bind the service to an Activity. When you play a song, you can get the length of the song or maybe the time where the music is going. To get this event a Bound Service is used.&lt;/p&gt;

&lt;p&gt;When we talk about Services, we can't forget the IntentServices. An IntentService is a kind of service used to run a queue of tasks. This help us to do several tasks in the background one by one. One example of this could be when you download a playlist in Spotify or download a bunch of files from WhatsApp. An IntentService enqueue each task and when it finishes the Services is finished to start the next one.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;So, how about AsyncTask?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;AsyncTask is another way to do work in the background, but, differently to the Service, AsyncTask is used to perform short-running tasks.&lt;/p&gt;

&lt;p&gt;If you need to load an image, or maybe to get some information from a server, or any process you know won't take much time, AsyncTask is there for the work.&lt;/p&gt;

&lt;p&gt;Is necessary to remember that AsyncTask usually is attached to an Activity, this could be just to load something into the UI or maybe to get information to be used in another process. In any case, if the activity is destroyed before the AsyncTask finishes his process, could cause a memory leak, because the AsyncTask will have the old reference to the activity and if needs to update UI that has been destroyed could cause a crash.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;And finally, what are those things called Threads?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;A thread is another way to perform a background task. In this case, a &lt;code&gt;Thread&lt;/code&gt; runs in his own thread until the task is finished. This is useful when you try to download files or load information and you want to avoid ARNs.&lt;/p&gt;

&lt;p&gt;A thread will be finished by itself, so, if we need to perform long-running task we are going to need a Loop, which is an element to keep running a thread until we need to finish.&lt;/p&gt;

&lt;p&gt;In the same way, if we need to get information from the thread, we are going to need a &lt;code&gt;Handler&lt;/code&gt;. This component will help us to communicate with the thread (remember, a thread runs in his own thread).&lt;/p&gt;

&lt;p&gt;I hope this information can help to understand in a better way how this elements works and why are similar. In some interviews this question is important before to go to the technical interview, it shows you have the main understanding of how Android works.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If any of my post have mistakes, I am open to any feedback. Sometimes I could do bad explanation, so any comment is welcome. Together we can create a better guide to study and learn.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>theory</category>
      <category>interview</category>
      <category>questions</category>
    </item>
    <item>
      <title>Android interview: Activity Lifecycle</title>
      <dc:creator>Miguel Munoz</dc:creator>
      <pubDate>Fri, 17 Jul 2020 05:46:59 +0000</pubDate>
      <link>https://dev.to/mauriciomunoz/android-interview-a-personal-journey-2-4k9k</link>
      <guid>https://dev.to/mauriciomunoz/android-interview-a-personal-journey-2-4k9k</guid>
      <description>&lt;p&gt;Following with my post about all those android interview questions, this is one of the most important and in most of cases recruiters from Facebook or other top companies uses to evaluate a candidate to know if is worth it to send him to the technical interview.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is the lifecycle of an Activity?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Well, the lifecycle is the path of actions that an activity follows from start to finish.&lt;/p&gt;

&lt;p&gt;These actions are the next methods: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OnCreate()&lt;/strong&gt; - Called when the activity is created. This callback is called once in all the lifecycle. Use this when you need to initialize data or do something just once.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OnStart()&lt;/strong&gt; - This is called when the activity is visible to the user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OnResume()&lt;/strong&gt; - After OnStart() is finished, the app enter into OnResume(). This is the state where the app interacts with the user. If any event interrupts the app (receiving a phone call, move to another activity, screen turn off) the state will move to OnPause() if the user goes back to the app, OnResume() will be called again, that’s why here is just necessary to initialize the objects released in OnPause() state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OnPause()&lt;/strong&gt; - This method is called when the user left your activity, but this doesn’t mean the activity is destroyed. It just mean the activity is not in the foreground like when a Dialog appears or some event interrupts the app execution. You can use this state to free resources like GPS or any resource that could be affect the battery life.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OnStop()&lt;/strong&gt; - Is called when the activity is not longer visible to the user. Here you can stop animations to free resources. After goes back from OnStop() the OnRestart() method will be called.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OnRestart()&lt;/strong&gt; - It comes from OnStop() state and is followed by OnStart().&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OnDestroy()&lt;/strong&gt; - This method is called if Android have low memory and needs to free resources. Also can be called using Finish().&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;If any of my post have mistakes, I am open to any feedback. Sometimes I could do bad explanation, so any comment is welcome. Together we can create a better guide to study and learn.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>interview</category>
      <category>questions</category>
      <category>theory</category>
    </item>
    <item>
      <title>Android interview a personal journey</title>
      <dc:creator>Miguel Munoz</dc:creator>
      <pubDate>Fri, 17 Jul 2020 05:30:55 +0000</pubDate>
      <link>https://dev.to/mauriciomunoz/android-interview-a-personal-journey-51ef</link>
      <guid>https://dev.to/mauriciomunoz/android-interview-a-personal-journey-51ef</guid>
      <description>&lt;p&gt;This is my first post. Like a lot of programmers I am trying to get better in my career but sometimes is not easy and sometimes we can't find where we can start.&lt;/p&gt;

&lt;p&gt;For me, has been a long journey and the most of time I have been lost.&lt;/p&gt;

&lt;p&gt;I found this community some weeks ago and I decided I could write something. Something I can use to study and I can share to other programmers like me.&lt;/p&gt;

&lt;p&gt;Soon, I will have some interviews. I will collect in this post some of the things I am studying. Just Android Theory.&lt;/p&gt;

&lt;p&gt;All this information is not copy-paste, I read and I am sharing my thoughts. It could be mistakes in definitions. I am trying to explain with my own words and understanding.&lt;/p&gt;

&lt;p&gt;I have been in both sides as an interviewer and a interviewee. I will share with you some of the most important questions I got in all my past interviews as an Android developer.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Do you know the android components?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Android contain 4 main components, these are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Activity: is the first component that a programmer knows in Android. Is a simple screen with UI. An Activity contains an xml where the UI is programmed and a class with all code related to the actions of activity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Services: is a component used to keep an app running in background. A service doesn't have a UI and is used mostly to perform long-running operations. This operations could be play music in background or download data when the user is in other app. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Broadcast receiver: this component helps to communicate the system with an app. The system can launch an event to send a message saying the battery is low or the screen has turned off and the app can catch this event with a Broadcast receiver. Is not necessary the app is running to get an event from the system, for example an app can schedule an alarm to launch a notification, even the app is not running the notification will be showed. Also, an app can launch a Broadcast Receiver to send a message to other app, for example an app warning other app about some data has been downloaded.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Content providers: Is a shared set of data. For example, Android system provides a content provider for the user's contact information. With this content provider any app with proper permissions can access to the user's information to read it or write on it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;If any of my post have mistakes, I am open to any feedback. Sometimes I could do bad explanation, so any comment is welcome. Together we can create a better guide to study and learn.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>interview</category>
      <category>theory</category>
      <category>questions</category>
    </item>
  </channel>
</rss>
