This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
//... | |
} | |
//class B inherits class A | |
class B extends A { | |
//... | |
} | |
//class C inherits B, which in turn, inherits A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class A { | |
//... | |
} | |
//The following class is illegal | |
class B extends A { // ERROR! Can't subclass A | |
//... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void finalize() { | |
//finalization code here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
final void meth() { | |
System.out.println("This is a final method"); | |
} | |
} | |
class B extends A { | |
void meth() { // ERROR! Can't override. | |
System.out.println("Illegal!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = getIntent(); | |
currentPetUri = intent.getData(); | |
if (currentPetUri == null) { | |
setTitle("Add a new pet"); | |
} else { | |
setTitle("Update pet data"); | |
// Initialize a loader to read the pet data from the database | |
// and display the current values in the editor | |
getLoaderManager().initLoader(EXISTING_PET_LOADER, null, this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FloatingActionButton fab = findViewById(R.id.fab); | |
fab.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
Intent intent = new Intent(CatalogActivity.this, EditorActivity.class); | |
startActivity(intent); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ListView petListView = findViewById(R.id.list); | |
petListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |
@Override | |
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { | |
Intent intent = new Intent(CatalogActivity.this, EditorActivity.class); | |
Uri currentPetUri = ContentUris.withAppendedId("content://com.example.android.myapplication/pets", id); | |
intent.setData(currentPetUri); | |
startActivity(intent); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ContentUris.withAppendedId("content://com.example.android.myapplication/pets", id); |