title: Note: MainActivity uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details
body: <blockquote>
  <p><strong>My Goal:</strong> To fix this error and be able to run my app without an error.</p>
  </blockquote>
  <blockquote>
  <p><strong>Error Message:</strong> Note:
  D:\Learning\app\src\main\java\com\example\learning\MainActivity.java
  uses or overrides a deprecated API. Note: Recompile with
  -Xlint:deprecation for details.</p>
  </blockquote>
  <p>I get the following error in 'Build Output'. I tried to fix this problem, but every try was unsuccessful. I found some questions related to this error on Stackoverflow, but it didn't meet my needs, so I decided to ask my own question in hope if someone can help me with this error.</p>
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  static final int REQUEST_IMAGE_CAPTURE = 1;
  String currentPhotoPath;
  Button sendBtn;
  EditText nameText;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      nameText = (EditText)findViewById(R.id.editText);
      sendBtn = (Button)findViewById(R.id.button2);
  
  }
  
  public void dispatchTakePictureIntent(){
      Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  
      try {
          startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
      }catch (ActivityNotFoundException e){
          //dispaly error
      }
  }
  
  private File createImageFile() throws IOException{
      //Create an image file name
      String timeStamp = new SimpleDateFormat(&quot;yyyyMMdd_HHmmss&quot;).format(new Date());
      String imageFileName = &quot; JPEG_&quot; + timeStamp + &quot;_&quot;;
      File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
      File image = File.createTempFile(
              imageFileName, /* prefix */
              &quot;.jpg&quot;,   /* suffix */
              storageDir     /* directory */
      );
  
      // Save a file: path for use with ACTION_VIEW intents
      currentPhotoPath = image.getAbsolutePath();
      return image;
  }
  
  public void onClick(View view){
  
      dispatchTakePictureIntent();
  
  }
  
  
  public void onClick2(View view) {
  
      SqlAdapter sqlAdapter = new SqlAdapter();
  
      try {
          Connection con = sqlAdapter.connectionclass();
          String query = &quot;INSERT INTO dbo.Test(text) VALUES ('&quot; + nameText.getText().toString() + &quot;') &quot;;
          Statement stmt = con.createStatement();
          stmt.executeUpdate(query);
      }
      catch (SQLException sqlException){
          Log.e(&quot;ERROR&quot;, sqlException.getMessage());
      }
  
  }
  }
  </code></pre>
  <p>Thanks in advance!</p>