//Dynamically change the sprite image…… //my_sprite is a CCSprite already initialized with spriteWithFile. [[CCTextureCache sharedTextureCache] removeTexture:[self.my_sprite texture]; CCTexture2D *tex = [[CCTextureCache sharedTextureCache] addImage:@”new_image.jpg”]; [my_sprite setTexture:tex];
The CCRibbon class, together with touch input, can be used to create the line-drawing effects of popular games. Note: you can’t remove individual points from a CCRibbon. You can only remove the whole CCRibbon by removing it as child from its parent.
CCBitmapFontAtlas faster than CCLabel. Labels that update fast at the expense of more memory usage, like any other CCSprite,is the specialty of the CCBitmapFontAtlas class //Usage… CCBitmapFontAtlas scoreLabel = [CCBitmapFontAtlas bitmapFontAtlasWithString:@”0″ fntFile:@”bitmapfont.fnt”];
You can create endlessly looping animations this way. This code lets a node rotate forever like an endlessly spinning wheel:
This code will set your ringtone for ANDROID. To set a ringtone you have to add it to the database. otherwise it will not be set also gives no error also. Insert it into the database
This code snippet captures audio from a given source and saves it to a file with android.media.MediaRecorder.
The WifiManager can be used to enable and disable wifi. Where ‘enabled’ is a boolean.
First, just show an image inside a toast: This method just displays a text toast: And this method displays a Toast that contains both an image and text:
Get all the available network connections One important thing is that don’t forget to add the following lines in the manifest file
Gets the phone number the app is running on. It needs a permission so add the line uses-permission android:name=”android.permission.READ_PHONE_STATE” to the manifest.xml
This snippet starts an Application automatically after the android-os booted up. in AndroidManifest.xml (application-part):
Converting a bitmap to drawable is really easy in ANDORID. It has a class called BitmapDrawable which takes a bitmap as the parameter and convert it into a drawable object.
Playing a video file is simple in android. This post will help you. Put your video in res/raw folder. If no raw folder present then create a new folder inside res. The main. xml file. Please leave your comments if this post was useful.
The following code helps you to do a drag and drop in ANDROID.
By using the below code snippet you can uninstall an installed application on your ANDROID phone. Create an intent object with an action and data as the package name and start with the ACTION_DELETE.
This sample code helps you to load html from a string and from a file into webview in ANDROID.