// Get display for detecting the phone orientation
display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
// Get the orientation
int orientation = display.getOrientation();
Android - Detect The Phone Orientation « Eureka! - 0 views
-
-
android.view.Display class provide a simple way to determine the phone orientation.
PhoneGap - 0 views
-
PhoneGap is an open source development framework for building cross-platform mobile apps. Build apps in HTML and JavaScript and still take advantage of core features in iPhone/iPod touch, iPad, Google Android, Palm, Symbian and Blackberry SDKs.
Can I Use this Intent? | Android Developers - 0 views
-
This article describes a technique you can use to find out whether the system contains any application capable of responding to the intent you want to use. The example below shows a helper method that queries the system package manager to determine whether there's an app that can respond to a specified intent. Your application can pass an intent to the method and then, for example, show or hide user options that the user would normally use to trigger the intent.
-
/** * Indicates whether the specified action can be used as an intent. This * method queries the package manager for installed packages that can * respond to an intent with the specified action. If no suitable package is * found, this method returns false. * * @param context The application's environment. * @param action The Intent action to check for availability. * * @return True if an Intent with the specified action can be sent and * responded to, false otherwise. */public static boolean isIntentAvailable(Context context, String action) { final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(action); List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0;}
-
@Overridepublic boolean onPrepareOptionsMenu(Menu menu) { final boolean scanAvailable = isIntentAvailable(this, "com.google.zxing.client.android.SCAN"); MenuItem item; item = menu.findItem(R.id.menu_item_add); item.setEnabled(scanAvailable); return super.onPrepareOptionsMenu(menu);}
Fragments | Android Developers - 1 views
-
If you add multiple changes to the transaction (such as another add() or remove()) and call addToBackStack(), then all changes applied before you call commit() are added to the back stack as a single transaction and the BACK key will reverse them all together.
-
The most significant difference in lifecycle between an activity and a fragment is how one is stored in its respective back stack. An activity is placed into a back stack of activities that's managed by the system when it's stopped, by default (so that the user can navigate back to it with the BACK key, as discussed in Tasks and Back Stack). However, a fragment is placed into a back stack managed by the host activity only when you explicitly request that the instance be saved by calling addToBackStack() during a transaction that removes the fragment.
-
In some cases, you might need a fragment to share events with the activity. A good way to do that is to define a callback interface inside the fragment and require that the host activity implement it. When the activity receives a callback through the interface, it can share the information with other fragments in the layout as necessary.
« First
‹ Previous
121 - 127 of 127
Showing 20▼ items per page