MVP a little later

Since having the problems with generating a simple MVP solution back in June I went back to working on my main app.

After thinking about this, I don’t have a simple MVP example to do. I did however have an middling game idea. As soon as I finish up dealing with changing my IntentServices for Android O (and likely other things), I’ll come back to this one.

If you’ve got a simple MVP idea, put it in the comments.


Chasing Picasso

I was getting an odd message with Picasso, nothing that was causing it not to work, but I eventually had time to look at it. Unfortunately, I didn’t note the logcat message 😦


I eventually stumbled to this page, and it talked about caching the Picasso instance. I thought it would help out with the image efficiency, so I made the changes below on one of my ViewAdapters. Luckily (foreshadowing here), I only did it on two of them and not all of them.

 public class AdapterRecyclerViewRealmObject extends RealmBasedRecyclerViewAdapter<RealmObject, RealmViewHolderClick>
    public AdapterRecyclerViewRealmObject(
          Context context,
          RealmResults<RealmMovieCastMember> realmResults,
          boolean automaticUpdate,
          boolean animateIdType,
          OnFragmentDetailListener fragmentHost) {
        super(context, realmResults, automaticUpdate, animateIdType);

     public void onBindRealmViewHolder(RealmViewHolderClick realmViewHolderClick, int i) {
-                         Picasso.with(mContext)
+                         mPicasso


     Picasso mPicasso = null; 

     void createPicassoBuilder(Context context) {
         Picasso.Builder picassoBuilder = new Picasso.Builder(context); 
         mPicasso =;

     void resetContext(Context context) {
         if (context != null) {
             mContext = context;
I tried it out and found that not only wasn’t it as good as it was before, but it was worse. I rolled back the changes and started to look for another way to be efficient. Also on the same article was to set Picasso to become a singleton.
I ended up changing my Application class to set Picasso up there prior to all calls to it.
public class ThisApplication extends Application {
    public void onCreate() {

        // Set Picasso to singleton, so it won't thrash
        Picasso.Builder picassoBuilder = new Picasso.Builder(this);

        // Picasso.Builder creates the Picasso object to do the actual requests
        Picasso picasso =;

        // set the global instance to use this Picasso object
        // all following Picasso (with Picasso.with(Context context) requests will use this Picasso object
        // you can only use the setSingletonInstance() method once!
        try {
        } catch (IllegalStateException ignored) {
            // Picasso instance was already set
            // cannot set it after Picasso.with(Context) was already in use
            Log.e(TAG, "Failed to setup Picasso as singleton");

Once I did this, things went much better 🙂

There are many SO articles (as well as the one I used) that talk about setting the cache. I didn’t want to do that, as the device may be memory constrained.

New project – denied

I was looking for a new very simple project to try a MVP project. While I was thinking about it, a highly useful project came to me.

I’ve got a Android TV. Changing the Google Advertising ID (GAID) is such a pain on it, that an app that would do that would be a great help. I’d set it to change every x days or weeks and lo and behold it would be done.

After looking at the MVP information, I dug down into the GAID. The announcement, the Google play GAID documentation overview. There isn’t any documentation on how to change the GAID, only how to pull it back.

A question that is highly interesting on SO, on the first page returned on a search,  it has the most page views.

Evidently, time to look for another simple project. <sigh>

If you have one, drop a comment here.

Distributing an Android library

I had a my own open source library that I wanted to push out for myself and others to use. I didn’t want to go the JitPack route. I didn’t want to add Maven to my Android Studio project so that I’d have to create my own POM file and maintain that on top of the gradle file.

I went looking for a hosting location, I first chose the OSS Maven central library, Sonatype / Nexus. Items that need to be uploaded are the Maven POM, the Android archive (.aar), JavaDoc and source code. I started looking around for gradle addons to allow the push to Sonatype / Nexus. I tried many different gradle methods and didn’t get any of them to work. After around 3 weeks pounding my head trying to get various solutions to work, I gave up.

Continue reading “Distributing an Android library”

Code formatting – help?

In my prior post, I had to use the {code language=”java”} {/code} (yes, these should be braces) to get it to display somewhat OK.

When I pasted my formatted code block in, it would post a ton of breaking spaces, and ampersands back from the bad old HTML days. I ended up removing the formatting to get it into a readable state.

Is there any better way to put in code segments in?

The tale of the expiring fragment in a FragmentPagerAdapter

I was testing my tablet layout of my app and noticed a really strange thing: my detail fragment (of a parent and detail fragment set) when a certain combination of various device rotation and menu selection was loosing my 1st tab of my FragmentPagerAdapter.

What was going on here, and more importantly, how could I fix it?

Continue reading “The tale of the expiring fragment in a FragmentPagerAdapter”

First blog post

First blog post


This blog is for me to document some interesting or frustrating things that I’ve run into.

This will allow me to put some thoughts in order from doing the work. Hopefully, it may be of use to you 🙂