Webview中用户输入错误的用户名或密码后,打开另一个活动

时间:2018-08-20 10:30:55

标签: android android-webview

我有一个包含自定义loginactivity的应用,该自定义autofillwebview中传递了webview的用户名和密码。在loginactivity中,用户填写了捕获并登录,现在,如果登录失败,我想再次将用户重定向到 library(caret) library(GA) library(class) #data import tea_jenis_F3 <- read.csv("D:/inggrit/program/F3.csv") str(tea_jenis_F3) #to check missing data anyNA(tea_jenis_F3) #data slicing set.seed(101) intrain_jenis_F3 <- createDataPartition(tea_jenis_F3$category, p= 0.7, list = FALSE) training_jenis_F3 <- tea_jenis_F3 [intrain_jenis_F3,] testing_jenis_F3 <- tea_jenis_F3 [-intrain_jenis_F3,] #transforming the dependent variable to a factor training_jenis_F3[["category"]] = factor(training_jenis_F3[["category"]]) #fitness function fitness_KNN <- function(chromosome) { # First values in chromosome are 'k' of 'knn' method tuneGrid <- data.frame(k=chromosome[1]) # train control train_control <- trainControl(method = "cv",number = 10) # train the model set.seed(1234) model <- train(category ~ ., data= training_jenis_F3, trControl=train_control, method="knn", tuneGrid=tuneGrid) # Extract accuracy statistics accuracy_val <- model$results$accuracy } GA <- ga(type = "real-valued", fitness = fitness_KNN, lower = -10, upper = 10, monitor = NULL)

1 个答案:

答案 0 :(得分:0)

如果您知道成功登录后登录页面重定向到的URL,则可以执行此操作

mWebView.setWebViewClient(new WebViewClient() {
        @Override  
        public void onPageFinished(WebView view, String url) {
             super.onPageFinished(mWebView, url);
          //check if login url is correct & launch activity
         if(url.equal("YOUR_SUCCESS_URL"){
           //launch activity
          }

        }  
 });

`