title: java.lang.InstantiationException: java.lang.Class cannot be instantiated at java.lang.Class.newInstance(Native Method)
body: <p>I am trying to add a custom dialog with a rating bar and a few more widgets to my small project but stuck on this error. kind of a beginner so I'll be glad if u can make it simple for me, thanks </p>
  
  <p>I've tried to change the class to an abstract java class. </p>
  
  <pre><code>  package com.a.shon.scoutszone2;
  
      import android.app.Activity;
      import android.app.Dialog;
      import android.content.Intent;
      import android.graphics.drawable.Drawable;
      import android.os.Bundle;
      import android.view.Menu;
      import android.view.MenuInflater;
      import android.view.MenuItem;
      import android.view.View;
      import android.widget.Button;
      import android.widget.EditText;
      import android.widget.ImageView;
      import android.widget.RatingBar;
      import android.widget.TextView;
      import android.widget.Toast;
  
      public  class ZoneActivity extends Activity implements View.OnClickListener  {
  
      Button btnPeula;
      ImageView ivMap;
      ImageView ivZone; //Will Change in the future
      //ListView lstZone;
      Zone current = new Zone();
      private Drawable[] maps;
      @Override
      protected void onCreate(Bundle savedInstanceState) { //add a dialog/menu to logout and manager activities
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_zone);
  
          btnPeula = findViewById(R.id.btnPeula);
          ivMap = findViewById(R.id.ivMap);
          maps = new Drawable[4];
          maps[0] = getResources().getDrawable(R.drawable.map, null);
          ivMap.setImageDrawable(maps[0]);
          ivZone=findViewById(R.id.ivZone);//Will Change in the future
          maps[1] = getResources().getDrawable(R.drawable.tzone, null);//Will Change in the future
          ivZone.setImageDrawable(maps[1]); //Will Change in the future
  
          //lstZone = findViewById(R.id.lstZone);
          //lstZone.setOnItemClickListener(this);
          // lstZone.setAdapter( new ArrayAdapter&lt;Zone&gt;(this, android.R.layout))
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          super.onCreateOptionsMenu(menu);
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.the_menu,menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(final MenuItem item)
      {
          super.onOptionsItemSelected(item);
          switch (item.getItemId())
          {
              case R.id.itemManager:
                  Toast.makeText(this, "Manager...", Toast.LENGTH_SHORT).show();
                  Intent manager = new Intent(this, manager.class);
                  startActivity(manager);
                  break;
              case R.id.itemLogout:
                  Toast.makeText(this, "Logging out...", Toast.LENGTH_SHORT).show();
                  finish();
                  break;
              case R.id.itemRating: //make it a dialog not an activity!
                  Toast.makeText(this, "Start Rating!", Toast.LENGTH_SHORT).show();
                  showCustomDialog();
                  break;
          }
          return true;
      }
  
      public void onPeula(View v)
      {
          Intent peula = new Intent(this, PeulotActivity.class);
          startActivity(peula);
      }
  
      private void showCustomDialog()
      {
          final Dialog dialog = new Dialog(this);
          dialog.setContentView(R.layout.custom_dialog);
          // set the custom dialog components - text, image and button
          final RatingBar mRatingbar = (RatingBar) findViewById(R.id.mRatingbar);
          final TextView tvRatingscale = (TextView) findViewById(R.id.tvRatingScale);
          final EditText etFeedback = (EditText) findViewById(R.id.etFeedback);
          Button btnSubmit = (Button) findViewById(R.id.btnSubmit);
          mRatingbar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
              @Override
              public void onRatingChanged(RatingBar ratingBar, float v, boolean b) {
                  tvRatingscale.setText(String.valueOf(v));
                  switch ((int) ratingBar.getRating()) {
                      case 1:
                          tvRatingscale.setText("Very bad");
                          break;
                      case 2:
                          tvRatingscale.setText("Need some improvement");
                          break;
                      case 3:
                          tvRatingscale.setText("Good");
                          break;
                      case 4:
                          tvRatingscale.setText("Great");
                          break;
                      case 5:
                          tvRatingscale.setText("Awesome. I love it");
                          break;
                      default:
                          tvRatingscale.setText("");
                  }
              }
          });
          btnSubmit.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  // if (etFeedback.getText().toString().isEmpty()) {
                  //     Toast.makeText(ZoneActivity.this, "Please fill in feedback text box", Toast.LENGTH_LONG).show();
                  // } else {
                  etFeedback.setText("");
                  mRatingbar.setRating(0);
                  //Toast.makeText(ZoneActivity.this, "Thank you for sharing your feedback", Toast.LENGTH_SHORT).show();
              }
              // }
          });
  
          dialog.show();
      }
  
  
      @Override
      public void onClick(View v)
      {
          Toast.makeText(this, "Click", Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>I expect that when the dialog will be opened the application won't crash, but actually every time the button of opening the dialog is clicked, the app crashes<br>
  java.lang.InstantiationException: java.lang.Class cannot be instantiated at java.lang.Class.newInstance(Native Method)</p>