title: Use of AsyncTask in AndroidStudio
body: <p>I want to write a Fibonacci application using AsyncTask in Android Studio. Although there is no error in my app, when I run it it says: "MyApplication has stopped!". Can anyone point out my mistakes?
  I have included the java code here.
  Thanks in advance.</p>
  
  <pre><code>package com.example.asus.myapplication;
  
  public class fibonacci
          extends AppCompatActivity
          implements View.OnClickListener {
  
      private Button SolveButton;
      private EditText Number;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_fibonacci);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
  
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
          Number = (EditText) findViewById(R.id.editText);
          Number.setOnClickListener(this);
          SolveButton = (Button) findViewById(R.id.button);
          SolveButton.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View view) {
          switch(view.getId()) {
              case R.id.button: {
                  double i =
                          Double.parseDouble(Number.getText().toString());
                  new fibonacci_thread().execute(i);
                  break;
              }
          }
      }
  
  
      public class fibonacci_thread
              extends AsyncTask&lt;Double, Void,
              Double&gt; {
          double s1 = 0;
          double s2 = 1;
          double s3 = 0;
  
          @Override
          protected Double doInBackground(Double... params) {
  
              for(double k = 3; k &lt;= params[0]; k++) {
                  s3 = s1 + s2;
                  s1 = s2;
                  s2 = s3;
              }
  
              return s2;
          }
  
          @Override
          public void onPostExecute(Double result) {
              EditText textView = (EditText) findViewById(R.id.editText2);
              String yourDoubleString = String.valueOf("Result: " +
                                                               result);
              textView.setText(yourDoubleString);
          }
  
          @Override
          protected void onPreExecute() {
          }
  
          @Override
          protected void onProgressUpdate(Void... values) {
          }
      }
  }
  </code></pre>
  
  <p>and here is my Event Log during installation of the app on a "Custom Phone - 7.1.0 - API 25 - 768x1280", using Genymotion:
  12:14 AM    Genymotion: Device [Custom Phone - 7.1.0 - API 25 - 768x1280]: started</p>
  
  <p>12:15 AM    Executing tasks: [:app:assembleDebug]</p>
  
  <p>12:15 AM    Gradle build finished in 6s 61ms</p>
  
  <p>12:15 AM    Instant Run performed a full build and install since
                  the installation on the device does not match the local build on disk.
                  (Don't show again)</p>
  
  <p>12:15 AM    Can't bind to local 8623 for debugger</p>