error while uploading a file containing bitmap -- android

hello … I am new to backendless … I am trying to upload a file that contain a bitmap
when I open the gallery and get the photo and convert it to bitmap … I want to upload it to backendless server …
using that code below :

Backendless.Files.Android.upload(bitmap, Bitmap.CompressFormat.PNG, 100, "userphoto.png", "UserPhoto", new AsyncCallback<BackendlessFile>() {
 @Override
 public void handleResponse(BackendlessFile userphoto) {

while bitmap is :

bitmap = BitmapFactory.decodeResource(getResources(),
 R.drawable.icon2);

when I upload it I get A long error :

BackendlessFault{ code: 'IllegalArgumentException', message: 'Attempt to invoke virtual method 'java.lang.String com.backendless.AuthKeys.getVersion()' on a null object reference' }

What is the problem ?
and thanks

already solved it … but I have a question …

after I uploaded the file how I can get it and convert it to a bitmap ?
I set a Property to users and it is the URL of the file … I want to get the file from the URL … how can I do that? and after I get it I want to convert it to bitmap
and thanks

Hello!
As an example I can offer you to use code generation for file-service. BrowseActivity.java implements getting image by its url.
Also, you can take a look at our blog: https://backendless.com/category/file-service/
best regards,
Alex

Take a look at the documentation: http://backendless.com/documentation/files/rest/files_file_download.htm

Thanks you Mr.Mark …but that didn’t helped me … there are no code example in the documentation for file downloding :confused:

I have another problem… When user sign up in my app… He must select photo from the gallery and use it as a profile photo…

In Parse I can do that by saving a file containing the photo in property for user…

But I haven’t found a property for saving files in it in the users…

There is only string, int, URL and like that… How can I save file in property?

Thanks (sorry for the many questions… but I am new to backendless )

We provide a URL for your uploaed file/bitmap. So all you need to do is google something like this:

download file from url java
download file from url C#
download file from url ios

When you upload a file the API returns its URL in the response. All you need to do is save the URL as a property of the user object.

@yaseralosh… I’m having the same problem. Could you tell me how can i rectify it?