Android studio android studio以太坊钱包加载消息
我正在做一个应用程序,创建一个以太坊钱包,当你触摸按钮寄存器时发送一些以太,这需要大约1分钟的时间,当它发生时,我想显示一条消息说:正在创建钱包,请稍候 当我显示消息时,它不会创建钱包,或者它会创建钱包但不会显示消息 附言:如果有人知道如何减少时间来做这件事,这将对我有很大帮助Android studio android studio以太坊钱包加载消息,android-studio,blockchain,ethereum,cryptocurrency,Android Studio,Blockchain,Ethereum,Cryptocurrency,我正在做一个应用程序,创建一个以太坊钱包,当你触摸按钮寄存器时发送一些以太,这需要大约1分钟的时间,当它发生时,我想显示一条消息说:正在创建钱包,请稍候 当我显示消息时,它不会创建钱包,或者它会创建钱包但不会显示消息 附言:如果有人知道如何减少时间来做这件事,这将对我有很大帮助 谢谢你的帮助。。。消极的 无论如何,我已经解决了它,我将我的解决方案留在下面: @Override protected void onCreate(Bundle savedInstanceState) { su
谢谢你的帮助。。。消极的 无论如何,我已经解决了它,我将我的解决方案留在下面:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ActivityMain);
errorMsg = new AlertDialog.Builder(this);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new MyAsyncTasks().execute();
}
});
}
class MyAsyncTasks extends AsyncTask<Void, Void, String> {
// ProgressDialog dialog;
@Override
//It will show a message during your background
protected void onPreExecute() {
dialog = new ProgressDialog(mainActivity.this);
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setTitle("Add title");
dialog.setMessage("Add message");
dialog.setIndeterminate(true);
dialog.setCanceledOnTouchOutside(false);
dialog.show();
}
@Override
protected void onPostExecute() {
dialog.dismiss(); // Close the Dialog
//Show a window with error or operation succesfully
if(hash.equals("Error")){
displayError("Error", "Error");
dialog.cancel();
}
else{
displayConfirmation("Operation Succesfully");
dialog.cancel();
}
}
@Override
protected String doInBackground(Void... voids) {
dialog.show();
// your code to do you background activity
}
}
@覆盖
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.ActivityMain);
errorMsg=新建AlertDialog.Builder(此);
setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图v){
新建MyAsyncTasks().execute();
}
});
}
类MyAsyncTasks扩展了AsyncTask{
//进程对话;
@凌驾
//它将在您的背景中显示一条消息
受保护的void onPreExecute(){
dialog=新建ProgressDialog(mainActivity.this);
setProgressStyle(ProgressDialog.STYLE_微调器);
对话框。设置标题(“添加标题”);
setMessage(“添加消息”);
对话框。setUndeterminate(true);
对话框。setCanceledOnTouchOutside(false);
dialog.show();
}
@凌驾
受保护的void onPostExecute(){
dialog.dismise();//关闭对话框
//成功显示有错误或操作的窗口
if(hash.equals(“Error”)){
显示错误(“错误”、“错误”);
dialog.cancel();
}
否则{
显示确认(“操作成功”);
dialog.cancel();
}
}
@凌驾
受保护的字符串背景(无效…无效){
dialog.show();
//您的代码用于执行后台活动
}
}