title: Accessing methods or classes from another java file/class from Activity
body: <p>I am new to android studio but I am getting better at it as I program more and more. I have a MainActivity.java and the .xml file. And a friend provided me some code that it suppose to work with the input areas. The problem is I do not know how to access that regular java file. So that I can use it the way it is intended. He was using eclipse to build everything while I use android studio. I have the buttons all good to go and areas of input good to go but I just dont know how to implement his code. Any guidance will be greatly appreciated.</p>
  <p>See examples to understand what I am trying to do.</p>
  <p>&quot;In android studio&quot; a class is created called WaterDetails.java with a .xml file called activity_water_details.xml. There are calculations that were  made for the duration that I need to be able to use or access from a java file created in eclipse called DurationCalculations.java. I have tried importing. I have tried opening the folder in explorer and putting the class in the same project. But, nothing seems to work.</p>
  <p>Code:</p>
  <pre><code>public class WaterDetails extends AppCompatActivity {
  
      Button continueWaterDetailsPart2;
      EditText duration;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_water_details);
  
  
          duration = (EditText)findViewById(R.id.enter_duration);
  
          duration.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  String user = duration.getText().toString();
                  if(duration.equals(&quot; &quot;))// if user inputs information
                  //Then get calculations from other java file.
  
              }
          });
  </code></pre>
  <p>Sample Code:</p>
  <p><strong>Second Java fie. The file I need to access.</strong></p>
  <pre><code>package ScubanauiTables;
  
  import java.util.Arrays;
  
  public class DurationCalculations {
      private int duration;
  
  //Constructor
  
  DurationCalculations(int duration, int maxDepth, int avgDepth, int temp, int visibility, int pressureStart,
                  int pressureEnd, String[] diveConditions, String[] diveActivities) {
          setDuration(duration);
          setMaxDepth(maxDepth);
          setAvgDepth(avgDepth);
          setTemp(temp);
          setVisibility(visibility);
          setPressureStart(pressureStart);
          setPressureEnd(pressureEnd);
          setAirType(21);
          setDiveConditions(diveConditions);
          setDiveActivities(diveActivities);
          setPressureGroup();
  
      public int getDuration() {
          int temp = duration;
          return temp;
      }
      
      private void setDuration(int duration) {
          this.duration = duration;
      }
  </code></pre>
  <p>I hope this sample code makes sense. Thank you all for your help in advance.</p>