Posts

Showing posts from 2014

Converting app ideas into reality

Recently I came across this post . It describes how to start working with new app ideas and make them market ready. It also mentions some tools to analyze competition of existing apps, prepare wireframes, server support. I hope you will find it useful too. For wireframes more free tools are available. These are mentioned in here .

Reducing memory consumption (Part 2)

As we have seen in earlier post first method to reduce memory was reducing font loading. This is described here . Next method is to use weak references. 2. Making use of weak references Our application uses observer model to notify data availability. Here a EventNotifier class is used to register listeners for the event. As soon as the event occurs, it fires the event with EventId and EventObject. Some activities use data that is fetched from server. In order to get this event activity registers itself with the EventNotifier. There is a communicator thread, which downloads data, and calls method public int eventNotify(int eventType, Object eventObject) of EventNotifier. Now this method finds out registered listeners and informs them about update. Problem comes when Android decides to kill activity for reusing resources. In this case OnDestroy() method may not get called. OnDestroy() handles unregistration activity from EventNotifier. Now as the EventNotifier still holds re...

Reducing memory consumption (Part 1)

Recently our app faced lot of issues because of huge memory consumption. We resolved these issues using following techniques: 1. Reducing font instances 2. Making use of weak references 3. Making handlers static and final In this post we will see first approach. Second approach will be covered in next post. 1. Reducing font instances We used to have a custom text view. This text view uses a font provided by application. Code below shows how it used to load. public boolean setCustomFont(Context ctx, String asset) { Typeface tf = null; try { tf = Typeface.createFromAsset(ctx.getAssets(), "fonts/" + asset.trim()); } catch (Exception e) { Log.e(TAG, "Could not get typeface: " + e.getMessage() + "\n value of asset string " + asset); return false; } setTypeface(tf); return true; } After using memory profiling tool of android, we came to know that each time this activity is opened memory usage increases...

Pager Tabs with Icon and text which appears to have fixed width.

Image
We are going to create pager tabs, which unlike default library will be able to show more than 3 tabs in a screen. All the tabs will close to each other.   To achieve this purpose we shall need a library located at http://viewpagerindicator.com/ . Download the library project, named as JakeWharton-Android-ViewPagerIndicator-2.4.1-0-g8cd549f.zip. It includes a library and sample project. We need library for our app. If you are curious, you may check the sample project as well. Import the library project in eclipse.   Create a new Android project and open its properties. Add library project in this project using Android section in properties. Clean library and android project. Add the following in your activity_layout.xml. <com.viewpagerindicator.TabPageIndicator                 android:id="@+id/indicator"              ...

Downloading image blob from Google's App Engine

Last time we have seen how to upload an image to app engine. Now its time to fetch it back. There are 2 ways to do that. 1. Using serve() 2. Using urls generate for each blob. I tried using 1st method, but it did not work. So tried out second method which did work. Following are the details of that implementation. First get the url for download for each blob. To do that you need blob key of your blobs. In my case I have saved blob keys in a separate database entity. Blob key is returned when you create new blob. String[] array = getBlobKeyByProblemId(problemId); if (array != null && array.length > 0) { String[] urls = new String[array.length]; for (int i = 0; array != null && i < array.length; i++) { ImagesService imagesService = ImagesServiceFactory.getImagesService(); BlobKey key = new BlobKey(array[i]); ServingUrlOptions options = ServingUrlOptions.Builder.withBlobKey(key).secureUrl(true); urls[i] = im...

Tips for how to improve ranking of your app in app store.

Tips for how to improve ranking of your app in app store. http://katemats.com/20-things-every-ios-and-mobile-dev-should-consider-in-their-app-promotion-strategy/

Upload an image from Android to Google's app engine server

Recently I have started working on a project on Android. This app involves uploading few images chosen by user to the server. App engine has a document page at https://developers.google.com/appengine/docs/java/blobstore/ , but unfortunately for Android developer it is not enough. This document mentions how to upload using web client i.e. using using form in a html page. For uploading using java application we need a multipart message. We need following libs: 1. httpcore-4.3.2.jar 2. httpmime-4.3.3.jar httpcore-4.3.2.jar and httpmime-4.3.3.jar can be found at http://hc.apache.org/downloads.cgi .These jars are part of zip file containing other files. Extract the entire zip and copy these two required files in <android project>/libs. public void uploadBlobImage( String path, String link ) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(link); try { MultipartEntity entity = new MultipartEntity(); ...