ArchiveJune 2012

Screen Orientations Methods in unity3d

S

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

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...

Play YouTube video using UIWebView on iPhone

P

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

U

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

T

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

S

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

H

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)

M

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...

Category