In my application, I use viewPager to give me good swipey looks. I want the keyboard to be hidden on two pages, but always crossed out on one page where I have a text box.
I tried various ways for the keyboard to display, but it just doesn't work. I think I should call the display keyboard code in the wrong place.
@Override public Object instantiateItem( View collection, int position ) { LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = null; if(position==0){ layout=inflater.inflate(R.layout.other, null); //new PC().create(layout, context); ((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(collection.getWindowToken(), 0); }else if(position==1){ layout=inflater.inflate(R.layout.main, null); new BlurayRemote().create(layout,context); ((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(collection.getWindowToken(), 0); }else if(position==2){ layout=inflater.inflate(R.layout.text, null); new TextInput().create(layout,context); ((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInputFromInputMethod(collection.getWindowToken(), 0); } ((ViewPager) collection).addView(layout); return layout; }
Any help would be great as it drives me crazy!
source share