Android Studio Error Log

Here are all of the errors I’ve encountered in Android Studio, what they mean, and how to solve them.

(This will be updated regularly)

android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity; context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

I got this error by creating an adapter from MainActivity like this.

adapter = new MainCardAdapter(getApplicationContext());

Then in the adapter, I attempted to create a new Intent and start that Intent.

public MainCardAdapter(Context context)
    this.context = context;

public void onClick(View v)
    Intent i = new Intent(context, ResumeSectionsActivity.class);

The error came up because I was starting the new task from outside of the activity. I thought this was odd because I passed “GetApplicationContext()” for an argument. I thought that would include the MainActivity but apparently it does not. I fixed this error by sending “this” as an argument for context like so.

adapter = new MainCardAdapter(this);

The Floating Action Button

Floating Action Button’s are those neat little buttons you see generally in the lower right corner of an app. They perform some sort of positive action like creating something, like an email or a text. We’re going to see how to add a simple Floating Action Button (hereafter referred to as FAB) to an activity.

For an excellent list of design considerations when creating FAB’s, see Google’s page here.

Add the Gradle Dependency

In your “build.gradle (Module: app)” file, add the line

compile '’

Where the x’s are your apps support library version number. This should be the same as the ‘’ number.

Add an Image for Your FAB

Add a vector asset to be used in your button by right clicking on your Drawable folder, and going to New -> Vector Asset.


Before you finish adding the icon you want, (I added the plus symbol, called “ic_add”), change the word black to white. We won’t actually change the color here because we need to create the file first but it’s easier to change the name now than later.

Change the Icon Color

Once you’ve created the icon, it will be added to your Drawable folder. Double click on it to open the file. Change the fillColor from “#FF000000” to “FFFFFFFF”.

<vector xmlns:android=""

Now Code the FAB

Now add the Floating Action Button in your activity_main xml file.


AlignParentEnd and AlignParentRight are in there to support Right-To-Left (RTL) layouts, where the end would actually be the left.

If you add the FAB and get rendering errors, go to the Build menu and click on Clean Project. If this doesn’t fix it and you get an error that says “Exception raised during rendering: Unable to locate mode 0” this is because of a bug in the 25.0.0 library. Update your library and this should go away.


Respond to Clicks

Now in Main Activity, add the reference to the FAB and add the click listener

