back button is working on emulator but it is not working in device in android

I'm new to android development. I have index page and I'm displaying every links in the same page using div concept.

Now I want to use the back button for my application. I have developed code to handle the div and it is working in the AVD(Andriod Virtual Device 5556) but if I upload the *.apk into my device it is not working.

I'm waiting for your reply. Please help me.

This is my sample code:

HTML Sample code:

<div id="photo_playlist">       
    <div id="photo_playlist_home">
        <div class="HomePhotoDetailsBar">
            <div class="innerplay" id="innerrow10833">
                <a style="text-decoration:none;" onClick="player('1');">
                    <div class="thm_image">
                    <div class="video_details_n">
                        <div class="video_details_premium">Premium</div>
                        <div class="photo_details_head">Zoe Duchesne</div>
                        <div class="video_details_premium">5 photos</div>
                    <div class="video_arrow">dsfsfsfss</div>
<div id="detail">
    <div id="playlist"></div>
<div id="player">
    <div id="photocontainer"></div>

JS Sample:

function photos() {

function resetPhotoPlaylist() {




function back() {

    var previous = history_.pop();
    if(history_.length==0) {
        history_ = ["home"];

    switch(previous) {
        case "home"     :home();break;
        case "news"     :news();break;
        case "video"        :video();break;
        case "player"       :player(1);break;
        case "gallery"      :gallery(1);break;
        case "photos"       :photos();break;
        case "reader"       :reader(1);break;
        case "searchresult" :searchresult();break;
        case "search"       :search();break;

function addToHistory(page) {


Java Code:

public void onBackPressed()

Thanks, Rajeevgandhi. S



appView.loadUrl("javascript:(function() { back();})()");

Need Your Help

How does Java resolve a relative path in new File()?

java file relative-path

I am trying to understand the way Java resolves relative path in while creating a File object.

Drupal Block View Execute Javascript function

javascript php function drupal drupal-blocks

This would be my first custom module I am creating, and having a few grey hair's for something as simple as rendering a js function into a drupal block module.