Text Verification from Popup

Text Verification from Popup.
I need to verify the text from popup
example
user enter the invalid username the popup with message is occurs like “Username/Password is inValid”
i need to verify this the same message is shown to the user or not how i can ??
using Appium JAVA on Android Application

Thanks

You can write a xpath to identify the text in popup,then use gettext() method and compare

Thanks a lot i did this…

public void ValidUsernameInvalidPassword(String username, String password)

{
	mUsernameField.sendKeys(username);
	mPasswordField.sendKeys(password);
	mSignInButton.click();
	String result = mDriver.findElementById("dk.dsg.and.store.controllers:id/tvMessage").getText();
	System.out.println("Alert text Is -> " + result);

	if ("Fejl ved logon. Forkert brugerID eller kode..".equals(result))

	{

		mDriver.findElementById("dk.dsg.and.store.controllers:id/btnOk").click();

	}
}

what exactly error you are facing?
logs from console or appium required for further investigation