Android ObjectInputStream and ObjectOutputstream snippet

At first, make your object serializable and let the IDE (in my case Eclipse) generate a serialVersionUID for you:

public class Post implements Serializable{

	private static final long serialVersionUID = 7884946435027239199L;

	public String firstname;

	public String lastname;


Writing to files with serialization and writing objects to file:

FileOutputStream fileOutputStream = openFileOutput("personobject", Context.MODE_PRIVATE);
ObjectOutputStream objectOutputStream= new ObjectOutputStream(fileOutputStream );

Reading files with serialization and get it as object:

FileInputStream fileInputStream = openFileInput("personobject");
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
Person person = (Person)objectInputStream.readObject();

Thats it!


How to include ActionBarSherlock in your Android-Project

If you have problems to include ActionBarSherlock in your Android project (because of not generated or something) then follow this quick guide:

Include ActionBarSherlock as library in your Eclipse-Workspace.

Both project needs to compile with Android 4.0 or newer. And you must  specify a targetSdkVersion of 11 or higher in your application’s manifest .


If you want to develop for Android 2.1 then add this to your application’s manifest and also build your app with api-level 15 (Android 4.0.3)

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>

Finally select “Project” -> “Clean” -> “Clean all projects” in Eclipse.

jQuery Mobile “mobileinit” Event

Unlike other jQuery projects, such as jQuery and jQuery UI, jQuery Mobile automatically applies many markup enhancements as soon as it loads (long before document.ready event fires). These enhancements are applied based on jQuery Mobile’s default configuration, which is designed to work with common scenarios, but may or may not match your particular needs. Fortunately, these settings are easy to configure.

When the jQuery Mobile starts to execute, it triggers a mobileinit event on the document object, to which you can bind to apply overrides to jQuery Mobile’s defaults.

That the mobileinit event works  you need to follow this sequence:

  1. Load jQuery
  2. Define mobileinit event
  3. Load jQuery Mobile

[crayon lang=”html”]

My Mobile Page


ASP.NET Calendar: Hide PrevMonthText or NextMonthText

If you use the ASP.NET Calendar Control and want to hide the PrevMonthText or NextMonthText then you need to use the PreRender-Event from the Calendar-Control.

In this example I hide the PrevMonthText (Hyperlink) when the current year and month equals calendars visible year and month. Note: You must set/init the VisibileDate-Property in Page_Load-Event. In my example I want that the start month and year of the control is set to today.

protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
MyCalendarControl.VisibleDate = DateTime.Now;

protected void MyCalendarControl_PreRender(object sender, EventArgs e)
// hide previous month link in calendar when current month and year equals calendars month and year
MyCalendarControl.PrevMonthText = DateTime.Now.Month == EventsCalendar.VisibleDate.Month && DateTime.Now.Year == EventsCalendar.VisibleDate.Year ? string.Empty : "<"