【问题标题】:android studio ethereum wallet loading messageandroid studio 以太坊钱包加载消息
【发布时间】:2018-08-15 12:54:20
【问题描述】:

我正在做一个应用程序,它创建一个以太坊钱包并在你触摸按钮注册时发送一些以太币,这大约需要 1 分钟,而我想显示一条消息说:正在创建一个钱包,请稍候.

当我显示消息时,它不会创建钱包,或者它会创建钱包但不会显示消息。

PS:如果有人知道如何节省时间来做这件事,那将对我有很大帮助。

谢谢

【问题讨论】:

    标签: android-studio blockchain ethereum cryptocurrency


    【解决方案1】:

    感谢您的帮助...和否定。

    反正我已经解决了,我把我的解决方案留在下面:

     @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
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-13
      • 1970-01-01
      • 2022-10-22
      • 2017-12-06
      • 2018-02-10
      • 2018-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多