Invalid characters & Image Files

jaminben

Member
Licensed User
Longtime User
Hi,

A couple of questions.

I'm using a List to populate a ScrollView via a mySQL server... I connect just fine and return the requested results in JSON and using the JSONParser I get the info I need.

1. One of my results throws an java.lang.NullPointerException when used with lbl_MediaTagline.Text = m.Get("tagline")... the result should be "We’re lonely, so, let’s be lonely together." I've determined that the "We're" or "let's" is causing the issue.

Any ideas on how to fix this? I don't see this issue when running in a Visual Studio program.

2. I asked this question in another thread but moved it here as I'm now using a ScrollView as my main view rather than a ListView...

What would be the best method to populate an image file for each item in the ScrollView where the image location is taken from the mySQL server? For example the address for the image would look something like:

\\mysqlserveris\shared\Fanart\Cowboys Aliens\Poster\smalltXEHvxU315Yu7bEaMMRcpDpW6RI.jpg

I'm a bedroom hobbyist coder so please be gentle with me and any ideas/solutions would be greatly appriciated :)

Many Thanks

Ben
 
Last edited:

poseidon

Member
Licensed User
Longtime User
re

2
use
B4X:
dim imgBMP As Bitmap
   imgBMP = LoadBitmapSample(File.DirAssets,"questionmark.jpg",50dip,50dip)

   Dim img As ImageView 
   img.Initialize("imgPRD")
   'add imageview to panel
   Pane.AddView(img, 5dip,0dip,imgDimensionPRD,imgDimensionPRD)
   'set picture to imageview 
   img.Bitmap = imgBMP

more about LoadBitmapSample
Basic4android - Core
 
Upvote 0

jaminben

Member
Licensed User
Longtime User
Thanks for the reply poseidon :)

For some reason I keep getting a java.io.FileNotFoundException on line:
imgBMP = LoadBitmapSample(File.DirAssets,"my_image_location.jpg",50dip,50dip)

I've tried various images from different sites including my own... any ideas?

Thanks

Ben

Edit:

Is it because the images are not stored on the device? They are all located on a remote machine.

Edit 2:

Ok, I think I need to be using HttpUtils to achieve what I want... I need to do some reading.
 
Last edited:
Upvote 0

poseidon

Member
Licensed User
Longtime User
re

B4X:
LoadBitmapSample(File.DirAssets,"my_image_location .jpg",50dip,50dip)

File.DirAssets = path
my_image_location .jpg" = is the filename exists in the path

read at more about LoadBitmapSample on my prev reply.
 
Upvote 0

jaminben

Member
Licensed User
Longtime User
File.DirAssets = path
my_image_location .jpg" = is the filename exists in the path

Sorry but I've got to ask :sign0104:

I've read more, read some more... searched some more and then read some more.. used the internal documentation... read some more but I just don't see how you assign the path to File.DirAssets. Everytime I try it returns a path not found using:

B4X:
If File.Exists(imagesFolder, "") = False Then
ToastMessageShow("Images folder not found: " & CRLF & imagesFolder, True)
Return
End If

If I wanted to grab an image from http://94.21.34.89/Fanart/Priest/Poster/example.jpg what would I need to do?

Thanks
 
Upvote 0
Top