To do this in Android Studio go to Preferences > Editor > Code Style
and set Right margin (columns)
to 150
(or the line width you want)
List<Pair<Integer, Integer>> indices = new ArrayList<>(); | |
// indeices will be list containing a Pair | |
// Pair first and second will be indecies of the numbers whose some will be "b" | |
int[] a = {1, 3, 4, 5, 2}; // your list | |
int b = 5; // number you want to compare | |
for (int i = 0; i < a.length; i++) { | |
for (int j = i + 1; j < a.length; j++) { | |
if (b == a[i] + a[j]) { | |
indices.add(Pair.create(i, j)); |
/** | |
* Get reference to the connectivity manager | |
*/ | |
ConnectivityManager connectivityManager = | |
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
/** | |
* Find out whether device is connected to wifi or cellular at the moment | |
*/ | |
public NetworkType getNetworkType() { |
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
/** | |
* Validate user email and password | |
* Email and password EditText fields are wrapped inside TextInputLayout | |
* | |
* @return true if email and password are valid, otherwise false | |
*/ | |
private boolean isCredentialsValid() { | |
String emailAddress = edtEmail.getText().toString().trim(); | |
String password = edtPassword.getText().toString(); | |
if (TextUtils.isEmpty(emailAddress) |
Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.
In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.
Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<solid android:color="@null" /> | |
<stroke | |
android:width="1dp" | |
android:color="@color/colorPrimary" /> | |
<padding | |
android:bottom="1dp" | |
android:left="1dp" | |
android:right="1dp" | |
android:top="1dp" /> |
implementation 'com.google.code.gson:gson:2.8.2' | |
implementation 'com.squareup.retrofit2:retrofit:2.4.0' | |
implementation 'com.squareup.okhttp3:okhttp:3.10.0' | |
implementation 'com.squareup.retrofit2:converter-gson:2.1.0' |