Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android will save the picture to see the album and timely     - Introduces Linux kernel compilation system and compiler installation (Linux)

- Ubuntu 14.04 compile and install Apache (Server)

- Ubuntu 14.04 LTS to compile the source code Android4.4.2 (Linux)

- CentOS 7.0 Enable iptables firewall (Linux)

- ORA-12545: Connection failed because the target host or object does not exist (Database)

- Django1.5 Custom User Model (Programming)

- Questions about Linux compiler u-boot (Programming)

- C ++ casts New Standard Comments (Programming)

- Eight kinds of techniques to solve hard problems Linux (Linux)

- You need to know 12 Git High Command (Linux)

- Practical top command (Linux)

- Linux crontab command format example (Linux)

- To disable the function by pressing Ctrl-Alt-Del to restart the system in RHEL / CentOS 5/6 (Linux)

- Kibana use installation (Linux)

- How to install OpenOffice Ubuntu or Linux Mint (Linux)

- sudoers file parsing (Linux)

- The Linux-based security settings Ipchains Firewall (Linux)

- Database Blob data type conversion String (Programming)

- Linux host system monitoring implement the cgi (Server)

- Red Hat Linux mount U disk (Linux)

 
         
  Android will save the picture to see the album and timely
     
  Add Date : 2018-11-21      
         
         
         
  Android will save the image to the SD card, the album will not be there to this picture, because there is no update its index, generally you need to boot several times. Of course, we can manually update its index.

1, first save the file to the SD card.

String filePath = "xxx"; // full path

saveImgToSDcard (filePath);

2, increasing the Android internal media index.

public boolean saveImgToGallery (String filePath) {

boolean sdCardExist = Environment.getExternalStorageState (). equals (

android.os.Environment.MEDIA_MOUNTED); // determine whether there sd card

if (! sdCardExist)

return false;

try {

ContentValues ​​values ​​= new ContentValues ​​();

values.put ( "datetaken", new Date () toString ().);

values.put ( "mime_type", "image / jpg");

values.put ( "_ data", filePath);

Application app = DoctorApplication.getInstance ();

ContentResolver cr = app.getContentResolver ();

cr.insert (MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

} Catch (Exception e) {

e.printStackTrace ();

}

return true;

}

3, the refresh filePath upper level directory

MediaScannerConnection.scanFile (MyLanJingCode.this, new String [] {Environment.getExternalStoragePublicDirectory (Environment.DIRECTORY_DCIM) .getPath () + "/" + filePath.getParentFile () getAbsolutePath ().}, Null, null);

This will increase in time to see the pictures in the album.
     
         
         
         
  More:      
 
- Top 10: HTML5, JavaScript 3D game engine and framework (Linux)
- Hadoop 2.2.0 installation development environment (standalone pseudo-distributed mode) (Server)
- Learning MySQL data types (Database)
- Oracle 10g after the failure to start the upgrade (Oracle instance terminated. Disconnection forced) (Database)
- Git remote repository Explanation (Linux)
- Linux yum command Detailed (Linux)
- Ubuntu install VMware Workstation 11 tutorials at 14.04 / 14.10 (Linux)
- Ten linux version of the system (Linux)
- Oracle 11g 10g induced into error (Database)
- OpenGL Programming Guide (8th edition of the original book) - compute shader (Programming)
- Java String type time compare the size (Programming)
- MySQL related statements (CRUD) (SQLyog software) (Database)
- How to make GRub instead of the default Ubuntu software center (Linux)
- Linux Log File Browser --logrotate (Linux)
- BusyBox build root file system (Linux)
- Custom Android UI template Comments (Programming)
- C ++ sequence containers basics summary (Programming)
- How to view information about the installed version of CentOS (Linux)
- Construction CA certificate using OpenSSL command line (Server)
- Growth since Oracle set the table space (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.