How to Set Transparent Color in CirclePageIndicator

Trying to get my blog up and running again, and came across this peculiarity with a useful Android library called CirclePageIndicator. Basically, if you want to set the non-selected fill of one of the circles to transparent, you must do it in java rather than xml.

device-2015-09-24-183029

E.g. This won’t work:

<com.viewpagerindicator.CirclePageIndicator
        android:id="@+id/circlePageIndicator_intro"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/margin_large"
        android:clickable="false"
        app:fillColor="@android:color/white"
        app:radius="@dimen/circle_indicator_radius"
        app:pageColor="@android:color/transparent"
        app:strokeWidth="1dp"
        android:layout_above="@+id/textView_login"
        android:paddingTop="@dimen/margin_small"/>

But this will:

mCirclePageIndicator = (CirclePageIndicator) view.findViewById(R.id.circlePageIndicator_intro);
mCirclePageIndicator.setPageColor(android.R.color.transparent);

Adding Genymotion Android Studio Plugin

I just discovered an awesome plug-in for Android Studio today — the Genymotion Plugin. It places a Genymotion icon in your Android Studio toolbar and enables one-click access to your Genymotion emulators.

Genymotion in toolbar

To those of you who aren’t using Genymotion as part of your regular Android development workflow, you should be. Genymotion’s speed will cut tons of time from your development cycles.

Okay, here’s how to install:

  1. In Android Studio, go to File > Settings.
  2. Select Plugins and click Browse Repositories.
  3. Right-click on Genymotion and click Download and install.
  4. To see Genymotion plugin icon, display the toolbar by clicking View > Toolbar.

You can also download and install manually the plugin genymotion-idea-plugin.jar (not recommended).

To use this plugin, Genymotion must be installed on your system.

12 Tips for Building a Mobile Apps Business (and not sucking)

I just gave a talk down in LA at Mobile Camp on 12 Tips for Building a Mobile Apps Business (and not sucking).

Here are my slides for posterity:
KarimVarela – Mobile Camp 20150124

Here’s the video:

And here are the 12 Tips in text:
1. Ideas are Just a Multiplier of Execution
Okay, so here are my tips, starting with my opinion that ideas are truly worthless. It’s all about execution and timing.

I’m sure you’ve heard this all before, but I still run into people who refuse to share their ideas for fear of it being stolen. If you told somebody your own idea, and they were so passionate about it that they went out and executed on it better than YOU, then they deserved it anyway. You need to get as much feedback on your idea as humanly possible before you go start and build something.

This guy Derek Sivers actually created this scientific chart which proves it and it was actually published on the internet, so you know it’s true. Basically, to find out how valuable your company is, or could be, you just multiply the idea-greatness coefficient over here on the left by the execution greatness coefficient over here on the right and you have the value of your company.

Obviously, if you have an awful idea, it’s never going to be worth anything, but even if you have a brilliant idea, with no execution it’s only worth 20 x 1 = $20. Now, I’m not gonna pay you 20 bucks for your idea, but somebody might. And of course it’s only if you have a brilliant idea coupled with brilliant execution do you get those multi-hundred million dollar or billion dollar companies.

#2 is Make Your Idea Matter
Your idea, your company, should matter to you, and you should be very excited about it. You should be so passionate about your idea that your passion infects others, because it will have to if you want to be successful. If you choose to go down this path of building your own mobile app company, you will be working so much that you don’t want it to feel like work, and it shouldn’t feel like work, or else you’re not going to be happy.

#3 is Finish Your Business Plan or Actually Write One
I feel like business plans have gotten a bad rap lately and I think that’s a for a few reasons:
1. It’s easier than ever before to start a business, especially a tech business, so there’s a lot of non-traditional business people trying their hand at entrepreneurship.
2. The market changes really fast so some argue that by the time you finish a biz plan, it will already be obsolete. I agree with this to a certain extent, but the process of writing the business plan will make you that much more prepared for the changes that come.
3. And I think people are just lazier than they used to be. No offense to millennials. I think technically I’m considered a millennial, although a very early millennial. I don’t know, I was born in 1981, does anyone know the official millennial cutoff?

