Have you tried adding android:windowSoftInputMode="stateVisible|adjustResize" to your activity in manifest?

EditText blocked by keyboard when it is clicked
I have an array containing N elements and I need to find the distance between the index of equal elements in a subarray; which we will get in form of query (L R) where L is starting index of subarray and R in ending index.
Total No. of array elements can be N&lt;=10^5 and Queries Q&lt;=10^5. 

ex:

7

0 4 0 8 0 32 0

2

0 2

0 5


//answer for 1st query will be 2 (index 2-0)

//answer for 2nd query will be 8 (index (2-0) + (4-2) + (4-0)) 

Edit: I am not expecting code (though it would be really helpful) general idea to solve will be a great help.
