photo

Letter avatar like Gmail Android best practice

亡梦爱人 提交于 2020-05-22 02:06:30
问题 What is the best way of generating (in code) a letter avatar like in Gmail? Here you have an example https://drive.google.com/folderview?id=0B0Fhz5fDg1njSmpUakhhZllEWHM&usp=sharing It should look like that: 回答1: This is what I've used once.. please try and modify according to your requirements. public class LetterAvatar extends ColorDrawable { Paint paint = new Paint(); Rect bounds = new Rect(); String pLetters; private float ONE_DP = 0.0f; private Resources pResources; private int pPadding;

Delete photo thumbnail in Gallery after manually delete the photo file

我只是一个虾纸丫 提交于 2020-04-13 17:38:19
问题 case R.id.menu_delete: File photoToDelete = new File(photoPath, photoList[gPosition]); photoToDelete.delete(); checkPhotoFolder(); galleryAdapter.notifyDataSetChanged(); Log.d("position", "" + gPosition); return true; I'm manually delete a photo file using above code. But in the system gallery the photo still show the blank thumbnail. The question is how can I delete the photo file and also the thumbnail of it in the gallery? 回答1: Try invoke the MediaScanner to refresh the gallery // Tell the

Android Camera Photo Thumbnail Orientation

南笙酒味 提交于 2020-02-24 19:41:21
问题 We have been using a bunch of code that uses the camera with the desired end result, but I want to get to the bottom of this with clean code. I'm simply following the Android docs here verbatim, and getting a rotated thumbnail. Below is the code, please find the working project in this branch of my Bitbucket repository. private void dispatchTakePictureIntent() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) !

Android Camera Photo Thumbnail Orientation

折月煮酒 提交于 2020-02-24 19:41:14
问题 We have been using a bunch of code that uses the camera with the desired end result, but I want to get to the bottom of this with clean code. I'm simply following the Android docs here verbatim, and getting a rotated thumbnail. Below is the code, please find the working project in this branch of my Bitbucket repository. private void dispatchTakePictureIntent() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) !

Android Camera Photo Thumbnail Orientation

旧巷老猫 提交于 2020-02-24 19:41:06
问题 We have been using a bunch of code that uses the camera with the desired end result, but I want to get to the bottom of this with clean code. I'm simply following the Android docs here verbatim, and getting a rotated thumbnail. Below is the code, please find the working project in this branch of my Bitbucket repository. private void dispatchTakePictureIntent() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) !

How to upload a user profile image [closed]

夙愿已清 提交于 2020-01-25 06:49:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 days ago . I am trying to upload a profile image to the user profile but the profile image doesn't appear on the profile page there are no errors popping up so how do I restructure this code to fix this issue? if let ProfileImageUrl = dictionary?["photo"] as? String { let url = URL(string: ProfileImageUrl) URLSession.shared

Create a file from a photo URI on Android

帅比萌擦擦* 提交于 2020-01-23 17:17:26
问题 I have an Android app that needs to let the user select some pictures from the gallery and send these pictures to the backend (together with some other data). To allow the user to select the pictures I have the following in my Fragment: private void pickImages() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); startActivityForResult(intent, PICK_PHOTO_FOR_AVATAR); } I get the result of the selected photos

Issues taking picture with Android (Vertical Camera | Portrait)

ⅰ亾dé卋堺 提交于 2020-01-21 05:17:55
问题 With the following code shows a preview of the camera vertically and it's works.. BUT!! I get a photo in landscape! :( How I can build it vertically? I've the preview view in vertical, but I can't save the picture vertically. greetings and thanks, Fran ONCLICK public void onClick(View arg0) { camera.takePicture(myShutterCallback, myPictureCallback_RAW, myPictureCallback_JPG); } PREVIEW @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if

Issues taking picture with Android (Vertical Camera | Portrait)

自古美人都是妖i 提交于 2020-01-21 05:17:26
问题 With the following code shows a preview of the camera vertically and it's works.. BUT!! I get a photo in landscape! :( How I can build it vertically? I've the preview view in vertical, but I can't save the picture vertically. greetings and thanks, Fran ONCLICK public void onClick(View arg0) { camera.takePicture(myShutterCallback, myPictureCallback_RAW, myPictureCallback_JPG); } PREVIEW @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if

Add Contact photo in android

不打扰是莪最后的温柔 提交于 2020-01-15 04:29:47
问题 I want to add a contact in the android contacts list.I am able to pass the contact no,name and other detail successfully.I am facing problem with the profile pic.How to pass a profile pic for the contact ? 回答1: You have to use ContactsContract.CommonDataKinds.Photo in your traditional insert or using ContentProviderOperation and also provide the photo (as a byte array for example). Just refer to the official doc for some examples. Basically the code with using ContentValues will look