Skip to main content

Posts

Linear Layout with border

Save this xml with name border.xml and add as a background for the linear layout....  <shape xmlns:android=" http://schemas.android.com/apk/res/android ">     <stroke android:width="4dp" android:color="#FF00FF00" />     <solid android:color="#ffffff" />     <padding android:left="7dp" android:top="7dp"             android:right="7dp" android:bottom="7dp" />     <corners android:radius="4dp" /> </shape>

Playing wav File in android using Audio Track

To play a wav file read the wav file and pass the bytes to audio track chunck by chunk. private void playWaveFile(){                 // define the buffer size for audio track         int minBufferSize = AudioTrack.getMinBufferSize(8000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT);         int bufferSize = 512;         AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, 8000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, minBufferSize, AudioTrack.MODE_STREAM);         String filepath = "File Path";         int count = 0;         byte[] data = new byte[bufferSize];         try {             FileInputStream fileInp...

How to Uninstall the ANDROID App through Java Code...

We can uninstall an installed application on your  Android device. Steps- 1. Create an intent object with an action ACTION_DELETE. 2. Give the data as the package name.  and , // Code to uninstall the app Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:com.package.Appname")); startActivity(intent);

Retrive Platform information for android device programatically

There are some useful methods to retrieve the platform related information of the device programmatic ally   Method to get the manufacturer of the device      /**      * Get the Manufacturer of the Device      * @return String      */     public String getManufacurer(){         return android.os.Build.MANUFACTURER;     }    Method to get the device model     /**      *  Get the Model of the Device      * @return String      */     public String getModel(){         return android.os.Build.MODEL;     }   Method  to get the OS build number      /**      * Get the Build Number of the OS   ...