I would like to make a call of my method class , which allows me to question my worksheet. Now I would like to know how to call my function of DataAccess class , when I click the button enters LoginActivity to query my worksheet. DataAccess class is up and running.
This method of my class DataAcces (I tested it and works correctly):
public boolean checkUser(String username,String password) throws IOException,ServiceException{
SpreadsheetService service = new SpreadsheetService("MyApp");
FeedURLFactory factory = FeedURLFactory.getDefault();
String key = "***my_key***";
URL spreadSheetUrl = factory.getWorksheetFeedUrl(key,"public","full");
WorksheetFeed feed = service.getFeed(spreadSheetUrl, WorksheetFeed.class);
WorksheetEntry worksheet = feed.getEntries().get(0);
URL url = worksheet.getListFeedUrl();
ListFeed listFeed = service.getFeed(url,ListFeed.class);
List<ListEntry> l = listFeed.getEntries();
for (int j = 0; j < l.size(); j++) {
String user = l.get(j).getCustomElements().getValue("username");
String pwd = l.get(j).getCustomElements().getValue("password");
if(user.equals(username) && pwd.equals(password))
{
return true;
}
}
return false;
}
This is method that I call in signInButton.setOnClickListener
:
private void signIn(String username,String password) {
DataAcces dataAccess = new DataAccess();
if(dataAccess.checkUser(username,password);){
System.out.println("ok");
}
}
When I call dataAccess.checkUser(username,password)
I get FATAL ERROR
PLEASE HELP ME!!!
I'm not sure if this is the problem, but in this line you have:
if(dataAccess.checkUser(username,password);){
Try the following
if(dataAccess.checkUser(username,password)){
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.