android-4.0-ice-cream-sandwich

No such method getITelephony to disconnect Call

半城伤御伤魂 提交于 2019-12-18 03:32:34
问题 i want to disconnect outgoing call in ICS. My issue is first of all I am not getting the broadcast in IC` in Gingerbread it is working fine and blocking the calls but in ICS its not Broadcasting. for BroadCast I created a service and in that I am getting BroadCast of PHONE_STATE in ICS also but when i try to disconnect call I am getting error of NO such method name 'getITelephony' in ICS call is not disconnecting. I am using following code to disconnect call using the BroadCast... try{

Unable to show keyboard automatically in the SearchView

半城伤御伤魂 提交于 2019-12-18 03:10:12
问题 The SearchView is focused by default, but when I try to show software keyboard - it doesn't happen: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0); But when I click on the SearchView - it does. Why? 回答1: Fixed! mSearchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { showInputMethod(view

EditText cursor is invisible in Android 4.0

痞子三分冷 提交于 2019-12-17 23:25:06
问题 I have an EditText input in Android 4.0 and the Cursor is not showing inside it. What can make the cursor not appear in the input field? 回答1: Make android:cursorVisible="true" and If you have used android:textColor then set the android:textCursorDrawable attribute to @null . Happy coding ;) 回答2: I had a similar problem but it was because the cursor is actually white and I had a white background. I needed to be able to change the cursor to black in code somehow and used this approach. I

networkOnMainThread Exception Android

柔情痞子 提交于 2019-12-17 21:12:13
问题 I'm trying to access a server so I can receive a JSON String. But apparently in Ice Cream Sandwich you can't do network operations in the main thread, but the AsyncTask class is confusing me and not working. Here's what I have so far: //up in main code Void blah = null; URI uri = "kubie.dyndns-home.com/R2Bar2/ingredients.php"; new DownloadFilesTask().execute(uri , blah, blah); private class DownloadFilesTask extends AsyncTask<URI, Void, Void> { protected Void doInBackground(URI... uri) {

Launch “launcher app drawer” from an application?

女生的网名这么多〃 提交于 2019-12-17 20:32:30
问题 I would like to launch (or go back) from an application to the launcher app drawer with the tiled app icons, not to the desktop. Intent intent = new Intent("android.intent.action.MAIN"); intent.setComponent(new ComponentName("com.android.launcher","com.android.launcher2.Launcher")); intent.addCategory("android.intent.category.LAUNCHER"); startActivity(intent); This code "launches" the desktop. I would like to reach the app icons . How can I achieve that? The Manifest of Launcher doesn't seem

Why does EditText retain its Activity's Context in Ice Cream Sandwich

99封情书 提交于 2019-12-17 20:04:26
问题 In Ice Cream Sandwich, when there's an Activity containing an EditText, the EditText will retain the Activity's Context even after the user leaves the Activity. To demonstrate this I've created TestLeakActivity, which allocates a large byte array. Since the Activity's Context is never garbage collected, the byte arrays accumulate on the heap, eventually causing an OutOfMemoryError. You can observe the heap growth by using the DDMS heap tool, and you can track the outstanding references to the

How can I disable Android 4.0 home button?

风格不统一 提交于 2019-12-17 19:57:13
问题 I can disable home button for Android 2.2, 3.0 etc. But same code does not work for 4.0. Is there any solution to disable home button? @Override public void onAttachedToWindow() { super.onAttachedToWindow(); this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); } 回答1: Disabling the Home Button , many developers ask about such a feature!! but all I can say: you should absolutely not be disabling the home button in an Android application. This is a major anti-pattern , and will

Bitmaps on ICS are loaded with wrong pixel format

安稳与你 提交于 2019-12-17 19:34:25
问题 I encountered the following problem. When any bitmap is loaded from resources by an application running on Ice Cream Sandwich, it will likely be rendered incorrectly as if it has been decoded to the format, which differs from the current window format, with no dither applied. However, both, the decoding format and window format have been explicitly set: BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inPreferredConfig = Bitmap.Config.RGBA_8888; and getWindow().setFormat

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

天大地大妈咪最大 提交于 2019-12-17 18:36:30
问题 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

How can I override TimePicker to change text color

谁说我不能喝 提交于 2019-12-17 17:15:25
问题 My view has a white background, and it has to stay that way. I have a TimePicker on that white background.Everything is woking fine with android 2.3.3 but android 4.0.3 has a new timePicker style. The numbers have a very bright color. It is very hard to see them on the white background, and I didn't find a direct way to change the textColor. I don't want to change the background because it would look not so good. Is there any way to override this and set the color of the numbers to black?