We all know we cannot just pass object references to activities or fragments, we must put those in an Intent / Bundle. We only have two options, with Parcelable or Serializable. How about the performance / speed?
Here the results:
Serializable: 1.0004ms, Parcelable: 0.0850ms – 10.16x improvement.
Serializable: 1.8539ms – Parcelable: 0.1824ms – 11.80x improvement.
Serializable: 5.1224ms – Parcelable: 0.2938ms – 17.36x improvement.
Source By : http://www.developerphil.com/parcelable-vs-serializable/
Thanks to Philippe Breault.
And here the Source to download
One time I develop an application that requires trigger a notification every specific time. Then I create Alarm Manager for trigger Android Notification, but i got my Alarm Manager firing random time after first notification. So my notification sometimes show at random time.
// Example now date + 7 day
Date now = new date();
calendar = Calendar.getInstance();
myIntent = new Intent(mContext, MyReceiver.class);
pendingIntent = PendingIntent.getBroadcast(mContext, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC, calendar.getTimeInMillis(), pendingIntent);
If we code inside an Activity and we need the application context we can use getApplicationContext().
Inside an Activity we can use getApplicationContext() if we need the application context. But what if we are not inside an Activity and we need that? I will explain how you can get the context of the application outside an Activity with simple coding.
MyBOLT! (Non Official) is an android application that helps users BOLT! to check the rest of quota and expiration date of quota. With MyBOLT!, users can easily monitor their quota and expiration date with widget. This application have simple design and material guidelines, and reminder alarm (notification) will alert users when before the quota expired.
Once time, I make android application and requires pull data from web servers (Json). And then i do HttpGET to load the data from web server (big enough), after that i must insert the data into database. It takes 12-15 minutes WTF.., how can i used the application if it takes so long?
Then i found Jackson Library And Use Bulk Insert after that it takes only 10 – 15 seconds. Very Amazing