Anyway, I personally would not join a company that didn’t have a business plan of some sort and a solid path to profitability. Even Tinder. When I joined Tinder, they were already getting 10k downloads a day, but even with Tinder, I made sure the company had a plan for getting to profitability. Now Tinder gets over 100k downloads every day and is about to start making some money.

#4. Don’t Outsource Your Core Competency
If at all possible, you want the people writing your app to be stakeholders in the company.

You are NOT a mobile software company if you don’t write your own mobile software. [repeat] I understand it’s tough if you’re not a technical person, and if you’re not, then you should partner with someone technical, or start learning yourself. If you’re desperate, sure go ahead and hire some outsourced devs, but pick devs carefully and try to pick devs that you would want to work with on an ongoing basis. B/c software is never just one and done. It’s never done, ever. We keep iterating on software for as long as we have users and developers. If you must outsource, have a plan for bringing that work in-house as soon as possible.

#5: Make the Team Matter
The first part of this rule is don’t do it alone. Bring in people to help you. When I built up i-booze.com, I did everything myself, and ultimately that was my downfall because I couldn’t keep tabs on everything that was going on with the business. I’ll tell ya exactly what happened there a little later.

But remember, bringing on additional people is probably THE most important part of building your business. If you bring on the wrong people, it could be devastating for your business. I recommend you hire first for people with passion. You want to find people who are passionate about your product, passionate about your industry, and hopefully passionate about their job as well. Passion always trumps credentials in my book.

However, passion is only part of the puzzle. At SocialTagg, I was able to find plenty of people who bought in to my vision. At our peak we had 10 employees and 4 interns. Our mission was to make networking so easy that you didn’t even have to think about it. I hired people who I genuinely thought were passionate about our mission at SocialTagg. The mistake that I made, however, was I didn’t necessarily hire doers. We had a hard time executing on our product roadmap b/c we had a lot of thinkers, and a lot of passion, but not enough doers.


This is from 9gag.com. I think this meme is supposed to be applied to group projects at school, but nothing changes when you get into the real world.

There’s always one or two who do most of the work. There’s always at least one who never really gets it (hint: you should probably fire these idiots.) You always have people who say they’re going to help, but they never do. And, if you do happen to be successful, you’ll always have that lame-o who shows up at the end and demands his piece of the pie that he didn’t help to bake.

As you can guess, I might be a little bit cynical about team members. My point is, be very careful who you enter into business with, because it ends up being a marriage of sorts. You could be with them for a very long time, and in the end they might try take everything from you.

#6: Make the Design Matter
Moving on to a lighter topic … Design.

This of course is the Prince of modern software design, Jony Ive, the head of design at Apple. And he says, “Design is the most immediate, the most explicit way of defining what products become in people’s minds.”

Think about this for a second. Which products or services have given you that warm fuzzy feeling of true awesomeness lately??? You used it, and you were like wow, this product is awesome, I love this product? … For me, it was Expedia’s Android app. The thing is just beautiful, big images everywhere, nice transitions between screens, just a gorgeous app.

Think about this … 90% of information sent to our brains is visual.

And if Jony Ive is the Prince, then Steve Jobs was of course the King. He said, “Design is not just what it looks like. Design is how it works.”

When I got hired at Tinder, my boss was the original iOS dev at Tinder and the inventor of swiping, Jonathan Badeen. Jonathan is fanatical about design. Before he was a software developer, he was a designer, so it’s no surprise that he was fanatical about design. He idolized Steve Jobs. In fact, he even had a mouse pad with Steve Jobs face on it.

