Application Under Test go in background

Dear Every One,
I am new to Appium Testing. I am using Android Studio for script development on Windows 10 and version of Appium is v1.2.0-beta.3. I am facing a problem which i am unable to solve. When i execute test case either on Virtual Device or on Real Device (Lenovo P70), application under test simply go in background and as result Appium could not find controls and test case doesn’t execute any further beyond first step. I am trying to execute basic test cases on Android applications such as Calculator etc. Test Script is

public void testCal() throws Exception {
WebElement two=driver.findElement(By.name(“2”));
two.click();
WebElement plus=driver.findElement(By.name("+"));
plus.click();
WebElement four=driver.findElement(By.name(“4”));
four.click();
WebElement equalTo=driver.findElement(By.name("="));
equalTo.click();
WebElement results=driver.findElement(By.tagName(“EditText”));
assert results.getText().equals(“6”):“Actual value is : “+results.getText()+” did not match with expected value: 6”;
}