Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Android will save the picture to see the album and timely     - Linux find command to find files (Linux)

- Android View event delivery (Programming)

- How to network to share files between Windows, MAC and Linux (Linux)

- Two classic macro definition under Linux (Linux)

- to compile FFmpeg In Ubuntu (Linux)

- Use Ganglia to monitor your cluster (Server)

- Scala REPL Shell call (Programming)

- Ubuntu Control Panel to resolve network-manager icon display issue (Linux)

- Compare Oracle MySQL (ICP) index condition pushdown is described (Database)

- Linux C source code (sockettype: socket descriptor determination function) (Programming)

- JBPM6 Tutorial - Fast Fun JBPM table (Linux)

- Linux Firewall Builder shorewall (Linux)

- Locale files under Ubuntu (Linux)

- Configuring a Linux operating system security management services Explain (Linux)

- OpenStack Folsom create an instance of the failure of the Quota Fixed_IP articles (Server)

- To setup CentOS LAMP environment (Server)

- Android design patterns - state mode (Programming)

- Build Golang development environment configuration on Ubuntu 14.04 (Linux)

- Usage Linux device tree (Programming)

- How to Install Apache on Linux servers (Server)

 
         
  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:      
 
- MongoDB simple replication configuration (Database)
- Can not empty the Recycle Bin to repair problems in Ubuntu 14.04 (Linux)
- Smooth upgrade to OpenSSH 6.1 Procedure (Linux)
- Installation and Configuration Tomcat environment CentOS 6.6 (Server)
- Talk about Java in the collection (Programming)
- Fun music library in Linux using command line (Linux)
- Linux Tutorial ---- fundamentals of data traffic redirection (Linux)
- Debian SSD ext4 4K aligned (Linux)
- Nginx + uWSGI + Django + Python Application Architecture Deployment (Server)
- Use nice, cpulimit and cgroups limit cpu usage (Linux)
- A summary of Java multi-threaded programming - acquaintance multithreading (Programming)
- Cooling solutions Ubuntu system (Linux)
- Summary Linux bond of multi-interface load balancing (Linux)
- OpenGL ES 3.0 vertex buffer (Programming)
- Oracle and MySQL difference between the jdbc (Database)
- Installation and Configuration rsync server under CentOS 6.3 (Server)
- Rails project prepared some tips small experience (Linux)
- Linux Network Programming --TCP and UDP datagram type Explanation (Programming)
- RHEL / CentOS / Fedora Install Nagios 4.0.1 (Linux)
- Linux command to view the system status (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.