Today I learned how to embed a video into an application using the Videoview class, as shown in the following code.1 Public classTestvideoextendsactionbaractivity {2 3 @Override4 protected voidonCreate (Bundle savedinstancestate) {5 Super. OnCreate (savedinstancestate);6 Setcontentview (r.layout.activity_test_video);7 8Videoview video =(Videoview) Findviewbyid (r.id.video);9Video.setvideouri (Uri.parse ("android.resource://com.example.gboy.testvideo/" +r.raw.video));Ten //An
. Net programmers play Android development-ListView Click Event
As we all know, ListView is used to display the data list. Each list consists of list items. If we click to select a list, what should I do if I want to get the details in the list or open a new window to pass the list information? This section demonstrates the click event of ListView. Through this section, we will have a deeper understanding o
We all know that the ListView is used to display a list of data, each list has a list of items, if we click to select a list, want to get the details of the list or open a new window to pass the list information in the past what to do? In this section we demonstrate the ListView click event, which we will have a deeper understanding of the ListView, first look atHere's a look at the demo codeMain layout fileList item Layout fileBackground codepublic class Listviewclickactivity extends Activity {
Android Play onLowMemory () and onTrimMemory ()
Today, I checked the LitePal framework source code of Guo GE. I just opened the LitePalApplication source code and saw this scene.
@Overridepublic void onLowMemory() {super.onLowMemory();mContext = getApplicationContext();}
I don't know much about Guo ge. I vaguely remember someone talking about onLowMemory () and onTrimMemory (). So I checked the source code
all the controls in the frame layout framelayout are in the upper left side of the interface, and after the drawing space overrides the previous control, the frame layout is more likely to be used in game development. . NET programmer play to Android development---(10) frame layout framelayout
caveats:1, Textureview is the Android 4.0 after the addition of the lower version of this class. Textureview must work in an environment where hardware acceleration is enabled, in the settings of the activity in the configuration file: Android:hardwareaccelerated= "True" is the default property, so no more writing is required. But if you write false, you can see Onsurfacetextureavailable () This callback will not come in, Textureview no surfacetextur
1.TP driver Tpd_down () and tpd_up () function do not need to escalate the ID number, the upper layer will automatically match;The 2.TPD_UP () function only needs to escalate Btn_touch and mt_sync information, other information is not escalated, as follows:static void tpd_up (int x, int y,int *count){Input_report_key (Tpd->dev, Btn_touch, 0);PRINTK ("u[%4d%4d%4d]", x, y, 0);Input_mt_sync (Tpd->dev);Tpd_em_print (x, y, x, y, 0, 0);if (Factory_boot = = Get_boot_mode () | | Recovery_boot = = Get_bo
publicvoidintint status) { alert ("" + SampleID); } });Finally, the code for the complete class, the sample code can be downloaded on my github: Https://github.com/vir56k/demo/tree/master/SoundPoolDemo PackageDemo.vir56k.soundpooldemo;ImportAndroid.media.AudioManager;ImportAndroid.media.SoundPool;Importandroid.support.v7.app.AppCompatActivity;ImportAndroid.os.Bundle;ImportAndroid.util.Log;ImportAndroid.view.View;ImportJava.util.HashMap; Public class
void OnPause () { cocos2dxrenderer.setispause (true); Super . OnPause (); Cocos2dxhelper.onpause (); This . Mglsurfaceview.onpause (); }5. Add a line of code in the Volatiletexture::reloadalltextures () method of CCTextureCache.cpp to resume the paused statevoid volatiletexture::reloadalltextures () { true; Cclog ("reload all texture"); ... ... // Intermediate content omitted here false ; // last row pause set to False Ccdirector::shareddirec
. Net programmers play Android Development --- (10) frame layout FrameLayout and androidframelayoutAll the controls in the frame layout FrameLayout are on the top left of the interface. The space drawn after the frame layout overwrites the previous controls. The controls in the layout are displayed in layers, which may be used in game development.1. Stacked display in the following example, three textviews
Android plays video with its own Videoview control
Activity
The public class Activity01 extends activity {/** called the ' when ' is the ' The activity ' is the ' the '---' @Override
public void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);
Setcontentview (R.layout.main);
Final Videoview Videoview = (videoview) Findviewbyid (R.ID.VIDEOVIEW01);
Button Pausebutton =
Java code will not be pasted, only the xml file will be mounted,
Method:
1. Put three images in drawable, which are the images that obtain the focus, press the focus, lose the focus, and press the focus, and the natural state (that is, the focus is lost, and the focus is not pressed ). Here you prepare three photos.
2. Create an imagebutton. xml file in the drawable folder. The content in the file is:
Android: state_focused = "true"
Java code will not be pasted, only the XML file will be mounted,
Method:
1. Put three images in drawable, which are the images that obtain the focus, press the focus, lose the focus, and press the focus, and the natural state (that is, the focus is lost, and the focus is not pressed ). Here you prepare three photos.
2. Create an imagebutton. xml file in the drawable folder. The content in the file is:
Android: state_focused = "true"
CRL, and then click the corresponding Java comes with the class name, will open jump to the corresponding source file.But for Android developers, if you want to use the same method to open Android projects in Android, the JDK Java class source code, it seems to jump out of the interface can not connect to the source (at least I do). The reason should be, in the
In the jungle of the forest of the Chinese Internet. Closed plagiarism is the monopoly of the giant's pass. Innovation is the epitaph of small entrepreneurs.
Understanding HooksHave not been exposed to hook technology readers will definitely feel strange about the word hook. Hook English translation is the meaning of "hook", then when we use this "hook"?We know that the system maintains its own set of event distribution mechanisms in the Android
For beatbox applications, you can use Soundpool, a specially customized utility.Soundpool can load a batch of sound resources into memory and support simultaneous playback of multiple audio files. So, even if the user is excited, push the button to play all the audio, do not have to worry about damaging the application or consumption of the phone power.1. Create Soundpool 1 /* 2 * Lollipop introduces a new way to create Soundpool: Use Soundpool.bu
Using MediaPlayer to play audio, you can also play video files, except when playing video with MediaPlayer, the image output interface is not available. You can use the Surfaceview component to display video images. Using MediaPlayer and Surfaceview to play a video can be divided into the following four steps:1) define the Surfaceview component. It is best implem
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.