views:

206

answers:

1

Hi all,

am new to this android development. I have index page and am 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.

Am waiting for your reply Please help me......

This is my sample code:

HTML Sample code

asdasdasdadadad Premium Zoe Duchesne 5 photos dsfsfsfss

JS Sample:

function photos() { resetPhotoPlaylist(); $('#photo_playlist').addClass('current'); $('#photo_playlist').css('display','block'); $('#photo_playlist_home').addClass('current'); $('#photo_playlist_home').css('display','block'); $('#player').css('display','none'); $('#playlist').css('display','none'); $('#detail').css('display','none'); $('#photocontainer').css('display','none'); } function resetPhotoPlaylist() { $('#second_playlist').removeClass('current'); $('#second_playlist').css('display','none');

$('#playlist').removeClass('current');
$('#playlist').css('display','none');

$('#photocontainer').removeClass('current');
$('#photocontainer').css('display','none');

$('#photo_playlist_home').removeClass('current');
$('#photo_playlist_home').css('display','none');

}

function back() {

history_.pop();
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) {

    history_.push(page);

}

Java Code:

public void onBackPressed() { appView.loadUrl("javascript:back();"); }

Thanks, Rajeevgandhi. S

A: 

Try

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