Open an activity with animation in Android

One of the funny part of mobile development for me is animations. When developing a mobile application, time to time we are working on animations for better user interaction and experience. Android has good animation classes like android.view.animation and Animation. And a lot of apps are using this classes very well for views and widgets.

HttpHelper class for Android

When we are developing an application that is interacted with web, we needs http methods to get/put/post/delete something. For Android, i have created a helper class that is called as HttpHelper. Send url and json data to this class and receive meaningful response object with status, data and exception.

Use log4j in Android

When i am developing an application for Android, i am already looking for a good library or functionality for logging mechanism. For Java applications i am already using log4j and log4net for .net applications. When i am researching a log4j capabilities on Android, i found a good library which is called android-logging-log4j. It is an open source and it has a simple and good LogConfigurator class.

Send asynchronous e-mail in C#

When developing an application, we generally use an auto e-mail functions to send notification, information, etc. to user. When sending an e-mail in C# we use System.Net.Mail Namespace and SmtpClient Class to send the specified message to a SMTP server for delivery. But, Send method is a synchronous method. It means, send method blocks while the e-mail is transmitted and user waits for the response and also ui is blocked.

ProgressBox with JavaScript

When developing a web page, time to time we needs a ProgressBox to show information to user about long progress. For example when making ordered ajax calls, we want to show information about process. I have developed my ProgressBox function with java script and jQuery. I hope it will be useful for you.

MessageBox with JavaScript

I am a big fun of JavaScript and jQuery. I enjoy the most when coding with javascript. Here is one of the example of my javascript functions. This is MessageBox functionality with javascript and jQuery.

When developing a web page, time to time we needs a MessageBox to get confirmation from user, or to show some information or warning. Default alert function of browsers is not enough and it is not expendable. Because of that i have developed my MesasgeBox function with javascript and jQuery. I hope it will be useful for you.

UncaughtException in Android

One of the nightmares for developer is an unhandled exception in an application. When we are developing an application, we already use try-catch blocks to handle exceptions. But, time to time we miss something on code part. Imagine that, we are reading string data from database and compare it with some values. If we receive data from database as a null it means NullPointerException will be thrown.
    
    String dummyString = null;

    if (dummyString.equals("something")) {
        int dummyInt = 1;
    }

Show activity like a dialog in Android

When we are developing an Android application, time to time we want to show dialog for messages, confirmations, user interactions, etc. There is a good topic from Google which is explain how can we create and use dialogs.

MD5 hashing in C#

Here is the Encrypt function for MD5 hashing that i have coded. I hope it is useful for you.

JavaScript and decimal separator

When calculating something in JavaScript or parsing text into a numeric value "," separator is a problem. Because, decimal separator is "." in JavaScript.
For example, you receive JSON data from server and all decimal numbers are received with "," separator because of server/user settings or programming language.

Create your events in Android

Event-driven programming is a programming paradigm in which the flow of the program is determined by events—i.e., sensor outputs or user actions (mouse clicks, key presses) or messages from other programs or threads. And i like too much this kind of development. You can show an information to user when executing long process, you don't have to wait function for return value, etc.

Create your custom exception in Android

Exception handling is one of the most important thing when we are developing application. A lot of programming languages has exception handling mechanism and has lot of pre-defined exception types. For example, FileNotFoundException, NullPointerException, etc.

C# and NumberDecimalSeparator

When developing an application with C# (also VB), decimal separator can be a nightmare for developer. User can enter a numeric value with dot or comma. Like 2.5 or 2,5

When we try to parse this value to a numeric value, user separator can be a problem.

C# and ConvertToNullable

Time to time, we need to convert values to another variable type. For example, when we save the product price, we need to convert string value to numeric value that is entered from user interface. Also, time to time we need to convert value to null value and save it as a null. For example, user creates a product from user interface but there is no discount value for this product. And we want to save discount value as a null.

Android device is tablet?

If you want to check device type is tablet or not, here is the tricky function that i am using.
public static boolean isTablet(Context context) {
    int xlargeBit = 4; // Configuration.SCREENLAYOUT_SIZE_XLARGE;
    Configuration config = context.getResources().getConfiguration();
    boolean isTablet = (config.screenLayout & xlargeBit) == xlargeBit;
    return isTablet;
}

24 hour format setting in Android

When i was developing a date time picker component for our customer, there was a request from them.
When user selects time, show 24 hour format with user setting. If user uses 12 hour format in his/her phone settings, show AM/PM selection, otherwise don't show this selection.