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
public class MyDatabaseOpenHelper extends SQLiteOpenHelper { | |
private Context context; | |
public MyDatabaseOpenHelper(Context context) { | |
super(context, DB_NAME, null, DB_VERSION); | |
this.context = context; | |
} | |
} |
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
public abstract class SQLiteOpenHelper { | |
//[...] | |
private SQLiteDatabase mDatabase; | |
//[...] | |
public void setWriteAheadLoggingEnabled(boolean enabled) { | |
//[...] | |
if (mDatabase != null && mDatabase.isOpen() && !mDatabase.isReadOnly()) { | |
if (enabled) { | |
mDatabase.enableWriteAheadLogging(); |
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
public class TestFragment extends Fragment { | |
// Dépendance de TestFragment envers String | |
private String textViewContent; | |
// Injection de dépendance avec une méthode setter | |
public void setTextViewContent(String textViewContent){ | |
this.textViewContent = textViewContent; | |
} | |
@Override |
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
sudo apt-get update | |
sudo apt-get -y upgrade | |
sudo apt-get -y install build-essential |
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
sudo apt-get update | |
sudo apt-get -y upgrade | |
sudo apt-get -y install build-essential |
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
sudo mkdir -p /usr/local/built-tools | |
sudo mkdir -p /usr/local/src | |
sudo mkdir -p /usr/local/var/log | |
sudo chown -R $LOGNAME:staff /usr/local |
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
dependencies { | |
// ... Other dependencies of your project | |
/****************** Local tests ******************/ | |
// JUnit 4 framework | |
testCompile 'junit:junit:4.12' | |
} |
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
public class ArrayUtilsUnitTest { | |
@Test | |
public void remove_in_array() throws Exception { | |
int[] testArray = new int[]{1, 2, 3}; | |
int[] resultArray = ArrayUtils.removeIndex(testArray, 1); | |
Assert.assertArrayEquals("Test int[] ArrayUtils.removeIndex(int[], int)", new int[]{1, 3}, resultArray); | |
} | |
} |
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
public class ArrayUtilsUnitTest { | |
@Test | |
public void remove_in_array() throws Exception { | |
int[] testArray = new int[]{1, 2, 3}; | |
int[] resultArray = ArrayUtils.removeIndex(testArray, 2); | |
Assert.assertArrayEquals("Test int[] ArrayUtils.removeIndex(int[], int)", new int[]{1, 2}, resultArray); | |
} | |
} |
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
public class ArrayUtils { | |
/** | |
* Removes the specified index to the specified array of integer and returns the result | |
* @param array the array on which to remove the specified index | |
* @param index the index to remove from the specified array | |
* @return the result of the deletion | |
*/ | |
public static int[] removeIndex(int[] array, int index){ | |
int[] result = new int[array.length - 1]; | |
for(int i=0; i<array.length; i++){ |
OlderNewer