There are two ways to implement a photo in Android, one is to call the system's own camera and then use the photo data it returns. Another one is to use the camera class and other related classes to achieve the camera function, this method of the system is relatively high, dyeing is also more complex, the general common application just use the first one can.
start the camera code with intent:
Copy Code code as follows:
Intent Intent
global reference for later use. and Jmethodid/jfieldid and Jobject have no inheritance relationship, it is not a jobject, just an integer, so there is no problem of being released or not, can be saved directly after use. Static Jobject Gs_object=null; Jniexport void Jnicall Java_test_setenev (jnienv *env, Jobject obj) {NBSP;NBSP;NBSP;NBSP;ENV-GT;GETJAVAVM (gs _JVM); Saving to a global variable jvm//the direct assignment of obj to a global variable is not possible, the following function should
Android calls are implemented in two ways:The first method, call the phone to jump to the dial-up interface. The source code is as follows:New= Uri.parse ("Tel:" + "135xxxxxxxx"); intent.setdata (data); StartActivity (intent) ;View CodeThe second method, the call directly to dial, but some third-party ROM (for example: MIUI), not directly dial, but to the user to choose whether to dial, the source code is a
Pushvalue Pushvalue; Public void Setpushvaluecallback (Pushvalue pushvaluecallback) { this. pushvalue = pushvaluecallback;} First declare the interface in the establishment of a set method, the role of the external will be instantiated interface, and then directly at the source of the data generated in the interface method can be calledPushvalue.push ((byte) (Crc160xff), (byte) ((0xff00 CRC16) >> 8);After using a class that uses the Setpushvaluecallback method, the external instance
Android calls the camera to take pictures and get the original photo solution as follows:Note to have permission to read the file, you need to add the following permissions:button click event: Public voidClick (View view) {Intent Intent=NewIntent (mediastore.action_image_capture);//the intention of the camera to capture the pictureIntent.putextra (Mediastore.extra_output, Imagefileuri);//specifies that the
Android phone has its own camera and library, we do the project sometimes used to upload images to the server, today did a project to use this feature, so put my code down and share with you, the first blog hope that the great God many criticisms.First call the Android album and the camera Code:The code is as follows:Intent Intent = new Intent (mediastore.action_image_capture);//Call the camera that comes w
final conversion to Bitmap this parameter. The location of the anomaly in the source code, grandma, labor tangle for a long time.The great God F2, as long as a tune above that piece of code jumped off. Since this is not the way to go, I see the file has a way to directly convert the URI, so the final code is:public void Onactivityresult (int requestcode, int resultcode, Intent data, Myuri URI) {if (ResultCode! = activity. RESULT_OK) {return; } if (Requestcode = = pick_request) {if (da
Android calls the system method to obtain application information, such as the cache size.
1. android has a way to get the application cache, but it is a little troublesome to use. However, our applications sometimes need to let users know the size of the cache, so that users can promptly clean up the cache.
Run the Code directly. The demo is created using
The Android program calls googlemap on the local machine, transmits the start and end positions, and generates a Roadmap
Copy codeThe Code is as follows: if (wodeweizhiPoint! = Null ){
If (wodeweizhiPoint. getLatitudeE6 ()! = 0 ){
Float chufajingdu = (float) (wodeweizhiPoint. getLongitudeE6 ()/1E6 );
Float chufaweidu = (float) (wodeweizhiPoint. getLatitudeE6 ()/1E6 );
Float daodajingdu = (float) (AppConstan
First, create a project
Inserttel
Create a com. Android. Internal. telephony package
Copy itelephony. aidl from the system source code.
As follows:
Itelephony. aidl
/*
Then create a package
ZY. Phone
The following is a reflection call.
Phoneutils. Java
Package ZY. phone;
Then listen for the phone number with a broadcastreceiver
Maliciously answer users' calls
TP. Java
Package ZY. phone;
In this way,
Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/46993859Here, we briefly introduce the method of intercepting the outgoing calls through Broadcastreceiver.1. Create phonereceiver inherit from BroadcastreceiverThis class is a subclass of Broadcastreceiver, the specific interception operation implemented in this class, I am here just a simple introduction to the method, the acquisition of the external dial number to print
In the version of Android studio2.3.3, the JNI function calls the C + + object, the object calls the related member function,LLDB Debug, Variable Tracking window, this pointer and related variables display invalid reason, but these parameters are actually valid, just debug LLDB Debug environment error.The reason is that the emulator chooses the x86 architecture a
reverse telecommuting with their own set of UI set up will not be a short time, the fastest and most fast one day. The company added an hour or less than 50 dollars4. Amateurs in the fun--------------------------------------------------------------------------------------------------------------- ----------Labor gains do not like to spray: Get ""The object is as followsLogin screen background with HTML5 special effects automatically switch (shutters, curtains and other switching modes)Code gene
Telephonymanager is a service class that manages mobile phone call status and telephone network information, which provides a large number of getxxx () methods to obtain information about the telephone network. the details of Telephonymanager can be referenced: Android development to get SIM card information for mobile phoneProgram Run Result:
Log_phone file:Application Examples:
Package Com.jph.monitorphone;import Java.io.filenotfoundexce
The Code calls the Android Application to uninstallIn Android applications, a few are offered to uninstall their own applications, that is, some of the most uninstall applications. I personally think that, from the product perspective, it is not necessary to provide an uninstallation.The following describes how to uninstall the SDK from a technical perspective.Th
Android multimedia calls the camera and selects an image from the local albumOverview:
The function of this routine is to take photos, automatically compress images, and select images from the local album.Permission to be loaded:
Demo:
Public class MainActivity extends Activity implements View. onClickListener {private Button mButtonTakePhoto; private Button mButtonGetPhoto; private ImageView mImageViewP
Android multimedia calls the camera and selects an image from the local album,Overview:
The function of this routine is to take photos, automatically compress images, and select images from the local album.Permission to be loaded:
Demo:
Public class MainActivity extends Activity implements View. onClickListener {private Button mButtonTakePhoto; private Button mButtonGetPhoto; private ImageView mImageViewPho
create a new picture, save to the specified location----------------------------------------------------------------------------Finally, one more question I have recently encountered, the problem is described as follows:After calling the camera, press the home button to exit the program, open the camera on the phone to take a few photos, exit the camera to re-enter the program, click the Photo Confirmation button, jump to the cutting interface when the interface is black, no photo display.After
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.