We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Error on view in tab

Dear Synfusion,

I'm using Carousel to show my image which is taken by camera.
I got this error when view the carrousel object.

Java.Lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference

I attach pic for my layout to view the carrousel and class fo my carrousel.
Where I can set the height / width to view the carrousel ?

Thanks

best Regards,
Afin

Attachment: carrousel_fce5553d.rar

9 Replies

HM Hemalatha Marikumar Syncfusion Team July 4, 2016 08:43 AM UTC

Hi Afin,

Thanks for contacting Syncfusion Support.

On checking your code provided, it is found that the images are assigned to SfCarouselItem's ImageName API from custom Directories. Currently in Carousel, it is required to include the images in the Project drawable folder and need to assign the image name to the SfCarouselItem's ImageName property.


path: ../Resource/Drawable

We are glad to let you know that in our latest Volume 2 2016 release we have provided support for having Custom View in which we can have Images from any custom source and it can be assigned to SfCarouselItem's ContentView property API.

Please upgrade to our latest Syncfusion version to have this feature and below is the download link for upgrading the Syncfusion version.

https://www.syncfusion.com/forums/124709/essential-studio-2016-volume-2-release-v14-2-0-26-is-available-for-download

Regards,
Hemalatha M.R


ZA Zainal Arifin July 11, 2016 04:08 AM UTC

Dear Hemalatha,

Thanks for your support, I've changed the library and I didn't find any error again, but the carrousel didn't show up as well.
I need to figure it out.

THanks

best Regards,
Afin


ZA Zainal Arifin July 11, 2016 05:52 AM UTC

Dear Hemalatha,

Is there any restriction for filename ? My path to view the image in carrousel is like below.

"/storage/emulated/0/Pictures/2131230793a8f5466d-cf27-e611-80c1-0a0027000000/IMGAFFOGATO_1.jpg"

My carrouse still don't show up even my item collection has saved well.

Best Regards,
Afin


HM Hemalatha Marikumar Syncfusion Team July 12, 2016 11:29 AM UTC

Hi Afin,

Thanks for your update.

In SfCarousel control, SfCarouselItem.ImageName can be used only if the images are provided in the Project Resources folder. In order to achieve your requirement by placing the images in device location or from any url please make use of SfCarousel's Template support. We have created a sample for using Template support in SfCarousel control.Please download the same from the following link

Link: ExampleProject

Please check the sample and if the issue still persists, update us the modified sample or the replication procedure to analyze further and provide the solution.

Regards,
Hemalatha M.R  



ZA Zainal Arifin July 13, 2016 02:58 AM UTC

Hi Hemalatha,

Thanks for your brief example. My application would like to load the carrousel inside the frame layout.
In your example, I confuse how to attach it into my frame layout.

Please advise

Thanks

Best Regards,
Afin


ZA Zainal Arifin July 13, 2016 03:35 AM UTC

Dear Hemalatha,

I tried to modify the list into like below.

list.Add(new MyPage("/storage/emulated/0/Pictures/2131230793/a8f5466dcf27e61180c10a0027000000/IMGAFFOGATO_000011.jpg"));
            list.Add(new MyPage("/storage/emulated/0/Pictures/2131230793/a8f5466dcf27e61180c10a0027000000/IMGAFFOGATO_000012.jpg"));
            list.Add(new MyPage("/storage/emulated/0/Pictures/2131230793/a8f5466dcf27e61180c10a0027000000/IMGAFFOGATO_000013.jpg"));

The result was I got the message error "Unfortunately, Example Project has stopped".

Please advise

Thanks

Best Regards,
Afin


HM Hemalatha Marikumar Syncfusion Team July 13, 2016 12:37 PM UTC

Hi Afin,

We were unable to reproduce the reported issue at our end. We have placed an image in the below sdcard location for testing purpose and provided the location to the Image's Source property and we got the image loaded to the Carousel control. Please refer the following code example and screenshot

Image Location : /sdcard/Downloads/image1.jpg

Code Example
  
public List<MyPage> GetDataSource()
{
List<MyPage> list = new List<MyPage>();

list.Add(new MyPage("/sdcard/Downloads/image1.jpg"));
list.Add(new MyPage("/sdcard/Downloads/image1.jpg"));
list.Add(new MyPage("/sdcard/Downloads/image1.jpg"));
return list;


Please update the replication procedure or video to analyze further regarding the reported behavior.

Regards,
Hemalatha M.R
 



ZA Zainal Arifin July 14, 2016 02:25 AM UTC

Dear Hemalatha,

Please find screenshot in my attachment.
I test it directly to my android smartphone.

Thanks

Best Regards,
Afin

Attachment: afin_carrousel_994af697.rar


HM Hemalatha Marikumar Syncfusion Team July 14, 2016 08:33 AM UTC

Hi Afin,

Thanks for your update.

Still we were unable to reproduce the reported issue at our side. We have created a new incident for this reported issue under your account.Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents/


Regards,
Hemalatha M.R 


Loader.
Up arrow icon