There are 3 types of orientation in Rotate only landscape public void AutoOrientToLandScape() { if(Vector3.Dot(Input.acceleration.normalized,new Vector3(1,0,0)) > 0.45) { Screen.orientation=ScreenOrientation.LandscapeRight; } else if(Vector3.Dot(Input.acceleration.normalized,new Vector3(-1,0,0)) > 0.45) { Screen.orientation=ScreenOrientation.LandscapeLeft; } } Rotate only Portrait public...
iPhone Application Lifecycle
I just went through one presentation for iPhone application. So this post to share what I understood. First of all the main focus is how actually iPhone applications work. When user touches the icon of the application main() gets called by the system. main() creates the autoreleasepool and starts the application with UIApplicationMain object. UIApplicationMain creates the instance of the...
How to make scoring system with animated stars
it can be done by using iTween method. The plugin is available in asset store and its free.
In this we can use fadein or fadeout method for blink of stars in the game.
if u use this no need of animation
Play YouTube video using UIWebView on iPhone
Hi, Sometimes it gets very difficult to find a way to do simple things. Playing videos on iPhone is a simple thing, using UIWebView. Just need to embed the URL to HTML tags, and then load the HTML in UIWebView. Here is the code to do so. Pass you URL of YouTube Video in “urlStr”. //In .h file UIWebView *videoView; // In .m file videoView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320...
Using Horizontal Custom ListView in Android
main.xml: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”; android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <TextView android:layout_width=”fill_parent” android:layout_height=”wrap_content” ...
Toast With Image
Button toastwitimage; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); toastwitimage=(Button)findViewById(R.id.twibtn); toastwitimage.setOnClickListener(new OnClickListener() { @Override public...
Send Mail with Image
How to send the image to the mail in android for these you can refer the following code Getting image from Web InputStream is = (InputStream) new URL("Image URL").getContent(); // storing image from stream Drawable drawable = Drawable.createFromStream(is, "srcName"); is.close(); // converting drawable object to Bitmap to store in content providers of Media Bitmap bitmap = ((BitmapDrawable)...
How to check best provider for Google map
private void getLocation() { Location gpslocation = null; Location networkLocation = null; if(locationManager==null){ locationManager = (LocationManager) getApplicationContext() .getSystemService(Context.LOCATION_SERVICE); } try { if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){ locationManager...
Multiple Android Activities in a TabActivity(Single tab can open multiple activity)
The problem that I had was when I started a new activity it covered up the Tabs on my TabActivity. I could put a single Activity into a Tab, but adding a second Activity resulted in losing view of the Tabs. Then I learned about ActivityGroups which have a LocalActivityManager. I realized it was possible to have multiple Activities within an ActivityGroup after all this is what a TabHost does. I...
How to import an image using WWW in unity3d
Try this method i hope i will help full
public Texture2D tDynamicTx;
public WWW tLoad;
public string images;
images =”;;
tLoad= new WWW(images);
tDynamicTx= new Texture2D(64, 64);
tLoad.LoadImageIntoTexture(tDynamicTx);
GUI.Label(new Rect40,40, 64, 64), tDynamicTx);