Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok first some things. The images you see in gallery are stored in phone memory or in a SDCard. The images you store in the assets folders inside your app (resources folder in eclipse) are for internal app use, when the apk is build you can't put nothing in there. What you want is associate some image with your app when it is running so there is some ways to do that you just need to pick the fits you. </p> <p>First you need to open the Image Gallery from your app by Intent, something like this: </p> <pre><code>//Constant to compare result private static int RESULT_LOAD_IMAGE = 1; //Intent that call the gallery Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); //Start another activity that returns a result to yours startActivityForResult(i, RESULT_LOAD_IMAGE); //Override the callback to get the result for the activity @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //If everythig ok and a image is selected if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { //Get the image path Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); //Show the image in your ImageView ImageView imageView = (ImageView) findViewById(R.id.imgView); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } } </code></pre> <p>Ok now that you have your image you want to decide what to do with it and that's the "upload in my apk" I think you want. The image you have now is in memory phone or SDCard and now you have the path to that image. If you want to duplicate it and store it in your you app you can copy the image to your app private folder, change the image name and store the new path the way you want (sqlite, sharedPrefs, change the name to some logic you can get the image name, etc.) and now the image is "uploaded" to your app. To get the app private folder use <code>Context.getFilesDir()</code>. But again you have the image file already, just do what you want with it. And be careful with permissions. The other ways are web services to store images in a server, sqlite to store the image in a database. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload