Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to store a bitmap as a texture from android

Hello guys,

I was trying to achieve the following -

Open the android gallery and save the image picked as a texture for the project.

I am a learner with C++, well programming in general, but I am able to achieve opening the gallery in android through content provider. Now, what I want is to save that image in unreal as a texture. I cannot achieve that, here is the android part of the code that I added.

  public void AndroidThunkJava_OpenGallery()
     Intent galleryIntent = new Intent(Intent.ACTION_PICK,  android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
     startActivityForResult(galleryIntent, RESULT_LOAD_IMG);

And the onActivityResult part -

     try { 
                 // When an Image is picked
                 if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data) {
                     // Get the Image from data
                     Uri selectedImage = data.getData();
                     String[] filePathColumn = { MediaStore.Images.Media.DATA };
                     // Get the cursor
                     Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
                     // Move to first row
                     int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                     imgDecodableString = cursor.getString(columnIndex);
                     Bitmap bitmap=BitmapFactory.decodeStream(getContentResolver().openInputStream(selectedImage));
                 } else {
                     Toast.makeText(this, "You haven't picked Image",
             } catch (Exception e) {
                 Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG)

This is how I'm calling from C++ (Generic call like in AndroidJNI), I'm sure here is where I am supposed to store it in a UTexture2D type variable but I don't know how

 FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, FJavaWrapper::AndroidThunkJava_OpenGallery);

And then implementing this so that I can use it in blueprints. So, can someone help me ?

Product Version: UE 4.14
more ▼

asked Nov 20 '16 at 10:11 AM in C++ Programming

avatar image

650 13 13 28

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Have you tried to use images in power of two format?

more ▼

answered Feb 15 '17 at 06:42 PM

avatar image

382 21 15 23

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question