As fanatical as I thought he was about design, he taught me a lot, and he’s a big part of why Tinder is so successful. A company like Tinder places the highest importance on design, sometimes iterating over a design dozens of times or more before finalizing it and sending it to developers. And even then the design wasn’t finalized. The design would often times change while we were building it. I’m not saying that’s the right thing to do, but nowadays if you want to be successful, not only do you have to have a brilliant idea, and brilliant execution, but you absolutely have to build a beautiful app.

Now you may be saying, Karim, I’d like to hire a designer and make my app look good, but it’s just too expensive. Well, if you think good design is expensive, you’re probably right, but you should look at the cost of bad design. It can cost you everything. If you can’t afford a designer, I recommend you partner with someone who knows design.

#7 Go All-In
On to another famous entrepreneur … Walt Disney said that when you believe in a thing, believe in it all the way – implicitly and unquestionable. That’s really powerful and that’s what you gotta do to be successful in this business, to rise above the crowd, to be the cream of the crop. I think you really have to go all-in.

Now, I’m not saying you should quit your cushy day job, but if you really want to be successful in your endeavor, in your passion, you need to be able to devote yourself fully to it, at some point, so you should have a definitive plan for devoting your life to your passion.

At SocialTagg we built up a team of 10 people who had some form of equity in the company. I had a group of ten people who were either working full-time, going to school, OR working for another startup, AND working part-time for SocialTagg. Nobody was all in, including myself. I was working for either Fandango or Beachbody or Tinder or Coffee Meets Bagel, and getting paid well, but also trying to build a profitable business on the side with a bunch of other people were also only working nights and weekends. There’s no way you can win if you can only work on your product nights and weekends. [repeat] Your competition will just out maneuver you and out innovate you.

So make a plan for going all in.

#8 Figure Out Virality
Alright virality, if you want to successful in the consumer space, you need to figure out how to make your product viral. There’s only so many downloads you can buy.


This comic is called Going Viral and it’s written by Sean Nicholson. The point of the comic is that going viral is very hard to do, it’s not like there’s a switch you can turn on that’s going to make you viral. If there was, we’d all hit that switch, right? You can’t just assume that since you built something, and you think it’s cool, and your mom thinks it’s cool, and all your friends think it’s cool, and all the startup junkies at Mobile Camp ALSO think it’s cool, that it’s just gonna spread like wildfire.

No, you need targeted, specific, repeatable experiments to figure out what your viral hook is.

If you didn’t know …
The viral hook is defined as something compelling that the user wants to share. At Tinder, e.g., one of the best viral hooks is to prompt the user to share as soon as they get their first match. They are proud, and want to announce to their social spheres! They have a potential mate; they are not a loser of our species. They are winners, and this is exciting news for their social blogosphere.

You need to experiment in your own business and industry and figure out what are the best viral hooks that you can build into your product.


I just recently heard about these guys, jet.com. They’re basically building a subscription shopping service, think Costco meets Amazon. You pay a monthly fee to get access to cheap shopping. Jet will only make money on the subscription revenue; they don’t take a margin on each product.

I think they have a good idea, but their execution so far is brilliant.

On the front page of their website, they say, “Refer friends to boost your Insider rank. Unlock perks. Earn Jet stock.” So they’re actually giving away prizes and stock in their company to the people who refer the most friends.

This is brilliant virality!

Okay, on to the juicy stuff … #9 is Obey the Law

When you’re pressing the boundaries on innovation and technology, often times you run right up against the law, and it can stop you dead in your tracks. Think about Uber’s struggles, for example. Uber is a brilliant idea with brilliant execution (obviously, it’s worth billions of dollars), but in how many places have they been shut down or been threatened to be shut down? A lot … Little Rock, Richmond, Cambridge, Vegas, Portland, NY, India, Paris, Spain, Thailand, Netherlands, Belgium, Berlin …

This is what happened to i-booze.com, which as I mentioned was primarily an instant alcohol delivery service I started in Seattle. I built the business up in my garage, like so many other entrepreneurs, to a point where I had two employees and we were doing a few thousand in revenue every month, but then it got too big to run out of my garage, so I rented a 1500 sf warehouse in downtown Seattle with plans to grow the business.

Well, it turned out that the city of Seattle didn’t like my business model and they decided not to renew our liquor license and so we were forced to shut down. It turns out that it’s illegal to sell alcohol to people in WA state if they’re already intoxicated and by allowing people to buy alcohol on-line we were unable to check if they were already intoxicated before selling them alcohol.

Back then, in 2009, there weren’t any good solutions for processing credit cards at someone’s house. If I were to run this business again, I would make sure to obey the law and use Square or something like that to take credit cards at the customer’s door. But this is another reason to have a partner or two. Had I had a cofounder with i-booze, that person could have helped me on the legal front and maybe we could have avoided the shut down.

Ok #10, Roll-out slowly.
I think it’s very tempting when you’ve just finished building your MVP to wanna put it out to everybody in the world, b/c you’re so proud of it, and you want your baby out there. But the prudent and wise app developer pushes his app out slowly. This gives him the time to see if everything’s going alright as his app is gaining adoption. He can make sure that any crashes or critical issues only affect a limited number of users, instead of everybody. You can roll out by geographic region, or you can also roll-out by language or by market percentage.

Exceptions to this rule of course are:
* If you have to make an emergency point release to fix some critical issues or crashes or
* You have some release that coincides with a marketing push so you need to make sure that the release goes out to as many people as possible at one time. A perfect example of this is at Coffee Meets Bagel, we usually roll out builds out very slowly by market percentage, however a few weeks ago we were on Shark Tank, and so we had to make sure the newest version of our app was available to the entire market the day that Shark Tank aired, and so in that case we pushed it out to the entire market all at once.

OK .. #11: Customer service still matters.
Bill Gates said that “Your most unhappy customers are your greatest source of learning.”

If you have any sort of success (or even if you don’t) you will need a customer service department, or at least one person who is dedicated to handling user issues.

At Tinder, about a year ago, we were getting over 10k customer service touches every week. We hired an entire team of people in the Philippines just to answer customer complaints and issues. And that’s for a free service! (although now Tinder has plans to start making some money). At Coffee Meets Bagel, we have an in-house customer service team because we’ve always had in-app purchases and as soon as you start taking people’s money, customer service gets real … if you know what I mean.

You can learn a ton about your service just by reading the reviews that people leave in the App Store and Google Play. And believe me people are harsh and brutally honest. At both Tinder and CMB, we get a ton of 1 star reviews for really stupid reasons like they aren’t getting any matches or their matches aren’t responding to them or even b/c FB is our only authentication mechanism.

In Google Play, you can respond to user reviews right there in the store. This is an invaluable opportunity to interface directly with your users.

Alright, #12. Measure Everything
I’m talking about Customer Surveys
At what point should you use customer surveys? At every point.
Before you build anything, you should survey everyone you know to see if anyone would even be interested in a product like you’re thinking about building. If they are interested, would they pay? how much would they pay? If they are interested, would they tell their friends? This kind of information will help you find your product-market fit. This was something we didn’t do well enough at SocialTagg and we paid the price. We started building SocialTagg at a hackathon, and we thought it was pretty cool, and our moms thought it was pretty cool, and our friends thought it was pretty cool, and all the startup junkies at the hackathon thought it was pretty cool. But instead of really taking the time and validating what we thought was cool with actual users, we just kept building. Eventually we had some pretty cool technology that nobody really wanted.

Landing page — At what point to you put up landing page?
Again, before you start building! Put up a landing page with a fake screen shot of your application and short description and see how many people you can get to sign up for your app. Who cares if you don’t have anything to offer them? You just need to find out if people will actually want to use this thing that you’re about to spend days, weeks, and months building.

