4

I am using fragments in my application. There is scrollview in one of fragment containing many views. When user click on edittext, keyboard opens but when user click done button on keyboard then keyboard get hidden leaving black screen. I tried a lot my self but no luck. Please guide me..

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128

3 Answers3

8

Put this code in your AndroidManifest.xml file in your activity tag-

<activity
     android:name="com.example.YourActivity" 
     android:configChanges="keyboard|keyboardHidden|
                   orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
     android:windowSoftInputMode="stateHidden|adjustPan">
   </activity>
Gk Mohammad Emon
  • 6,084
  • 3
  • 42
  • 42
Piyush
  • 5,607
  • 4
  • 27
  • 27
  • Hi.. I am using Fragment ViewPager and one of the fragments has an Edittext. It shows same black screen as keyboard hide. I have used above code in parent activity tag in manifest. But same error occur. Can anybody help with this. – Neo Jul 25 '16 at 10:38
  • Hello I am using Fragments in viewpager and all the fragments have multiple edittext and it shows same black screen as keyboard hide. I have almost tried all the possibilities and also set the above tags in manifest but still getting same error. Did anybody found the solution?? – user May 03 '17 at 09:44
2

Surly you are doing lot of things on UI thread.

do long running processes on other thread or Asynctask.

See this link, it will help you out.

http://developer.android.com/training/articles/perf-anr.html

Jaspreet Chhabra
  • 1,431
  • 15
  • 23
0
View view = findViewById(R.id.root);
view.getRootView().setBackgroundColor(android.R.color.white)

The code above can fix this for some layouts but might be failed for others, you can try.

Gk Mohammad Emon
  • 6,084
  • 3
  • 42
  • 42
androidwifi
  • 1,009
  • 10
  • 8