I am brand new to Java and need to use one of the following class definitions in my project.
import androidx.fragment.app.Fragment; public class ScannerFragment extends Fragment implements myclass { ... ... ... }
Or:
public class MainActivity extends AppCompatActivity implements myclass { ... ... ... }
However, I cannot seem to understand how to implement the androidx.fragment.app.Fragment
as I dont have any gradle.properties file. I am using Pyjnius that allows me to use Java in my Python project.
So my question is: Is there a way to avoid using Fragment
or AppCompatActivity
in my code and implement the class myclass
in another way? I dont understand the extend
and implements
method.
Advertisement
Answer
Extends means you want to derive a subclass from an existing class. Implements means you will implement an interface.