I am trying to use Nativescript-Carousel plugin to show multiple Google Places. However whenever i set the dataset for Carousel control, i get below exception
System.err: java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 0, found: 20 Pager id: 9 Pager class: class android.support.v4.view.ViewPager Problematic adapter: class com.tns.gen.android.support.v4.view.PagerAdapter_index_222_28_CarouselPagerAdapterClassInner
System.err: at android.support.v4.view.ViewPager.populate(ViewPager.java:1135)
System.err: at android.support.v4.view.ViewPager.populate(ViewPager.java:1084)
System.err: at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
System.err: at android.view.View.measure(View.java:19857)
System.err: at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
System.err: at org.nativescript.widgets.MeasureHelper.measureChildFixedColumnsAndRows(GridLayout.java:1055)
System.err: at org.nativescript.widgets.MeasureHelper.measure(GridLayout.java:865)
System.err: at org.nativescript.widgets.GridLayout.onMeasure(GridLayout.java:279)
System.err: at android.view.View.measure(View.java:19857)
System.err: at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
System.err: at org.nativescript.widgets.MeasureHelper.measureChildFixedColumnsAndRows(GridLayout.java:1055)
System.err: at org.nativescript.widgets.MeasureHelper.measure(GridLayout.java:865)
System.err: at org.nativescript.widgets.GridLayout.onMeasure(GridLayout.java:279)
System.err: at android.view.View.measure(View.java:19857)
System.err: at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
System.err: at org.nativescript.widgets.MeasureHelper.measureChildFixedColumnsAndRows(GridLayout.java:1055)
System.err: at org.nativescript.widgets.MeasureHelper.measure(GridLayout.java:865)
System.err: at org.nativescript.widgets.GridLayout.onMeasure(GridLayout.java:279)
System.err: at android.view.View.measure(View.java:19857)
System.err: at org.nativescript.widgets.CommonLayoutParams.measureChild(CommonLayoutParams.java:262)
System.err: at org.nativescript.widgets.ContentLayout.onMeasure(ContentLayout.java:32)
System.err: at android.view.View.measure(View.java:19857)
System.err: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
System.err: at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
System.err: at android.view.View.measure(View.java:19857)
System.err: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
System.err: at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
System.err: at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
System.err: at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
System.err: at android.view.View.measure(View.java:19857)
System.err: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
System.err: at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
System.err: at com.android.internal.policy.DecorView.onMeasure(DecorView.java:689)
System.err: at android.view.View.measure(View.java:19857)
System.err: at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2275)
System.err: at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1366)
System.err: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1619)
System.err: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
System.err: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6337)
System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:686)
System.err: at android.view.Choreographer.doFrame(Choreographer.java:621)
System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
System.err: at android.os.Handler.handleCallback(Handler.java:751)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:154)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6119)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Here is my code
this.gpsLocationService.getGpsLocation()
.then((location) => {
this.latitude = location[0];
this.longitude = location[1];
this.nearesthelpService.getNearByPlaces(this.latitude, this.longitude, 5000, 'pharmacy')
.subscribe((res) => {
this.places = (<any>res).results;
console.dir(this.places)
let placeDetails: PlaceDetails[] = []
this.places.forEach((place) => {
this.nearesthelpService.getNearByPlaceDetails(place.reference).subscribe((details: PlaceDetails) => {
console.log(details.result.name);
placeDetails.push(details);
if (placeDetails.length === this.places.length){
this.placeDetails = placeDetails;
}
})
});
});
});
Also here is my template
<GridLayout row="1" *ngIf="placeDetails.length > 0">
<Carousel #carousel (pageChanged)="onPageChanged($event)">
<ng-template ngFor let-subitem [ngForOf]="placeDetails">
<CarouselItem>
<GridView rows="auto,*">
<Label [text]="placedetail.result?.name"></Label>
</GridView>
</CarouselItem>
</ng-template>
</Carousel>
</GridLayout>
i tried all different ways so that the dataset which is attached to Carousel control is not changed again. As it can be seen above, i also first calculated results in a local object and then attached the same to class variable. However no luck. Any idea why its failing?
Just to add, if i assign the datasource as a static array instead of placedetails, this control does not throw any issue. However when the result is assigned via API result, it does not work.
Just to add, I read on the plugin page that for angular contents can't be changed dynamically. However my requirement is not to change contents once they are received.
Unfortunately there is no answer to this question. Github page mentions that
(Angular) Only static slides work, the dynamic ones with binding do not (for now).
I was assuming that assigning the data for the first time to an empty array would still be a static slide. However it looks like not the case. If you keep your data ready ahead of time, then you may be able to assign it on initialisation itself.
Related
I'm facing an issue related to PDF conversion. When convert any HTML web view initially it will create a PDF file successfully. But when i press back button and came back to convert page and press convert again it will give unknown error.
the stack trace is given below. Since the web pack kind of building app won't show line number where the error is. I couldn't identify the problem.
The web pack always show error in vendor.js whatever the error might be So, please tell me why the error is.
Frame: function:'doClose', file:'file:///data/data/org.nativescript.SuperMarket/files/app/vendor.js', line: 863, column: 22
System.err: Frame: function:'push.../node_modules/nativescript-html2pdf/html2pdf.js.exports.html2PdfFile', file:'file:///data/data/org.nativescript.SuperMarket/files/app/vendor.js', line: 834, column: 9
System.err: Frame: function:'webpackHotUpdate../views/htmlView/htmlView-page.js.exports.print', file:'file:///data/data/org.nativescript.SuperMarket/files/app/bundle.97e2cabb5862869d3b07.hot-update.js', line: 53, column: 25
System.err: Frame: function:'push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/org.nativescript.SuperMarket/files/app/vendor.js', line: 8847, column:
23
System.err: Frame: function:'push.../node_modules/tns-core-modules/data/observable/observable.js.Observable._emit', file:'file:///data/data/org.nativescript.SuperMarket/files/app/vendor.js', line: 8864, column: 18
System.err: Frame: function:'ClickListenerImpl.onClick', file:'file:///data/data/org.nativescript.SuperMarket/files/app/vendor.js', line: 18674, column: 23
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1070)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1050)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1042)
System.err: at com.tns.gen.java.lang.Object_vendor_18667_32_ClickListenerImpl.onClick(Object_vendor_18667_32_ClickListenerImpl.java:18)
System.err: at android.view.View.performClick(View.java:5215)
System.err: at android.view.View$PerformClick.run(View.java:21196)
System.err: at android.os.Handler.handleCallback(Handler.java:742)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:157)
System.err: at android.app.ActivityThread.main(ActivityThread.java:5601)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
System.err: Caused by: ExceptionConverter: java.io.IOException: The document has no pages.
System.err: Caused by: java.io.IOException: The document has no pages.
System.err: at com.itextpdf.text.pdf.PdfPages.writePageTree(PdfPages.java:112)
System.err: at com.itextpdf.text.pdf.PdfWriter.close(PdfWriter.java:1256)
System.err: at com.itextpdf.text.pdf.PdfDocument.close(PdfDocument.java:901)
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1070)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1050)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1042)
System.err: at com.tns.gen.java.lang.Object_vendor_18667_32_ClickListenerImpl.onClick(Object_vendor_18667_32_ClickListenerImpl.java:18)
System.err: at android.view.View.performClick(View.java:5215)
System.err: at android.view.View$PerformClick.run(View.java:21196)
System.err: at android.os.Handler.handleCallback(Handler.java:742)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:157)
System.err: at android.app.ActivityThread.main(ActivityThread.java:5601)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
As the error suggests java.io.IOException: The document has no pages. Looks like after back button press, cache/history is cleared and webview is empty.
You can store the context in appsettings.
I am trying to load a workshop (glTF file) in my scene but all I get is the error message
Uncaught (in promise) TypeError: Cannot read property 'geometry' of undefined at GLTFLoader.js:2572
I tried opening the file in Three.js editor and in glTF Viewer and it worked, I also checked the file with glTF Validator and it said the file was valid but I can't figure out why it doesn't with me. I also tried to open another glTF model found on the Internet with my code and it worked just fine.
new Promise(function(resolve, reject) {
const manager = new THREE.LoadingManager();
const gltfloader = new THREE.GLTFLoader(manager);
gltfloader.setCrossOrigin('anonymous');
gltfloader.setDRACOLoader(new THREE.DRACOLoader());
gltfloader.load("data/gltf/salleTP/salleTP.gltf", function (gltf) {
const content = gltf.scene || gltf.scenes[0];
scene.add(content);
}, undefined, reject);
});
It seems you are using three.js R102 and the respective GLTFLoader version. When loading your glTF asset, a known error in GLTFLoader occurs that was fixed with R103 (see https://github.com/mrdoob/three.js/pull/15881). After upgrading your code base to the latest three.js version, your asset loads fine.
three.js R104
I am new to NativeScript. After I have updated NativeScript to 5.0.0, When I create default project and run using tns run android command, It is giving me following error :
System.err: com.tns.NativeScriptException:
System.err: Calling js method onViewAttachedToWindow failed
System.err: TypeError: this._context.getSupportFragmentManager is not a function
System.err: File: "file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/core/view/view.js, line: 190, column: 46
System.err: StackTrace:
System.err: Frame: function:'View._getRootFragmentManager', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/core/view/view.js', line: 190, column: 47
System.err: Frame: function:'View._getFragmentManager', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/core/view/view.js', line: 215, column: 32
System.err: Frame: function:'Frame._processNextNavigationEntry', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 134, column: 28
System.err: Frame: function:'Frame._onAttachedToWindow', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 118, column: 14
System.err: Frame: function:'AttachListener.onViewAttachedToWindow', file:'file:///data/data/org.nativescript.DemoApp/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 35, column: 27
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:983)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:967)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:959)
System.err: at com.tns.gen.java.lang.Object_frame_29_36_AttachListener.onViewAttachedToWindow(Object_frame_29_36_AttachListener.java:17)
System.err: at android.view.View.dispatchAttachedToWindow(View.java:13554)
System.err: at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2690)
System.err: at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2697)
System.err: at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2697)
System.err: at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2697)
System.err: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1322)
System.err: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1084)
System.err: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5990)
System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:580)
System.err: at android.view.Choreographer.doFrame(Choreographer.java:550)
System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
System.err: at android.os.Handler.handleCallback(Handler.java:739)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:135)
System.err: at android.app.ActivityThread.main(ActivityThread.java:5343)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at java.lang.reflect.Method.invoke(Method.java:372)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
ActivityManager: Process org.nativescript.DemoApp (pid 22172) has died
Please help me with the answer. I am facing this issue since I have updated my NativeScript Version.
Do you have something like
class MainActivity extends android.app.Activity {
I updated the Activity to AppCompatActivity for nativescript version 5
class Activity extends android.support.v7.app.AppCompatActivity {
and the error is gone.
but if you have startActivityForResult, maybe you will get other new errors then.
Most likely you have upgraded just the NativeScript CLI and not the project's dependencies and runtime. Follow the detailed upgrade instruction in this documentation section and make sure that you have migrated your entire project by updating the runtimes ('tns-android' and/or 'tns-ios'), the modules ('tns-core-modules') and all related plugins/dependencies.
I have solved this issue. Actually I was having issue with AndroidStudio. By doing ClearCache in AndroidStudio my problem get solved. It might be space issue that AndroidStudio was occupying in disc so my NativeScript application was not getting enough space.
can anyone please help me out for the following error:
Uncaught TypeError: Cannot read property 'show' of undefined
at line editor.contextMenu.show(editor.document.getBody(), null, x,
y); in plugin.js
Hello everybody i'm trying to load 3D object in the browser using Three.js framework, and i'm getting this error "Uncaught TypeError: Cannot read property 'length' of undefined" this is the error http://s14.postimg.org/ib0coauf5/length_Error.png!, this error occurs when i'm trying to load a complex 3D object (a table for example), but when it's a simple object (a cube for example) no error is shown and my object is loaded successfully.
and this is the code of my JSonloader
var loader = new THREE.JSONLoader();
loader.load( "models/object3d.json", function(geometry){
var material = new THREE.MeshLambertMaterial({color: 0x55B663});
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
});
and this this the export options in blender2.73a http://s13.postimg.org/bfluv5nw7/export.png
any help will be verry appreciated thank you!