All posts in Android

  • Exit Button In Android App

    Android Exit

    A lot of developers wondering about the exit button and how they can apply it efficiently, well there are many discussions on stackoverflow or other forums suggest to use this piece of code.

    This code will only “finish” the current activity and never finishes the rest of the activities or take them to the finalize stage.

    So is there a way to exit an android app completely ?

    the answer is very simple: never and never allow the user to exit the app on his own.

    WHY ?

    That’s against Android nature and best practices, and yet the system handles this automatically. That’s what the activity lifecycle (especially onPause/onStop/onDestroy) is for. No matter what you do, do not put a “close” or “exit” application button.

    Do Users Really Want It?

    Let me posit this assertion: no they don’t.

    Of the apps that ship with the device (Gmail, Contacts, Maps, Gallery, etc.) exactly none of them include an exit button, and most users are comfortable with that. Nonetheless many developers are adamant, “I added it after users demanded it!”.
    if you have to add this button, try not to, just explain why to whom ever demands this functionality, as I’m trying to do always when this case comes around, and it always works.

    Here’s a good video which explains the case:

  • Android: WebView unable to show ‘%’ percentage sign

    android-banner

    When you use WebView and pass HTML to it if that HTML code contains “%” – percentage sign you would have “Web Page not Available” error.

    Webpage Not Available

    % ERROR

    let’s see this simple code

    simply the error still exists.
    after searching the internet, I found a nice and easy solution.

    the solution is to replace all the % sings in the HTML code with

    (How HTML sees the %).