Skip to content

Instantly share code, notes, and snippets.

👽
keep calm and work hard

Abdullah Alhazmy alhazmy13

👽
keep calm and work hard
Block or report user

Report or block alhazmy13

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alhazmy13
alhazmy13 / RealmMigratio
Last active Mar 15, 2016
RealmMigration must be provided
View RealmMigratio
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);
}
-------------------------------------------------------------------------------
View OpenPDF file - Android
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
{
@alhazmy13
alhazmy13 / Android.gitignore
Created Feb 21, 2016
.gitignore for Android
View Android.gitignore
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
You can’t perform that action at this time.