For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void executeMultipartPost(String url, String imgPath, String field1, String field2){ | |
| try { | |
| HttpClient client = new DefaultHttpClient(); | |
| HttpPost poster = new HttpPost(url); | |
| File image = new File(imgPath); //get the actual file from the device | |
| MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); | |
| entity.addPart("field1", new StringBody(field1)); | |
| entity.addPart("field2", new StringBody(field2)); | |
| entity.addPart("image", new FileBody(image)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // formatting numbers | |
| // => "1.2" | |
| String.format("%s", new DecimalFormat("#.##").format(1.2)) | |
| // => "1.20" | |
| String.format("%.2f", 1.2) |