- (AWSTask *)initializeClients:(NSDictionary *)logins {
NSLog(@"initializing clients...");
[AWSLogger defaultLogger].logLevel = AWSLogLevelError; //AWSLogLevelVerbose;
[AWSServiceConfiguration addGlobalUserAgentProductToken:AWS_MOBILEHUB_USER_AGENT];
NSString *email = [JNKeychain loadValueForKey:@"email"];
NSDictionary *logins = [NSDictionary dictionaryWithObject:email forKey:developerProvider];
id<AWSCognitoIdentityProvider> identityProvider = [[CBDeveloperAuthenticatedIdentityProvider alloc]
initWithRegionType:AMAZON_COGNITO_REGION
identityId:nil
identityPoolId:AMAZON_COGNITO_IDENTITY_POOL_ID
logins:logins
providerName:developerProvider];
self.credentialsProvider = [[AWSCognitoCredentialsProvider alloc]
initWithRegionType:AMAZON_COGNITO_REGION
identityProvider:identityProvider
unauthRoleArn:nil
authRoleArn:nil];
//I have AWS_COGNITO_UNAUTH_ROLE and AWS_COGNITO_AUTH_ROLE but the docs don't seem to use them... and when I do there is no change
//http://docs.aws.amazon.com/cognito/latest/developerguide/developer-authenticated-identities.html
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AMAZON_COGNITO_REGION
credentialsProvider:self.credentialsProvider];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
return [self.credentialsProvider getIdentityId];
}
字符串EditText edituname = (EditText) findViewById(R.id.username);
EditText editpassword = (EditText) findViewById(R.id.password);
String s1 = edituname.getText().toString();
String s2 = editpassword.getText().toString();
Toast.makeText(Main2Activity.this, s1, Toast.LENGTH_LONG).show();
显示空值,因为代码位于s1
方法内。我希望它在onCreate
而非onCreate
。所以请告诉我一个解决方案,以便在buttonclick
中获得EditText
的价值。