I am trying below code to access the layers, which is token based rest service with username and password..It is not working any idea???
UserCredentials creds = new UserCredentials();
creds.setUserAccount("username", "password");
creds.setUserToken("huiqyuidhiqkljklwejk6Qzwgehwj6bqoKbjhwejkhiTBx", "localhost"); ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer("http://.........", creds);
Thanks