Draw beautiful diagram effortlessly on ipad. Click here to know more..

Tuesday, January 10, 2012

My first android app: learning+coding+publishing in 5 days

Hey! don't be surprised.  This is not a game like "Angry Birds". Typically, 5 days are not sufficient for a beginner to create a descent app. But my app is not just a "Hello World" app. This is Scratchpad: a simple drawing app. This can be used mostly by kids to draw/erase with touch and can also share the drawing using emails or any other image sharing app. The Scratchpad also has a feature of smoothing the hand-drawn curve which makes it little different from other similar apps.

Here is how this was started: During the new year vacation, I wanted to learn about  Android app development. I got 5 days: 28th Dec to 1st Jan. On the first day, I spent few hours to read about the Android app fundamentals on the Android developer website. I already knew Java, so I did not have to learn a new programing language. After reading the fundamentals, I downloaded few sample projects from internet and started running them. On the 2nd days, I was going through the source code of the samples and running them on emulator. There were many samples to run, so I was not doing any modification to code. I was quickly running those code. At the end of second day, I got confidence that I can now write an app. Then got the idea of a drawing app and then started on this.

I started on development of the drawing app on the evening of second day. Then suddenly I thought that let me release this app on 1st of Jan and make this new year very special. I had only 3 days left (including 1st Jan), I was not sure that I will be able to complete or not.

By the end of 3rd day, I had most of the features working. I was feeling much more confident. But icon work was still not done. Here is the list of things that that I completed:-
  • Drawing using touch
  • Erasing
  • Selecting color
  • Setting pen width
  • Export the drawing as png to Pictures folder, so that it can be viewed in Gallery app.
  • Share the drawing using email or any other sharing app that is installed on device.

I had to struggle a bit for color picker dialog. I could not find any standard Android widget for this. I searched on internet, there were many samples available. I tried few of them and picked one.

On the 4th day morning, I was feeling much more confident. Now I was thinking to add a feature that can differentiate the Scratchpad from other similar apps. So I decided to add a feature of curve smoothing. I already had C++ curve fitting code. Porting the C++ code to Java could take much time. I wanted to wrap-up by the day. So tried java native interface using NDK. Using NDK was straight forward. I integrated the C++ code within few hours.

By now, I was done with all features that I wanted. Now it was time to work upon icons. I searched for free icons on internet and picked some free icons. But I had to edit almost all icons in GIMP.

Now it was 4th day evening. Everything done!! I was very happy!! Now started testing and found a bug!! The bug was in the C++ curve fitting code. It was silently crashing the app. I had no idea what was wrong. Tried the debugger that comes with NDK, but it did not work properly. The NDK build was striping-off the debug symbol even if it was given debug flag. I worked around this by copying the shared object file from obj folder to libs manually after the build. But it did not help. The debugger was reading the debug symbol incorrectly. I was not able to step or print the variable values. However I was able to break the debugger at given function. Now I had two options:- give more time to fix the debugging or create a standalone Linux application or standard Java application and use and test the curve fitting code there. But these options were to take much time. Then I worked around the issue by different way. The issue used to reproduce if the number of points to smooth were very high. If the number of points are very high, then not calling the smoothing was temporary solution. In a typical usage of the app, it was not reproing.

On the last day (1st Jan), I created developer account, signed my app, created screenshots and uploaded my app. After two or three hours, it was available on the Android market.
While publishing the app, I discovered that Indian developer can not publish paid app on android market. I was disappointed by this. Although the Scratchpad was free, I have plan for my next paid app. Now I am considering iOS platform for my future paid app.

On the next day I was very disappointed to see that there were no downloads of this app. Then I shared the the app on reddit (/r/androidapps)  and then the app started getting downloaded. As of now there are 30 downloads of this app.

I wanted to replace one of the screenshot of the app on the android market. It seems there is some bug. From the web interface, it lets to upload/replace screenshot but actually it is not updating.

One more thing that I did not mention yet. The experience of working on emulator is very bad. It is too slow to work on. I was mostly working on a tablet (Asus EEE Pad Transformer). My code was crashing on emulator with older version of android (older then Honeycomb). Because of time constraint and slow emulator experience, I did not get much time to debug the issue and removed the support for older android versions. The Scratchpad works for Honeycomb and newer Android version. I guess, the Scratchpad download would have been more if it supported older version.
Here is android market link to Scratchpad: https://market.android.com/details?id=com.avabodh.scratchpad


  1. Do you think you can post the source code or a barebones version as a reference for others?

    1. As I read the articles on different information blogs and peoples showing good responses to the essay service sites and clothing brands like wasket price in pakistan that was good and amazing.

  2. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training JavaEE Training in Chennai Java EE Training in Chennai

  3. Hello. What a fine fellow you are!
    After all, one desire to do something is not enough. You have to try, constantly learn something.
    I, as a expert in college homework help, often communicate with different students. And I know that not many people want to learn something on their own. Many people prefer that they do everything for them. It's not a problem and I'm happy to help them write essays or other college papers. But I'm very glad that there are those students who are trying, albeit with errors, but independently to learn something. After all, it shows their desire to develop, which means that most likely they will become good specialists.

  4. Thanks for sharing, I just like the valuable info you provide for your articles. I’ll bookmark your weblog and take a look at once more right here regularly. I am an essay writer. Writing is my passion. I am working in Buy essays online writing services where I write essays for college students. They provides you opportunity to score high academic marks.

  5. Hi, I had a problem with the essay and very good guys helped me, I just wrote them "write my essay" and they did an excellent job with the task. I recommend to everyone.

  6. After some research, I ended up selecting resumeyard to help create a resume. I was not disappointed with their services. The turn around time was much better than expected. My resume writer was very responsive to the feedback I provided and the end result is much better than what I could have built myself.

  7. وهناك العديد من العوامل الأخرى ، ولكن ما سبق هو أهم النقاط التي ستؤكد لك قوة شركة مكافحة الحشرات التي ستتعاقد معها لأداء الخدمة ، كل الأشياء المتاحة لنا في الفناء وأكثر ، من حيث استخدام المبيدات الآمنة ، واختيار الموهوبين من الأفضل في مجال رش المبيدات ومكافحة الآفات في جميع أنحاء العالم ، وتوفير ضمان كامل وشامل لرضاكم ، وتلبية التواريخ المتفق عليها مقدما.
    ارخص شركة مكافحة حشرات

  8. I am really satisfied with this service. You can rewrite my essay and it are always supplied through a highly qualified and very experienced rewriter who are able to provide you with completely detailed and unqiue copies of your papers.

  9. As we all know that the one of the most famous and most trending faculty all over the world is the IT, CS and programming faculty and in this sense the students often stuck with their academics activities of diploma assignments writing help in regards of coding and programming for the application development although web or app. Such type of post really motivate and provide help to the students of those.