当前位置: 首页 > news >正文

用jsp做婚纱网站的流程网站优化排名软件网站

用jsp做婚纱网站的流程,网站优化排名软件网站,曲靖富源最新疫情,中国建设银行大学生招聘信息网站我正在使用的应用程序具有登录/注册,该登录/注册连接到mysql数据库.起初,我在UI线程上运行了所有程序,后来发现由于在Android的UI线程上运行较长的代码而无法正常工作.我试图编辑我的代码以在添加的新线程上运行长任务..现在我的应用程序注册了我在mysql中看到的结果,但是由于这…

我正在使用的应用程序具有登录/注册,该登录/注册连接到mysql数据库.起初,我在UI线程上运行了所有程序,后来发现由于在Android的UI线程上运行较长的代码而无法正常工作.我试图编辑我的代码以在添加的新线程上运行长任务.

.现在我的应用程序注册了我在mysql中看到的结果,但是由于这个错误,我的应用程序一直关闭

android.view.ViewRootImpl$CalledFromWrongThreadException:

Only the original thread that created a view hierarchy can touch its views.

该错误是可以理解的,但我不知道如何将一个或多个View运行回UI线程.

我已经对runOnuithread进行了一些研究,但是我不知道将其放置在代码中的位置,或者天气我将之前添加的新线程放在错误的位置开始,请

谁能帮我解决这个问题

这是代码片段

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.register);

// Importing all assets like buttons, text fields

inputFullName = (EditText) findViewById(R.id.registerName);

inputEmail = (EditText) findViewById(R.id.registerEmail);

inputPassword = (EditText) findViewById(R.id.registerPassword);

btnRegister = (Button) findViewById(R.id.btnRegister);

btnLinkToLogin = (Button) findViewById(R.id.btnLinkToLoginScreen);

registerErrorMsg = (TextView) findViewById(R.id.register_error);

// Register Button Click event

btnRegister.setOnClickListener(new View.OnClickListener() {

public void onClick(View view) {

/** According with the new StrictGuard policy, running long tasks on the Main UI thread is not possible

So creating new thread to create and execute http operations */

new Thread (new Runnable() {

@Override

public void run() {

//

String name = inputFullName.getText().toString();

String email = inputEmail.getText().toString();

String password = inputPassword.getText().toString();

UserFunctions userFunction = new UserFunctions();

JSONObject json = userFunction.registerUser(name, email, password);

// check for login response

try {

//

//

if (json.getString(KEY_SUCCESS) != null) {

registerErrorMsg.setText("");

String res = json.getString(KEY_SUCCESS);

if(Integer.parseInt(res) == 1){

// user successfully registred

// Store user details in SQLite Database

DatabaseHandler db = new DatabaseHandler(getApplicationContext());

JSONObject json_user = json.getJSONObject("user");

// Clear all previous data in database

userFunction.logoutUser(getApplicationContext());

db.addUser(json_user.getString(KEY_NAME), json_user.getString(KEY_EMAIL), json.getString(KEY_UID), json_user.getString(KEY_CREATED_AT));

// Launch Dashboard Screen

Intent dashboard = new Intent(getApplicationContext(), MainActivity.class);

// Close all views before launching Dashboard

dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

startActivity(dashboard);

// Close Registration Screen

finish();

}else{

// Error in registration

registerErrorMsg.setText("Error occured in registration");

}

}//

} catch (JSONException e) {

e.printStackTrace();

}

}

}).start();

}

});

// Link to Login Screen

btnLinkToLogin.setOnClickListener(new View.OnClickListener() {

public void onClick(View view) {

Intent i = new Intent(getApplicationContext(),

LoginActivity.class);

startActivity(i);

// Close Registration View

finish();

}

});

}

}

http://www.lbrq.cn/news/2459917.html

相关文章:

  • 厦门网站建设工作室网站内容优化方法
  • 东阳网站建设有哪些seo培训一对一
  • 中国党风廉政建设网站by网站域名
  • 郑州哪家公司做网站好菏泽百度推广公司电话
  • 馆陶网站建设价格代码编程教学入门
  • 南浔城乡建设局网站最新网站查询工具
  • 上海服装集团网站建设app线下推广怎么做
  • 2核4G服务器wordpressseo推广公司价格
  • 网站关键词和网页关键词的样本泉州百度网站推广
  • 如何成立一家公司合肥seo
  • 劳务网站怎样做百度世界排名
  • wordpress站群管理seo黑帽有哪些技术
  • 自做网站告白如何弄网站品牌推广公司
  • 做视频搬运工的网站互联网十大企业
  • seo 网站 制作搜索指数在线查询
  • 下载网站的表格要钱如何做深圳优化服务
  • 流媒体网站建设方案怎么做网站推广
  • wordpress 做音乐网站友谊平台
  • 市场管理监督局是干什么的网站优化推广平台
  • php做的大型网站新闻今天的最新新闻
  • 九年级上册信息技术做网站线上平台推广方案
  • 中山网站建设哪家好网站推广广告
  • 免费推广网站软件子域名在线查询
  • 企业网站建设成都个人如何在百度上做广告
  • 烟台建站程序北京百度推广代理公司
  • 做电商什么外推网站好广点通推广登录入口
  • 免费做网站靠谱么域名注册入口
  • 企业网站设计谁家做了的好嘉兴百度快照优化排名
  • seo手机搜索快速排名什么叫做seo
  • 腾讯网站建设方案最佳bt磁力搜索引擎
  • 如何实现打印功能
  • 【应急响应】进程隐藏技术与检测方式(二)
  • vue使用xlsx库导出excel
  • 【Python小工具】-英文大小写转换功能的GUI工具
  • C 语言 | 结构体详解:自定义数据类型的艺术
  • AR眼镜重塑外科手术导航:精准“透视”新突破