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
//============================================================== | |
// Binary To String | |
//============================================================== | |
public static String int2str( String s ) { | |
String[] ss = s.split( " " ); | |
StringBuilder sb = new StringBuilder(); | |
for ( int i = 0; i < ss.length; i++ ) { | |
sb.append( Character.toString((char)Long.parseLong( ss[i], 2 ) )); | |
} | |
return sb.toString(); |
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 int getNextID() { | |
return mRealm.allObjects(YOUR_CLASS).size() > 0 ? realm.where(YOUR_CLASS).max("id").intValue() + 1 : 0; | |
} |
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
If you don't have any problem in loosing your old data then you can delete Realm Configuration and create new one. | |
------------------------------------------------------------------------------- | |
Realm realm = null; | |
try { | |
realm = Realm.getInstance(MainActivity.this); | |
} catch (RealmMigrationNeededException r) { | |
Realm.deleteRealmFile(MainActivity.this); | |
realm = Realm.getInstance(MainActivity.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
1. create assets folder in src under your app name. | |
2. In this assets folder keep your pdf files e.g. file.pdf. | |
3 now come your activity i.e MainActivity.java | |
4. setListener on any UI component what you want i.e (Button,ImageView,ImageButton); | |
5. In this listener call one user defined method i.e. openPDFFiles("file.pdf"); | |
the openPDFFiles() method have below code:—- | |
private void openPDFFiles(String fileName) //fileName is the pdf file name which is keep in assets folder. ex file.pdf | |
{ |
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
# Built application files | |
*.apk | |
*.ap_ | |
# Files for the Dalvik VM | |
*.dex | |
# Java class files | |
*.class |
NewerOlder