public class MainActivity extends AppCompatActivity
    FloatingActionButton fab;

    protected void onCreate(Bundle savedInstanceState)

        fab = (FloatingActionButton) findViewById(;
        fab.setOnClickListener(new View.OnClickListener()
            public void onClick(View view)
                Toast.makeText(getApplicationContext(), "I've been clicked", Toast.LENGTH_SHORT).show();

There you have it! A fine looking Floating Action Button!


First Things First – Download Android Studio

You've decided you want to take the leap and see what Android development is all about.  Well let's tackle jump the first hurdle and download Android Studio, the official development environment for Android software.  There's going to be a few terms that come up a lot during this process so let's knock those out of the way now.

The Acronyms

  1. IDE - Integrated Development Environment.  This is where you will do all of your programming, debugging, editing, and publishing.  Basically, it is the piece of software that takes you from the very beginning of your project to the very end.  Android Studio is the IDE we will be using for Android apps.
  2. SDK - Software Development Kit.  This is the set of tools you will use to design your software for a specific platform.  We will be using the Android SDK which is included with Android Studio.  This will allow us to build Android apps, but unlike an IDE, cannot be used to build apps for other platforms.
  3. API - Application Program Interface.  These are sets of tools used to build specific more software.  Say you wanted to write an app that included a way to post to Facebook.  You would have to use one of Facebook's API's to interact with their platform.
  4. AVD - Android Virtual Device.  This is the emulator, a piece of software that will replicate the physical device you want to test your app on.  If you have an Android device, and its recommended that you have one if not more, you can use that too.  But an emulator allows you to set up different screen sizes, memory capabilities, pixel densities and much more.  You can test your app on a wide variety of different devices without having to shell out the money for them.

The installation

Those are the big ones you need to worry about in the beginning.  Now let's get to the good stuff.  The first thing you do is navigate to the Android Studio home page and click the big, green download button. 


Agree to their terms, click the final download button and save the executable to your downloads folder.  When this is done, navigate to that downloads folder and start it up.  Next you'll see this screen so click next and follow the on screen instructions.


On the next screen we're asked if we want to install the SDK and the Android Virtual Device (AVD).  Remember those?  We definitely want those so keep them selected and click next.


Then just agree to their terms if you feel so inclined.  On the next page, just leave the locations the same for Android Studio and the SDK unless you have reason to change them.  On the last page, hit Install, and let Android Studio do it's thing!

That's it.  Easy peezy!  Stick around and we'll go through learning your way around Android Studio in another post.

A Good Programmer is like a Good Chef

Learning programming is like learning how to cook.  At first, it's daunting, and best left to those that know what they're doing.  But the day will come when you need to learn how to do it yourself.  That is, if you don't want to keep paying other people to do it for you.  So you start with something small and easy that's been done before and has a lot of very detailed instructions.  When it's done you feel amazing!  You have something tangible, right in front of you, that you made and can be proud of.  An unnoticeable victory for the rest of the world but a milestone for you!

Then you get the itch to do it a little better next time so you try cooking something a little more challenging.  It has a few more steps to it, some of which you have to get a second opinion on to make sure you're doing them correctly.  You make a few mistakes and learn a couple things along the way but you make progress.  You keep trying again and again, each time adding a step or two you've never done before.  Sometimes you go back to the easy recipes because you need that confidence boost, that reminder that you can do it.  And then you move on.  Eventually you're using ingredients you didn't even know existed and cooking dishes with names you could barely pronounce.  Then comes the real joy.  You're bringing your own ideas to reality and inspiring others with what you can do!  And you help out the beginner because you remember what it was like the first time reading those detailed instructions for that simple meal.  

Programming is a lot like cooking.  It is learned in the same way.  Day by day it doesn't feel like you are getting any better but look back over the last year or two and you can see you've learned things you used to only dream about.  Now you laugh when you look back at some of your old code you thought was unbelievably clever at the time.  That compiler error that had you tearing your hair out for an entire weekend once, you can now fix in a matter of seconds. Every program you write is a little more sophisticated than the last.  Of course, there were still those programs that were abandoned because right as things were starting to look good, they got way too far out of control.  It's all a part of the process.

Keep learning

I haven't met many people who say they can't cook at least a simple meal.  Why do I keep running in to people that say they could never create software?  It just takes time and determination.  You just have to sit down and do it.  Yet I see so many posts with the titles of "Is it too late for me to start programming?", "Can a man in their 50's learn to create a web page?".  The answer is that it is never too late.  Is it too late to learn how to poach an egg?  No.  Can a man in their 50's learn how to make a pot roast?  Yes.  Stop putting it off and sit down and do it.

I didn't start programming until I was 22.  I was terrified of it actually.  I was in school to be an engineer and I had to take an introductory programming class in the upcoming semester.  The only exposure I had to writing software was when I was really young, maybe 10 or 11.  My dad showed me a simple C program because thought I might be interested in coding.  As smart as he was, my dad was never supposed to be a teacher.  He was a brilliant man, but as with many brilliant people, they forget what it was like to be a beginner.  They forget that some things of the things that are so trivial now pose the biggest obstacle to the newcomer.  So after an hour of watching this text on screen cause this other text to turn a different color, I was thoroughly confused, disappointed, and wanted absolutely nothing to do with this horrific topic.  

So now I had to take this class.  I bought a C++ for dummies book and went to town on it.  I spent every night of a winter break learning how to use variables and functions, how to create a program that converted Fahrenheit to Clausius and back again.  I didn't want that horrific experience again.  And the class wasn't horrific.  In fact I got an A.  I sat down, did the work, figured out the parts that went wrong, asked questions when I got confused, and just did it.  How is that different from learning any other skill?

For an entrepreneur, having at least a little knowledge of programming is essential.  Even if you're not going to do the coding yourself, it's important to know what can be done with it.  I can't tell you how many people I've met that when I tell them what a piece of software can do for them, they respond with "I didn't know that was possible!".  I have saved hours each day at jobs by automating simple tasks.  And this was usually done with programs that were no longer than fifty lines.  That's when I found out what I really wanted to do.

Enter Android

My passion has become Android programming.  Why?  Because it is a perfect combination of resources, accessibility, and practicality, along with a little fun, too.    I just published my first app a few months ago and I love seeing that another person has downloaded my app.  I have created something and shared it with the world.  But it wasn't easy.  It took three years of failed attempts before I landed on something I actually could finish. Maybe failed isn't the right word.  A lot of my previous apps just weren't app store worthy.  I created a lot of apps that I personally used that just weren't polished enough to publish.  I'm not saying that out of modesty, they really weren't finished.  They were buggy, had features that wouldn't work, and were visually displeasing.  The problem was that I would get really excited about an idea so I would start programming it.  There would be a couple features I needed to implement that took a little longer to learn than I had expected.  Then another feature would pop up that I didn't know how to do so I would have to learn something else.  Inevitably, I would let the frustration take over and abandon the project, telling myself that I just wasn't meant to create an Android app.  

That couldn't be farther from the truth.  First of all, most people don't even get as far as a failed attempt because they don't even try. Second, you learn a lot more by your failures than you do your successes.  The first time I made macaroni and cheese, I forgot to drain the water from the noodles before I added the cheese.  Don't laugh, I was young (not that young).  If I would have told myself then that I was never supposed to cook, I would be a very hungry and/or poor man today.  And let me tell you, I can make some mean mac n' cheese today.  The best thing you can do is learn from your failure and try again.  

Android is a great platform to learn on, fail on, succeed on, and keep going because of it's awesome community and abundance of helpful resources.  That's why I develop Android apps and teach Android programming.  The thing that sets me apart is that I teach the hard stuff.  Everybody and their brother has a tutorial about getting started with Android and I am no exception.  But when the beginner tutorials end, it's difficult to find quality resources to learn from about the harder topics like providing services or streaming content.  That is what I aim to solve.  So after asking if it's possible to become an Android developer, the next question might be, "is it worth it?".

Let's do the math

Near the end of 2015, there were over 1.4 billion Android users that accounted for over 53% of mobile devices.  That is an insane amount of technology.  The internet is a fascinating place and never has it been easier to get your ideas out to the world.  The best part is that you need only need a tiny chunk of that 1.4 billion to make even a meager profit.  Say you have an app that sells for $2.99 and you want to make an extra $1000 a month.  That's 335 downloads per month.  That's 0.000024% of the Android user population!  That's it!  You only need a relatively few amount of customers to make even a little extra income each month.  

Obviously, there is no guarantee that you can just write an app and have it take off.  Rovio only found success with Angry Birds after 51 previous attempts at other games.  51 tries!  That means they put in work, time, and effort only to have it not go as planned.  Then they got up and tried again.  Did I mention they did that 51 times?  Giving up so early is the easy way out.  Success belongs to the one's who don't let failures get to them.  Let's apply the Pareto Principle here.  The Pareto Principle states that roughly 80% of the results come from 20% of the work.  Now let's apply this to writing apps.  If your first app doesn't work out, you need to try at least four more times before you give up.  The one that matters just might not have been written yet.  

Anything can be learned.  And anything learned can be improved upon.  You just have to want it and be willing to put in the work.  If people say it's not possible, prove them wrong.  If you hear that it's too late for you to accomplish something, prove them wrong.  Even when it comes to developing software.

Instead of asking if you can be a programmer, or a chef for that matter, try one thing first.  Start.  

How does Gradle Work for Android Apps?

What is gradle

What is it?

If you’ve ever used Android Studio, you’ve no doubt seen the word Gradle thrown all over.  It’s one of those things that seems really important even though you don’t know much about it.  And if you are anything like me, you kind of just hope it will keep working…whatever it is.  I’m going to clear up what Gradle is, why it is so important, and why you don’t need to live in fear of it anymore.

What is it?

According to Wikipedia,

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL)…”

While accurate, it’s still a little cryptic and it sure doesn’t make Gradle look any less scary.  Let’s break this down further.

Gradle is open source

Open source simply means that the source code that makes up the program is available for free to whoever wants it and they can do whatever it is they want with it.  This is as opposed to closed source which is what commercial software is; the code is private to the company that created it.

Gradle is a build automation system…

In software, a build is just as it is in any other part of life; the construction of a tangible object.  But in software development, the tangible product is the piece of software which is made of many other files like the source code.  When put together in the correct order, these files come together to make an executable program, more commonly known as an app.

With just a build system, the developer has to manually compile all of the files.  This isn’t so much of a task with small programs with just a few source files, but as programs grow larger and larger and require more resources like images, sounds, screen layouts, etc., it becomes a lot of work to compile a program.  This is where the automation comes in to play.

Believe it or not, a lot of work goes in to combining all of these files to make a program run.  And before these processes could be automated, instructions had to be written by the developer on how to compile the program and this was not done with a nice code editor like Android Studio.  By automating this process, human error is removed and production time is greatly sped up.  Think how many times you hit that play button in a single sitting!

…Builds upon the concepts of Apache Ant and Apache Maven…

Ant is a command-line build system written in java that can be used to build non java applications like C or C++.

Maven is another build automation system meant for any java based project.  Maven’s main goals are to create easy, uniform build systems in the most productive way possible.  Sounds pretty good right?

So basically we have these two tried and true systems that build java apps, now let’s make Gradle improve on them.

…Introduces a Groovy-type…

Groovy, like java, is an object oriented programming language that is meant to work with other java code and libraries.  It omits the commonly used parentheses and periods from java syntax which results in a very human readable context.

…domain specific language (DSL)…

A domain specific language is a programming language made for a specific purpose which in this case is Android development.  So a Groovy-type domain specific language means an object oriented programming language made specifically for the Android platform.  Kind of cool, huh?

So if we were to make the Wikipedia definition simpler, we could say that Gradle is a tool that creates our app using all of the files we have created for it based on methods proven to work by similar tools before it.

That’s a little easier right?

Why two Gradle files?

1I’m sure you’ve noticed by now that there are two Gradle files inside of you Android Studio project, one with the description of “Project” and one with the description of “Module”.  When you start your Android Studio project, you start it with one module.  A single Android studio project can have multiple modules.  Therefore the Project Gradle file are the build instructions for the whole app and the Module Gradle file are the build instructions for just one module of your app.







Hopefully that clears up a little bit about what Gradle is.  It doesn’t have to be as scary as you may think it is and maybe now you’ll have an introductory understanding in why it is there.  However there are all sorts of things you can do with it.  Configuring Gradle builds allows you to create free and paid versions of your app, debug and release versions, and much more.  But alas, that is content for another day.


Define your Minimum Viable Product (MVP)

Minimum Viable Product

Why is this important?

I'm going to explain this in a little case study of my own Android development history.  It wasn't until I heard the concept of the minimum viable product that I really started to buckle down on my app and get something in the market.

Take time to learn

It took me a very long time to get my first app published.  Probably the better part of five years.  This was not because my first app was so complex and had so many features.  It was not because it required a lot of research from professionals and users.  It was nothing I wished it would have been.  Instead it was because I wouldn't take "less than" as acceptable.  I wanted my app to have every feature, all of the bells and whistles.  I kept thinking of ideas to add.  But then my app would get too big.  There would be too much code in too many places and seeing as how I was so early in my programming career, my skills would improve so quickly it became easier to start over than to correct old code. 

This is okay.  All good things take time to accomplish.  I wanted my first app to be the one that everybody talked about, the one that would sell for millions.  Again, not realistic.  What's realistic is taking the time to learn the steps to get me to this app.  And I honestly see it in my future, maybe not quite at that scale, and I sure won't be the only one behind it, but I know it is possible.

Don't get intimidated; keep coding

So I would start making a new app, a different app.  Something that wasn't even close to the original because that idea obviously didn't work.  I'd get a little further in to the development process than the previous one.  I'd spend hours upon hours focusing on tiny details instead of the big picture and I'd inevitably wind up in the same predicament.  It just didn't seem realistic to be able to bring an app to market.  Everything had to be perfect and I'm just one guy! And every day I'd hear about another wildly successful app, another team that made it.  They brought an amazing idea to market.  How did they do it?  I guarantee the majority of people that find success in Android development, or any software development for that matter, don't strike gold on their first try.  They had to start somewhere. 

MVP to the rescue!

Then near the beginning of my first published app, Don't Forget It, I heard something on an entrepreneurial podcast I listen to, Entrepreneur On Fire.  I don't remember who said it but I heard the concept of a Minimum Viable Product for the first time.  This is commonly abbreviated MVP.  An MVP is essentially the most basic version of the product you want to bring to market.  It was the minimum amount of features, bells and whistles, look, usability, etc. required to have something you can be proud to say you made and that you can put in front of potential customers.  It doesn't have to be great but it has to work.

This changed my world.  I couldn't believe people would do that.  I just assumed that would be a horrible idea.  Why would I think anyone would like anything but the best from me?

Well, a few reasons.

  1. I have no customers.  I thought if I build it, they will come.  Not the case.
  2. I have no idea what the app publishing process really entailed.  Or the marketing process.  Or the testing process.  And I don't take advice well.  I need to do it myself.
  3. I need to prove to myself, as a morale boost if nothing else, that I am capable of publishing an app.  Nobody else whose done it before me has anything I don't.  They can't do anything I can't.

For someone new to publishing apps, there is a lot to be gained by going through the process.  The whole process.  I knew Don't Forget It wouldn't be my last app.  In fact, when I started it, I never really intended on publishing it.  I just needed the tool for myself.  But once it started to become a real thing, I immediately thought I should throw in all of those bells and whistles.  But that's not realistic.  What I needed was just something to put on the store.  I needed some content in the world.  I needed a win and that's exactly what this was.  If there's a lesson I've learned from this, it's this: until you have something to show for your work, something that might attract the attention of someone else, you're not much farther ahead than when you started.



5 Things I Learned After Publishing My First App

I recently just published my first app, Don't Forget It.  The purpose of the app is to be able to quickly log all of those little tasks that come up throughout the day, picking up your prescription, calling a friend on the way home from work, things like that.  It came to me out of necessity.  I have a terrible memory and I have to do something about it.  It was an amazing process to go from a blank program to a fully working app but I could have made the last six months a little easier if I kept these things in mind.

1. It will never be perfect

It seemed that when I started the app, I had a very clearly defined goal of what I wanted the app to do.  As I continued writing it, I kept thinking of new features to add.  Some of the ideas were better than others but I was starting to lose the main focus of the app: log those tasks QUICKLY.  So I had to pick and choose which features to keep and which to get rid of.  But the real trouble lies underneath.  I am a team of one so with every feature that gets added, there is added time for implementation, testing, debugging, more testing, and so on.  I had to focus on that MVP (Minimum Viable Product) and get the app out the door.  There will be plenty of time to add the features later.  Having an app in the app store, especially the first one, is already a huge win.

2. Test test test

I almost published the app a month ahead of the actual date and that would have been a horrible thing.  I was antsy.  I just wanted to get it done already.  Late nights and early morning programming sessions were starting to wear on me and I was in a hurry.  But lucky for me, I am a little too much of a perfectionist.  I tested the app on my own phone for about two weeks every day before I even gave it to a friend to test.  And it was good that I did.  Software these days is held to an incredibly high standard.  How many times have you used an app or webpage, found one unresponsive feature, or something that just didn't work and said "I'm not coming back".  I sure have.  Take time to test.

3. You need some graphics

For some reason I forgot that once the app was ready to publish, I'd still need promotional material.  A few images at a bare minimum.  It's quick and easy but before you get blindsided by anything, make sure you have these ready to when you publish your app to the Google Play store.

  • At least five screen shots
  • Hi-res icon: 512 x 512, 32-bit PNG (with alpha)
  • Feature Graphic: 1024 wide x 500 high, JPG or 24-bit PNG (no alpha)
  • Promo Graphic: 180 wide x 120 high, JPG or 24-bit PNG (no alpha)
  • TV Banner: 1280 wide x 720 high, JPG or 24-bit PNG (no alpha)

And if you can do it, a little promo video is a great idea as well.

4. It's not as hard as it sounds

Honestly, it's not.  Persistence is the key.  Just don't give up.  Yes, there are plenty of apps in the app store.  Yes, there are a lot of scary statistics telling you odds of being the next Facebook are pretty low.  But you miss 100% of the shots you don't take (Wayne Gretzky).  You also don't make 100% of the shots you take.  More shots, more chances.  And just the feeling of having something in the world that anybody, anywhere can see is an amazing feeling.

5. Tell Everyone you know

I'm not big on self promotion.  In fact, I hate it.  But a little encouragement can go a long way.  It was about two weeks before I made a Facebook post about my app but when I did, the results were amazing.  Not amazing in the sense that it put Don't Forget It on the map, but amazing in the sense that a lot of my friends were happy for me.  They downloaded my app, gave me feedback, and just made me feel like waking up at 5 in the morning to program before work was kind of worth it. 
It's a long ride but well worth it.  I hope this serves as a little encouragement for someone looking to get into app development, or maybe needs a kick in the butt to finish theirs.  Good luck!

We just published our first app!

Don’t Forget It!  Our first app is in the Google Play Store.  This one was developed out of necessity for us and it’s what really launched Bag of Tricks Studios.  So many little tasks come up during the day that need to be dealt with by the end of the day.  But when our mind is engaged in something else, it’s easy to overlook the little things.  Enter Don’t Forget It (dun dun dun…).  This is the app that will take care of all of that.  When you’re deep in thought, working hard on a project, and you get a phone call asking you to pick up milk on the way home, Don’t Forget It is the easiest way to make sure you, well, don’t forget it.  In just a few clicks, open the app, type in “Get Milk”, set a reminder for 5:00 when you leave work, and you’re done.  You don’t need to clutter up your Google Calendar with little tasks.  You don’t need to write a post it note that you’re just going to lose anyway.  You don’t need to email yourself a reminder and have it get lost in the chaos of your inbox.  Don’t Forget It will remind you when it’s time and you’ll be on your way.  Get it here!

We just published our first Udemy course!

Hello!  We are proud to say that we are now an official member of Udemy, the website that teaches anybody, anything.  If you are not familiar with the site, Udemy is a marketplace of online classes.  People from around the world create online classes on anything from learning guitar to how to get better sleep.  And what sets Udemy apart from your average YouTube tutorial video is its strict policy on course quality.  Every class is monitored for strict audio and visual quality so the content you are paying for (or in some cases, free) is of the highest caliber.

Which brings us around to our topic.  We now have our first course on Udemy!  It’s a beginner’s class for learning Android programming.  Now, we know there is no shortage of Android tutorials so what sets ours apart is what I like to refer to as: Speed of Implementation.  It’s an hour and a half deep dive into the fundamentals of creating an Android app.  We leave out all of the fluff and repetitiveness of other tutorials.  We don’t waste time telling you how our day went in the videos.  We just get down to the essentials – creating apps!

We know everyone has busy schedules and just doesn’t have time to sit through several hours of class so we condensed several hours of information into one, short course.  Use this link here to get the class for free and let us know what you think!