Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #3891 - move ID to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
zugaldia committed Feb 19, 2016
1 parent fa25c54 commit f2c7374
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public interface OfflineRegionDeleteCallback {
* OfflineManager.createOfflineRegion() instead.
*/

public OfflineRegion() {}
public OfflineRegion(long id) {
mId = id;
}

/*
* Getters
Expand Down
6 changes: 3 additions & 3 deletions platform/android/src/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1735,8 +1735,8 @@ void JNICALL createOfflineRegion(JNIEnv *env, jobject obj, jlong defaultFileSour
env->CallVoidMethod(createCallback, createOnErrorMethodId, std_string_to_jstring(env, message));
} else if (region) {
mbgl::Log::Debug(mbgl::Event::JNI, "Region created.");
jobject jRegion = env->NewObject(offlineRegionClass, offlineRegionConstructorId);
env->SetLongField(jRegion, offlineRegionIdId, region->getID());
jobject jRegion = env->NewObject(offlineRegionClass, offlineRegionConstructorId, region->getID());
// env->SetLongField(jRegion, offlineRegionIdId, region->getID());

// This currently causes an exception on Android
env->CallVoidMethod(createCallback, createOnCreateMethodId, jRegion);
Expand Down Expand Up @@ -2170,7 +2170,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
return JNI_ERR;
}

offlineRegionConstructorId = env->GetMethodID(offlineRegionClass, "<init>", "()V");
offlineRegionConstructorId = env->GetMethodID(offlineRegionClass, "<init>", "(J)V");
if (offlineRegionConstructorId == nullptr) {
env->ExceptionDescribe();
return JNI_ERR;
Expand Down

0 comments on commit f2c7374

Please sign in to comment.