Android Development With Fabric

I’m a full time PHP/MySql developer. I’ve been developing in PHP since 2005 or so. I’m also pretty experienced with Javascript/jQuery. For the past few years I’ve been wanting to dive into building apps, starting with Android as I have an Android phone. I’ll move into iOS after.

Every time I‘ve started, it’s been without a real purpose so I get a few things done and end up dropping it and going back to what I do for real. I recently (relatively) started a site with a coworker for growing Twitter accounts and engaging with their audience. The site’s name is Rewst. Our home page is very outdated, those are essentially the features we started with.

The other day I started thinking about how with Twitter your followers tend to miss tweets that were posted when they weren’t online. It could help me reach my audience if they could install an app that lets them view and engage with my timeline more quickly (push notifications being optionally enabled would likely help too).

I knew that Fabric was a viable option already from being around the developer forums but I underestimated how easy it would be. Creating a new app with a basic activity that Android Studio let me choose from and then following their installation guide and 2–3 step code examples worked really quickly.

I made my first activity a login screen which included a brief description of the app along with a button to login. After they login, they’re presented with my timeline. I’m not a huge fan of the default timeline behavior where clicking pretty much anything results in the tweet being opened in another app (Twitter, your browser, etc) or that there are no retweet counts or favorite counts. Overall, it works but I wanted more and this was the most complicated part. Their guides worked great but there’s not really any clear information on how to extend or modify the default behavior.

Turns out, a lot of it is doable though. You can copy the layout into your res/layout folder with the same name and add additional elements. For the timeline instead of using their default adapter you just make your own adapter that extends TweetTimelineListAdapter. Override the getView function and set the text of your new elements. I also actually went through and changed the onclicklistener to change the share element to a retweet element. My getView function ended up looking like this (note: the code for making the retweet element is not included as it’s an outside function).

My end result of the edited timeline looks like:

In my new timeline, clicking on a tweet brings up the option to reply within a new activity in my own app rather than leading to the website or Twitter app. Rending the tweet view was pretty straight forward. What they don’t show you in the Fabric docs though, is how to submit a REST api request. So here is what it ended up looking like and the code to make a call to submit a reply.