android-4.0-ice-cream-sandwich

Can I turn on WiFi-Direct from code? on Android API-14 (ICS)

雨燕双飞 提交于 2019-11-28 07:39:18
I'm using the new Wi-Fi Direct API from google on Android 4.0 and in Sample code they send the User to Settings, to activate WiFi -Direct Mode. Is there a way to Start it by code??? all they offer is to listen to WIFI_P2P_STATE_CHANGED_ACTION intent, and then use this code String action = intent.getAction(); if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) { // UI update to indicate wifi p2p status. int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1); if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) { // Wifi Direct mode is enabled } else { // Wifi Direct

VerifyError deploying on API 1.6

こ雲淡風輕ζ 提交于 2019-11-28 07:38:10
I've come across a backwards compatibility issue when deploying my application on android 1.6. Im getting a VerifyError on this piece of code: if(android.os.Build.VERSION.SDK_INT >= 11) { getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg)); } This is not unexpected since getActionBar() doesn't exist pre API 11, however post-1.6 (API 5 and higher?) builds all semi-gracefully go around this according to the logcat message im getting when deploying for example on a API level 8 device; 06-27 16:47:04.333: INFO/dalvikvm(11529): Could not find method com.me.app

The best way to create drop down menu in android 2.x like in ICS

删除回忆录丶 提交于 2019-11-28 07:37:31
I want to create button with drop down menu, like overflow menu button in ActionBar on ICS. I have problem because PopupMenu there isn't in android 2.x. The second way using Spinner but it's not for me, because Spinner always show the first item on my custom background or my selected item. How can I acheive it? In general, I want ContextMenu but little and on position clicked view. Thanks. It looks like this : If your purpose is to recreate an action bar, you could take a look at the ActionBarSherlock project, which backports thoses functionalities. If you want to be able to pop such a menu

Android 4.0.3 and finish activity

China☆狼群 提交于 2019-11-28 07:35:45
问题 I have Activity A calling activity B, Activity B dials a number and then on the IDLE-OFFHOOK- IDLE state I call ActivityB.this.finish() so that activity A shows on front. this all worked fine from android 2.3.x till 4.0 version. Now it doesn't work on android 4.0.3 emulator and 4.0.2 samsung galaxy nexus 2. Why? Can someone help? 回答1: Better solution for this case is to use startActivityForResult. You can switch activity from A to B, in activity B do your work and handle results in activity A

Does the Android ICS API have a native equivalent to ViewPager support lib?

不羁的心 提交于 2019-11-28 06:43:59
I have searched a bit around for a pager for fragment , I develop on ICS API. I know about ViewPager and all the support libs for earlier version but i don't get why I should use a support library consider the fact that I use the lastest version of the api and don't plan to support earlier version. Do I have to write the "ViewPager" myself or is there something i didn't see in the api. Does the Android ICS API have a native equivalent to ViewPager support lib? No. I know about ViewPager and all the support libs for earlier version but i don't get why I should use a support library consider the

Handling the missing MENU button in new versions of Android (3.x and up)

这一生的挚爱 提交于 2019-11-28 06:12:31
I'm a fan of the menu button as used in Android <3.0, as it was very useful for my game apps - it allowed me to take important but gameplay irrelevant functionality (saving game, reference info links) and place it somewhere where it did not clutter up the main game interface, but was still easily accessible (the options menu). This use of keys became a problem with 3.0, because it removed the MENU button and substituted it with the Action Bar. The Action bar is really not suitable for a game which likes to run full-screen, so that was a real pain. No action bar - no access to the options menu.

Android Canvas.drawPicture not working in devices with ice cream sandwich

穿精又带淫゛_ 提交于 2019-11-28 05:27:40
问题 I want to draw a Picture on a Canvas by mCanvas.drawpicture(mPicture, mRect) Using target API 7 <uses-sdk android:minSdkVersion="7"/> , it works perfectly in devices with API<14, but in devices with Ice Cream Sandwich, it doesn't work. Apparently this is because canvas.drawPicture is not supported with Hardware Acceleration: Unsupported Drawing Operations I have tried to fix this by disabling the Hardware Acceleration in the Manifest: <application android:hardwareAccelerated="false" ...> but

Adding widgets to a launcher page without bindAppWidgetId()

霸气de小男生 提交于 2019-11-28 04:44:49
I'm trying to turn the stock ICS launcher into a standalone app. I'm nearly there - the only things not working are the search icon and dropping widgets onto the screen, which causes a crash. The crash is because the stock launcher uses appWidgetManager.bindAppWidgetId(appWidgetId, componentName); to add widgets, which apparently only system apps have permission to do . So my question is, what is the correct way for a non-system app to add widgets and acheive the same UI experience as the stock ICS launcher ? Timmmm, Your issue is that you are looking to the wrong object. You can't really

“Ice Cream Sandwich” and WRITE_APN_SETTINGS

我与影子孤独终老i 提交于 2019-11-28 04:11:35
问题 Does anybody know how to write app for " Ice Cream Sandwich " using WRITE_APN_SETTINGS permission ? WRITE_APN_SETTINGS is now ignored in ICS and code touching APNs fails. 回答1: Yes, Google high handedly decided to remove this. No dialogue comes up for confirmation, they simply make it fail. Thanks for acting like Apple! This ruins the user experience for users of non standard APNs (I'm on giffgaff which Google decided not to put on the official ICS list, once again, thanks). So I had to enter

IllegalArgumentException thrown by requestLocationUpdate()

懵懂的女人 提交于 2019-11-28 03:15:06
问题 We recently tested our application against android API level 14 and 15. We started development targeting minimal SKD Version 8 and excluding tablets (3.x). With 2.x everything works well but when running the app on a 4.x droid it crashes at the point we're obtaining user's location. FATAL EXCEPTION: main java.lang.RuntimeException: Unable to create service java.lang.IllegalArgumentException: provider=network at android.app.ActivityThread.handleCreateService(ActivityThread.java:2263) at