<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
public class ChronoActivity2 extends AppCompatActivity { | |
@Overrideprotected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
// The ViewModelStore provides a new ViewModel or one previously created. | |
ChronometerViewModel chronometerViewModel | |
= ViewModelProviders.of(this).get(ChronometerViewModel.class); |
/** | |
* A ViewModel used for the {@link ChronoActivity2}. | |
*/ | |
public class ChronometerViewModel extends ViewModel { | |
@Nullable private Long mStartTime; | |
@Nullable | |
public Long getStartTime() { | |
return mStartTime; |
public class LocationActivity extends AppCompatActivity { | |
... | |
private void bindLocationListener() { | |
//You can safely pass (this) as it expose only the type not the view | |
BoundLocationManager.bindLocationListenerIn(this, mGpsListener, getApplicationContext()); |
public class BoundLocationManager { | |
public static void bindLocationListenerIn(LifecycleOwner lifecycleOwner, LocationListener listener, Context context) { | |
new BoundLocationListener(lifecycleOwner, listener, context); | |
} | |
@SuppressWarnings("MissingPermission") | |
static class BoundLocationListener implements LifecycleObserver { | |
... | |
public BoundLocationListener(LifecycleOwner lifecycleOwner, LocationListener listener, Context context) { |
public class MainActivity extends AppCompatActivity { | |
@Override protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
//how to create your object using builder pattern | |
Ship ship = new Ship.Builder().setName("Avenger") | |
.howManyCrew(12) | |
.howManyGuns(10) |
public class Ship { | |
private String name; | |
private String area; | |
private int guns; | |
private int crew; | |
private String radarType; | |
//normal getters | |
public String getName() { |
public class Singleton { | |
//instance holder | |
private static Singleton mInstance = null; | |
private String mString; | |
//prevent others from instantiating the class with new keyword | |
private Singleton(){ | |
mString = "Hello"; | |
} |