android-4.0-ice-cream-sandwich

How do I get IP_ADDRESS in IPV4 format

[亡魂溺海] 提交于 2019-11-26 22:40:25
问题 I am trying to get the IP address of an device i.e using WIFI or 3G connection. I am getting the ip address in IPV6 format which is not understandable. I want in IPV4 format IP address.I have done google but dint found any proper solutions. here is code which I am using to get IP address of an device public String getLocalIpAddress() { try { try { for (Enumeration<NetworkInterface> en = NetworkInterface .getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement()

How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets

北城以北 提交于 2019-11-26 22:39:38
问题 How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets which does't have menu button. ? I am running application as <uses-sdk android:minSdkVersion="5"/> in Manifest, code is compiled with 4.0 . Three-dot indicator shows on every screen. Example for preference activities i don't want show Three-dot indicator, since it does't have any menu options. Adding android:targetSdkVersion="14" in manifest it works. However don't want hide/remove three dots button on all screens

Capture media button on Android >=4.0 (works on 2.3)

别等时光非礼了梦想. 提交于 2019-11-26 22:23:20
问题 I wrote some service which uses BroadcastReceiver to capture one of media buttons ("play button" from a headset), and it works perfectly on android 2.3.x (HTC Nexus One or HTC Desire) When I tried to run in on Android 4.0.3 (Samsung Nexus S) it doesn't work (my application doesn't receive intent "android.intent.action.MEDIA_BUTTON" and "play" button behaves as usual: stops/starts music). Content of manifest: ... <application android:icon="@drawable/ic_launcher" android:label="@string/app_name

android 4.0 Dialog gets canceled when touched outside of dialog window

北城余情 提交于 2019-11-26 20:24:23
问题 Hi I am facing the problem on ICS like dialog is dismissed when we click outside dialog window, due to which I am getting problem like I don't get any confirmation from user. Please help. 回答1: Check this method from the Android Developers site for dialog. Try using the dialog.setCanceledOnTouchOutside (boolean cancel) Pass a boolean value to enable/disable dialog behaviour when touched outside of the dialog window. Also go through these links: How do I fire an event when click occurs outside

How to know “Don't keep activities” is enabled in ICS?

╄→гoц情女王★ 提交于 2019-11-26 20:19:10
问题 How to know in settings "Don't keep activities" option is enabled in ics via code. If it is in enabled,how to prevent the activity. Note: I have used more activities in my application.Because of that settings if I move one activity to another the first activity is destroyed.I can save my data on the onSaveInstanceState. With out using saved instance state is there any way to do... Thanks in advance.. 回答1: That flag is there for exactly this reason. The idea is to check and make sure your app

TYPE_SYSTEM_OVERLAY in ICS

时光总嘲笑我的痴心妄想 提交于 2019-11-26 20:17:48
In Honeycomb I was able to create a system overlay with TYPE_SYSTEM_OVERLAY and receive touches with FLAG_WATCH_OUTSIDE_TOUCH. Now ICS has changed something. I can still create the system overlay, but i can't get touches. Now, i am able to create the same with TYPE_SYSTEM_ALERT and get touches, but it just catches the touchevents, and not passing them on like in Honeycomb. Any idea's? Kind regards Everything you describe is true. It is presumably to tighten up security, as the former behavior was the source of tapjacking attacks. I wrote a blog post recently about this change. Any idea's? Don

accessibility service is not started

橙三吉。 提交于 2019-11-26 19:16:26
问题 I want to log all toasts events in android ics (4.0.3), but I was unable to log any system event. Service is just not started! According to this question: onAccessibilityEvent(AccessibilityEvent event) not intercepting notification MyAccessibilityService.java package com.test.toasts2; import android.accessibilityservice.AccessibilityService; import android.accessibilityservice.AccessibilityServiceInfo; import android.app.Notification; import android.os.Parcelable; import android.util.Log;

Disable keyboard on EditText

霸气de小男生 提交于 2019-11-26 18:47:07
I'm doing a calculator. So I made my own Buttons with numbers and functions. The expression that has to be calculated, is in an EditText , because I want users can add numbers or functions also in the middle of the expression, so with the EditText I have the cursor . But I want to disable the Keyboard when users click on the EditText . I found this example that it's ok for Android 2.3 , but with ICS disable the Keyboard and also the cursor. public class NoImeEditText extends EditText { public NoImeEditText(Context context, AttributeSet attrs) { super(context, attrs); } @Override public boolean

Hide ICS back home task switcher buttons

淺唱寂寞╮ 提交于 2019-11-26 18:42:14
Just wondering how to hide the ICS back/home/etc software buttons programmatically. Just like the Youtube apps does when playing a video. I want to hide them while a video is playing, but bring them up if the user taps the screen. I can't seem to find it anywhere on the web, or in Google's documentation. try to setup a Full screen window with flag SYSTEM_UI_FLAG_HIDE_NAVIGATION pinxue is spot-on... you want SYSTEM_UI_FLAG_HIDE_NAVIGATION . Example: myView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); One thing to note, though, is that upon any (and I mean ANY) user interaction

how to set json parsed data in a listview and then adding search functionality in it

∥☆過路亽.° 提交于 2019-11-26 18:35:16
问题 I am new to android and want to parse json data in a listview and then add search functionally to it, but I don't know how to add search. The Java class is: public class AndroidJSONParsingActivity extends ListActivity { // url to make request private static String url = "http://10.0.2.2/quick/punk.php"; // JSON Node names private static final String TAG_CUSTOMER = "Customer"; private static final String TAG_CUSTOMER_CODE = "customer_code"; private static final String TAG_CUSTOMER_NAME =