Title: Android Studio error: "Method getText() must be called from the UI Thread, currently inferred thread is worker · Issue #47 · hmkcode/Android · GitHub
Open Graph Title: Android Studio error: "Method getText() must be called from the UI Thread, currently inferred thread is worker · Issue #47 · hmkcode/Android
X Title: Android Studio error: "Method getText() must be called from the UI Thread, currently inferred thread is worker · Issue #47 · hmkcode/Android
Description: Hi. I'm doing a Android Studio Project, with some AsyncTasks, and at some point it gives me the error at the Title. I know that i really can't use method getText it in doInBackground, but i've tried to do the recommended changes from ano...
Open Graph Description: Hi. I'm doing a Android Studio Project, with some AsyncTasks, and at some point it gives me the error at the Title. I know that i really can't use method getText it in doInBackground, but i've trie...
X Description: Hi. I'm doing a Android Studio Project, with some AsyncTasks, and at some point it gives me the error at the Title. I know that i really can't use method getText it in doInBackground, but i...
Opengraph URL: https://github.com/hmkcode/Android/issues/47
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Android Studio error: \"Method getText() must be called from the UI Thread, currently inferred thread is worker","articleBody":"Hi. I'm doing a Android Studio Project, with some AsyncTasks, and at some point it gives me the error at the Title. I know that i really can't use method getText it in doInBackground, but i've tried to do the recommended changes from another questions, to the code and nothing seems to work. This is my code: \r\n\r\n`public class LoginActivity extends AppCompatActivity {\r\n\r\n\r\n Button btSignIn;\r\n Button btSignUp;\r\n EditText edtEmail;\r\n EditText edtPassword;\r\n String CHANNEL_ID = \"personal_notification\";\r\n int NOTIFICATION_ID = 001;\r\n\r\n UserDatabase database;\r\n UserDao userDao;\r\n User userTemp = new User();\r\n\r\n SharedPreferences emailSharedPref;\r\n\r\n ProgressDialog progressDialog, progressDialogDownload;\r\n\r\n @Override\r\n protected void onStart() {\r\n super.onStart();\r\n }\r\n\r\n @Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_login);\r\n Log.d(\"MYTAG\", \"inicio \");\r\n progressDialog = new ProgressDialog(this);\r\n progressDialog.setCancelable(false);\r\n progressDialog.setMessage(\"A verificar utilizador...\");\r\n progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);\r\n progressDialog.setProgress(0);\r\n\r\n\r\n database = Room.databaseBuilder(getApplicationContext(), UserDatabase.class, \"mi-database.db\").build();\r\n\r\n\r\n userDao = database.getUserDao();\r\n\r\n\r\n btSignIn = findViewById(R.id.btSignIn);\r\n btSignUp = findViewById(R.id.btSignUp);\r\n\r\n edtEmail = findViewById(R.id.email);\r\n edtPassword = findViewById(R.id.password);\r\n\r\n\r\n btSignUp.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n startActivity(new Intent(LoginActivity.this, SignUpActivity.class));\r\n }\r\n });\r\n btSignIn.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n LoadAsyncTaskLogin loadAsyncTaskLogin = new LoadAsyncTaskLogin();\r\n loadAsyncTaskLogin.execute(userTemp);\r\n }\r\n });\r\n\r\n }\r\n\r\n public class LoadAsyncTaskLogin extends AsyncTask\u003cUser, Void, User> {\r\n\r\n @Override\r\n protected User doInBackground(User... users) {\r\n String email = edtEmail.getText().toString();\r\n String password = edtPassword.getText().toString();\r\n\r\n User user2 = new User();\r\n user2 = database.getUserDao().getUser(email,password);\r\n\r\n return user2;\r\n }\r\n\r\n @Override\r\n protected void onPostExecute(User user2){\r\n Intent intentToWhatToChoose = new Intent(LoginActivity.this,WhatToChoose.class);\r\n\r\n if(user2 != null){\r\n if(user2.password.equals(edtPassword.getText().toString())){\r\n emailSharedPref = getApplicationContext().getSharedPreferences(\"email\",0);\r\n SharedPreferences.Editor editor = emailSharedPref.edit();\r\n editor.putString(\"User Successfully Logged In\",user2.email);\r\n editor.commit();\r\n\r\n startActivity(intentToWhatToChoose);\r\n Toast.makeText(LoginActivity.this, \"Welcome to Our App\", Toast.LENGTH_LONG).show();\r\n } else {\r\n Toast.makeText(LoginActivity.this, \"Incorrect Credentials\", Toast.LENGTH_LONG).show();\r\n }\r\n } else {\r\n Toast.makeText(LoginActivity.this, \"Incorrect Credentials\", Toast.LENGTH_LONG).show();\r\n }\r\n }\r\n }`\r\n\r\nThe error is on \"doInBackground\". What changes do i have to do?","author":{"url":"https://github.com/8150133","@type":"Person","name":"8150133"},"datePublished":"2019-09-11T12:51:56Z","url":"https://github.com/hmkcode/Android/issues/47"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:32b67a9d-994a-fb61-e9df-91ac60a34f8f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D898:1C0841:AC13A4:F6F146:6AFDA68A |
| html-safe-nonce | ade6d1b7f4fe6485f0af92bc5633a791c9c9cc07ac32c53c905922b78863abf7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODk4OjFDMDg0MTpBQzEzQTQ6RjZGMTQ2OjZBRkRBNjhBIiwidmlzaXRvcl9pZCI6IjQxMTg5OTU0NjAwODY1OTU5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ed37835cb3ba8fb9732a5043289c2f535b3f11a4b983fd3f4ef75093152cff0 |
| hovercard-subject-tag | issue:492218728 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/hmkcode/Android/47/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1bcc3b4e0b66fffef171647812396c2e58a139f036328ac6b16f941c963d4233/hmkcode/Android/issues/47 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1bcc3b4e0b66fffef171647812396c2e58a139f036328ac6b16f941c963d4233/hmkcode/Android/issues/47 |
| og:image:alt | Hi. I'm doing a Android Studio Project, with some AsyncTasks, and at some point it gives me the error at the Title. I know that i really can't use method getText it in doInBackground, but i've trie... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 8150133 |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| turbo-cache-control | no-preview |
| go-import | github.com/hmkcode/Android git https://github.com/hmkcode/Android.git |
| octolytics-dimension-user_id | 3790597 |
| octolytics-dimension-user_login | hmkcode |
| octolytics-dimension-repository_id | 12544093 |
| octolytics-dimension-repository_nwo | hmkcode/Android |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 12544093 |
| octolytics-dimension-repository_network_root_nwo | hmkcode/Android |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width