Situation Description:Today in the writing of data display, using the ListView, in its adapter, found that the number of times the GetView method execution is the data item n times (my side of the display is 4 times times, this times the value does not know will change), this is obviously unscientific!Check the data and find the layout problem of the ListView. I set the android:layout_height= "wrap_content" Height to wrap_content. While the Wrap_content value makes the ListView not take the actu
bad things go ahead ...} catch (FileNotFoundException e) {TODO auto-generated Catch blockE.printstacktrace ();}Break}}Super.onactivityresult (Requestcode, ResultCode, data);}Don't be happy, it's too early, and the key question:The above code as long as you can use Google, generally can find to piece together. However, just like this, you will also get an unknown error ... Samsung's system camera, layout is flat, if your activity happens to be vertical version, then get this callback URI, it is
#endifFourth step: Writing C codeNote that the C code must be written in the same way as the previous header file, which differs from the normal C function.1#include"HelloJNI.h"2#include 3 4JniexportvoidJnicall Java_hellojni_printhello (JNIENV *env, Jobject obj) {5printf"Hello world!\n");6 return;7 }8 9JniexportvoidJnicall java_hellojni_printstring (jnienv * env, jobject obj, jstringstring) {Ten Const Char*str = (*env)->getstringutfchars (env,string,0); Oneprintf"%s!\n", str); A ret
, right-click, select Build Path, and then select Configure Build Pathxxxxx. On the right side of the popup dialog box, select the Order and Export tab. Tick the KSOAP2 jar package you just added, then select OK)As follows:Once the package is successfully imported, you can start writing code (EH, go directly to the code.) Detailed comments on the code):Layout file Main.xml:XML version= "1.0" encoding= "Utf-8"?>LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/
Sometimes, we take a picture or record a video, the library app does not recognize these newly generated files by default so open the library or video player found that the files are not found, you need to call Mediascanner scan to come out. A class was found from ffmpeg to scan media files. Public classFfmpegmediascannernotifierImplementsmediascannerconnectionclient {Privatemediascannerconnection mconnection; PrivateString MPath; PrivateFfmpegmediascannernotifier (context context, String path)
Today, I used Huawei 8600 to run the project. I suddenly saw that oncreate was executed twice!How can we tolerate the existence of such a strange thing!
Of course, at the beginning, I found that the project was not going in. After printing, I found that ondestory was automatically called,That is, the project is automatically exited once oncreate-> onresume-> onpause-> onstop-> ondestory is executed.
I don't want to worry about the trouble. Then I removed ondestory, and I found that although the
Android calls call. The SMS function can be called directly or indirectly. You can set the intent attribute to achieve this:
Direct call without user confirmation:
// Call intent = new intent (intent. action_call, Uri. parse ("Tel: 10086"); startactivity (intent );
// SMS string smscontent = "ye"; // Note: SMS must be divided before being sent smsmanager SMS = smsmanager. getdefault (); List
The caller
The following methods are all tested successfully:
1. Use commands to simulate
(1) simulate incoming calls
1. Open command line CMD and enter Telnet and press Enter.2. Enter o localhost 5554Press enter to connect to emulator.3. Enter GSM call 13656563636. If OK is displayed, the call is successful (the phone number can be specified at will)
(2) simulate text messages
1. Open command line CMD and enter Telnet and press Enter.2. Enter o localhost 5554 a
In the project to have a software scoring function, a very common, very simple function, but it cost me a lot of effort. The effects you need to achieve are as follows:Would have thought that the general software will have "to score", "pro, to a favorable comment" such a function, but search on the internet did not search, asked three groups plus 5 children's shoes, analysis log, anti-compilation look at the source, finally found the URI, get him really not easy ah.[Java]View Plaincopy
If there are no new requirements for the system, direct calls are the most direct. The following describes how to call a system camera to take pictures and save images and call a system album. First, let's take a look at the core method of calling the System camera: Intent camera = new Intent (MediaStore. ACTION_IMAGE_CAPTURE); startActivityForResult (camera, 100); the data returned by the camera is obtained through the following callback method, and
... return;}
Create a Java object from C + +
Here's how:1. Creating a homogeneous object from a native method of the Java layerSteps:I. Getting classes from objectsIi. getting the ID of a class's constructor through a classIii. creating a new object based on the method ID and classvoid Jnicall Java_nativemethod *env, jobject thiz,jint i) { ... = (*env). Getobjectclass (thiz); = (*env). Getmethodid (Clazz,"","() V"); = (*env). NewObject (clazz,mid); ...
//invoking the system default browser//Reference:// http://www.cnblogs.com/zhwl/archive/2011/11/15/2249848.html // 1190000003912694 CaseR.id.tv_about_weibo://about Weibo//Open directly//Intent intent= New Intent ();//intent.setaction ("Android.intent.action.VIEW");//Uri Weibo_url = Uri.parse (Tvaboutweibo.gettext (). toString ());//Intent.setdata (weibo_url);//startactivity (Intent); //pop up a box to select a browser, select the browser and then enterIntent intent=NewIn
In the project, the last one to contact us, the request is to click the number and email address can send mail, this time to solve the solution there are two, one is to call the system to send mail software, you can add a mailbox account can send mail, the second is to use JavaMail to send mail. In the online various Baidu, also has the test, the discovery all can not send the mail, also modifies such as QQ or 163 mailbox of what management password, opened the POP3,, SMAP service, can not recei
Try {classAndroid system-level API contains a lot of classes, of course, these underlying classes will be the public API link, but sometimes you may need to break through the limitations of the system to do something, then this time the reflection is a sharp weapon.This does not reflect the meaning of the reflection, give the above examples, mainly to illustrate. In the system, we can get the actual examples of the classes that exist.The private property (non-final) and private methods in the ca
In one of the previous articles, we introduced a simple camera opening function, as described in. Android Simple call camera function, to realize the open camera function, this time will be taken in front of the photo display into the ImageView, forming a complete effect to see the example Mainactivity.javaPackage Com.example.camera;import Java.io.file;import Android.app.activity;import android.content.intent;import Android.graphics.bitmap;import Andr
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.