Objective
Let me take a look at how Iván Carballo and his team used espresso, Mockito and Dagger 2 to write 250 UI tests, and it took only three minutes to run successfully.
In this article, we'll explore how to use Mockito (translator Note: Mockito is a unit test framework written in Java), Dagger 2 to create fast and reliable Android UI tests. This article is worth reading if you are starting to write U
This article illustrates the implementation principle of Android antivirus. Share to everyone for your reference, specific as follows:
An antivirus soft armor is the most core part of a virus is an anti-virus engine, virus library from the server, antivirus engine is actually to determine whether the program's package
Release date:Updated on:
Affected Systems:AVG AntiVirus for AndroidDescription:--------------------------------------------------------------------------------Bugtraq id: 57129CVE (CAN) ID: CVE-2012-6335AVG AntiVirus for Android is an anti-virus and anti-backdoor program used on smartphones.The Anti-theft service of AVG Anti
If you're deciding whether a thread is the main line in Android? For this question, you might say that according to the thread's name, of course this solves the problem, but is it the most reliable? In case one day, Google will be the thread of the name of the other god horse things.
Method revealed
The following approach is the most reliable solution.
Reliable Image Compression for android
First, let's take a look at the quality compression method:
Private Bitmap compressImage (Bitmap image ){
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
Image. compress (Bitmap. CompressFormat. JPEG, 100, baos); // quality compression method. Here, 100 indicates no compression. Store the compressed data in baos.
Int options = 100;
While (baos. toByteArray
=Newopts.outwidth; inth =Newopts.outheight; //now the mainstream phone is more 800*480 resolution, so the height and width we set to floatHH = 800f;//set height to 800f here floatWW = 480f;//This sets the width to 480f//scaling ratio. Because it is a fixed scale, only one of the data with high or wide is calculated intbe =1;//be=1 indicates no scaling if(W > H w > WW) {//If the width is large, scale according to the fixed width sizebe = (int) (Newopts.outwidth/ww);
Android: a reliable method for obtaining the mac address of a device
/*** Get the mac address of the device ** @ param ac * @ param callback * this method is called back after the mac address is obtained successfully */public static void getMacAddress (final Activity ac, final SimpleCallback callback) {final WifiManager wm = (WifiManager) ac. getSystemService (Service. WIFI_SERVICE); // If WIFI is enabled a
It is well known that in the development of Android, we often use Wifimanager to get MAC address to do device mapping, but there will be such problems, such as open WiFi access to address, do not open WiFi access address, just boot not get address, The NIC does not start to get the address. In summary the most reliable method or directly with BusyBox read the system file MAC address is more secure. publics
/** * Gets the MAC address of the device * * @param AC * @param callback * After successfully acquiring the MAC address, this method is recalled */public static void Getmacaddress (final Activity AC, Final Simplecallback callback) {final Wifimanager wm = (Wifimanager) AC. Getsystemservice (Service.wifi_servi (CE)//If WiFi is turned on after the boot, the MAC information can be obtained directly. return data immediately. Wifiinfo info = wm.getconnectioninfo (); if (info! = null info.getmacaddres
= Bitmapfactory.decodestream (ISBM, null, newopts);
Newopts.injustdecodebounds = false;
int w = newopts.outwidth;
int h = newopts.outheight;
//Now the mainstream phone is more 800*480 resolution, so the height and width we set to
float hh = 800f; //Set height to 800f here
float ww = 480f; //Set width to 480f here
//Zoom ratio. Because it is a fixed scale, only one of the data with high or wide is calculated
int be = 1; Be=1 indicates no scaling
If (W > H w > ww) {//I
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.