Code example for ViewSwitcher

Methods: getDisplayedChild

0
    @Override 
    public void onBackPressed() 
    { 
    	//Emulate the progressDialog.setCancelable(false) behavior 
    	//If the first view is being shown 
    	if(viewSwitcher.getDisplayedChild() == 0)
    	{ 
    		//Do nothing 
    		return; 
    	} 
    	else 
    	{ 
    		//Finishes the current Activity 
    		super.onBackPressed(); 
    	} 
    } 
    
}