Category : uri

I’m uploading images from my app and storing the download URL in a model class but after i see the URL i copied it and paste the link but it didn’t open up the image here is the firebase RealtimeDatabase image here is the firebase Storage and here what it should be https://firebasestorage.googleapis.com/v0/b/myapp-not-final.appspot.com/o/uploads%2F1618234721167.jpg?alt=media&token=fcac1404-87ce-4c7d-ae5f-a1ec7074bf04 Java Files ..

Read more

Drawable icon; try { InputStream inputStream = getContentResolver().openInputStream(user.getPhotoUrl()); icon = new BitmapDrawable(getResources(),inputStream); } catch (Exception e) { icon = getDrawable(R.drawable.avtar1); Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); } Bitmap bitmap = ((BitmapDrawable) icon).getBitmap(); Drawable d = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(bitmap, 100, 100, true)); avatar_ImageButton.setScaleType(ImageView.ScaleType.FIT_XY); avatar_ImageButton.setBackground(d); Source: Android Studio..

Read more

I want to convert a Uri from the .takePicture method to a Bitmap for later use, I searched for different methods but each gaved me an error saying that the bitmap is null and sometimes "int android.graphics.bitmap.getwidth()’ on a null object reference". var imageUri:Uri?=null private fun takePhoto() { val photofile = File(externalMediaDirs.firstOrNull(), "picture – ${System.currentTimeMillis()}.jpg") ..

Read more

My activity gets the Uri of a shared video and saves it to the database: @Override protected void onCreate(Bundle savedInstanceState) { Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); if (Intent.ACTION_SEND.equals(action) && type.startsWith("video")){ Uri uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); Log.i("MyActivity", uri.toString()); // save uri.toString() to database // … } } If the ..

Read more

I found some block of code online,where the main aim of the snippet is to get image URI which is inside the res folder but when i changed the code to my apps path….the app crashes! I know the solution is simple n tricky,so please help me here is the method public static SkyBox getSkyBox1() ..

Read more

I need the user to pick a file to post on the server and for that inside my activity I am opening a file explorer activity like this: val intent = Intent() .setType("*/*") .setAction(Intent.ACTION_GET_CONTENT) startActivityForResult(Intent.createChooser(intent, "Select a file"), 111) For that I am overriding onActivityResult like this: override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) ..

Read more

I have an error in opening the file. I want open .xls file in document manager like Microsoft Office. I think the main problem is wrong generated URI. What do you think? the real path of file: /storage/emulated/0/Download/TeleexHYI/KLMSEnquiry.xls Activity: File PATHX = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); String filename = "KLMSEnquiry.xls" File file = new File(PATHX+"/TeleexHYI", filename); Uri uri2 ..

Read more