And you A/B test that landing page!
You should experiment with different versions of that landing page. Each different version of the landing page should highlight different product benefits and features so that you can really get an idea of which features are most important and desired by the end user.
And of course there’s more traditional A/B testing that you should do when you’ve already built out your core product and you’re experimenting with different versions of features. For example, at Coffee Meets Bagel, we sell a virtual currency called ‘beans’ and we experiment a lot with how much people want to pay for beans and how many beans various features should cost. There are getting to be some great tools out there for A/B testing, like Optimizely for one.

And finally, analytics.
You should integrate analytics into your app from the very beginning. Before you release your app to the market, you should know what are those things that you want to measure. You should know what your key metric is. There should be one key metric by which you can measure the success of your business, and you should be measuring that right from the very beginning. I’ve personally integrated probably every analytics platform out there, including, building custom ones from scratch, but some of my favorites are Flurry and Google Analytics.

And lastly, just a point, maybe obvious, maybe not. It’s not enough to just measure it, you have to put the work in to analyze the results, and study them, to glean useful insights.

Yay! We’re done!
The road to a billion dollar startup is long and fraught with many perils so don’t forget to celebrate all the little victories along the way!

Mapping iOS Assets to Android

So I’ve got a sweet new job working for Beachbody. We make awesome products like P90X and Brazil Butt Lift. We also make mobile apps. They hired me to essentially port their P90X iOS app to Android.

I’m in the planning stages right now and one of the challenges I’m facing is how to map the existing iOS asset classes to their appropriate Android asset classes. For iOS, it’s still pretty easy, you just have at most three classes of assets to worry about:

  • Small = 480 x 320 (163 dpi)
  • Large = 960 x 640 (326 dpi)
  • Tall = 1136 x 640 (326 dpi)

For Android, you have the following screen sizes classes:

  • Small = at least 426dp x 320dp
  • Medium = at least 470dp x 320dp
  • Large = at least 640dp x 480dp
  • xLarge = at least 960dp x 720dp

Then, you also have different density classes:

  • ldpi = low density (~120dpi)
  • mdpi = medium (baseline) density (~160dpi)
  • hdpi = high density (~240dpi)
  • xhdpi = extra high density (~320dpi)
Looking at this data, if you don’t have the resources to create assets for every Android density class (ldpi, mdpi, hdpi, xhdpi), it looks the following mappings make sense:
  • Small iOS images should work for ldpi and mdpi Android devices.
  • Large iOS images should work for hdpi and xhdpi Android devices.

Unless I hear about a better solution, this will the strategy I’m taking. Please comment on this post if you have any feedback or input! Cheers!

Android: How to Programmatically Lock the Orientation

In mobile application development, there may be times when you want certain screens within your app to always show in landscape or in portrait mode. Android makes this easy to do within your Activity class:

import android.content.pm.ActivityInfo;
...
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

You can also set this in the manifest:

<activity android:name=".YourActivity"
              android:label="@string/app_name"
              android:screenOrientation="landscape">

Android Selectors

Android selectors can be used to give your Buttons or images the feeling that they are being pressed. Essentially, a selector defines a different drawable for different states of an image or Button. Selector files should reside in the /res/drawable/ folder in your project. Here’s what a basic selector looks like:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
        android:drawable="@drawable/button_state_pressed" />
    <item android:state_focused="true"
         android:drawable="@drawable/button_state_focused" /> 
    <item android:drawable="@drawable/button_state_normal" /> 
</selector>

If this XML resided in /res/drawable/imagebutton_selector, for example you’d set the android:src attribute of your button to android:src=”@drawable/imagebutton_selector”.

A Kind Message from Software Developers to Recruiters

Dear Recruiters,

I write this message to you on behalf of all software developers as I know that most us feel the same way.

Let me start off by saying that I appreciate what recruiters do. I don’t appreciate what they do for the corporate world, or for technology, as I could argue either way for those benefits. I appreciate what recruiters have done for me personally. If it wasn’t for recruiters, I’d probably be making about half the income I make I right now. Also, if it wasn’t for recruiters, I probably never would have moved from San Francisco to Seattle and then from Seattle to Los Angeles. It’s not that I couldn’t have figured out how to make more money on my own or that I couldn’t have moved around the country on my own. It’s just that the motivation to leave companies for more money or to move to a different city to go work for a different company isn’t really an inherent motivation for me. Recruiters have supplied much of this motivation, and for that I’m thankful.

Now to what I don’t appreciate:

  • Not reading my resume / LinkedIn profile:
    I don’t appreciate you pitching jobs to me for which I’m obviously not qualified or interested in. Take a minute and read the entire thing. At the bottom of my LinkedIn profile, there’s even a section where I spell out for you which types of jobs I’d be interested in interviewing for.
  • Calling me while I’m at work:
    You know I have a job, right? You know I get paid to write code, not talk on the phone, right? Do I call you while you’re at your job and try to get you to take a job somewhere else? No, I don’t. It’s called respect. If you give us respect, we’ll give you  respect.
  • Scheduling a phone interview during the middle of my day:
    This goes back to my previous point. Why would I want to interview for a different position during the middle of my work day? Who does that? Only unemployed people. Get a clue please.

Sorry if this sounds harsh. I realize you are just trying to make a living the best way you can. Think about this though. Maybe if you stopped treating developers like your next paycheck, they would actually have some semblance of loyalty to you or your recruiting firm and not treat you like a commodity.

Happy head hunting,
Karim

Android: How to Hide Keyboard By Touching Screen Outside Keyboard

If you’ve ever worked for a mobile software company that builds both an iOS app and an Android app, many times the product people will ask that a certain feature be implemented consistently across both platforms.  This week I was tasked with implementing a popular iOS feature, the ability to hide the virtual keyboard when the user touches outside of the keyboard, on Android.

The methodology is simple, but not entirely intuitive. Let’s look at how it’s done. Basically, you get a handle on the layout in question. In this example, we’ll use a LinearLayout:

LinearLayout layout = (LinearLayout) findViewById(R.id.layout);

 

Then, override the layout’s OnTouchListener.onTouch() like so:

layout.setOnTouchListener(new OnTouchListener()
{
    @Override
    public boolean onTouch(View view, MotionEvent ev)
    {
        hideKeyboard(view);
        return false;
    }
});

 

The code to hide the keyboard is fairly popular:

/**
* Hides virtual keyboard
*
* @author kvarela
*/
protected void hideKeyboard(View view)
{
    InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    in.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}

Software Engineers, Don’t Waste Your Time Any Longer, Build Your Future

Today, I came to the full realization of something that’s always been an itch in the back of my mind. If you’re a software engineer and you’re not utilizing your talents to help build a company or gain a stake in a company, you are wasting your time.

You may say, “Oh Karim, that’s mighty hypocritical for you to say. After all, you work for Fandango as a consultant and have no stake in NBC Universal, the parent company of Fandango. You get no benefit and no share of Fandango’s immense success.” If you said this, you are right, and don’t get me wrong, Fandango is an awesome place to work. From our catered lunches and company movie outings and an incredible location just three miles from my apartment, it’s difficult to imagine a better place to work right now.

I’m not resting on my laurels, however; I’m actively doing things to build my future. For instance, I’m about half way through with business school at the University of Florida. I’m also attending the AT&T Mobile App Hackathon – Los Angeles in a few weeks. There, I plan to build my first commercial mobile app.

As software engineers, we have the unique ability to not only think something up, but to go out and build it. We have the power to create software that millions of people will use. We have the power to create this with nothing more than our brains, our fingers, and a computer. Even with a world economy in the midst of a deep recession, the demand for software engineers has been increasing faster than the supply. Don’t waste your talent; go build your future. If you have a good idea, and are interested in working with me, hit me up. Let’s chat!