dear friends,
while showing progress bar i want to disable touch screen to restrict other functionalities in android phone.
can any one guide me how to achieve this?
any help would be appricated.
dear friends,
while showing progress bar i want to disable touch screen to restrict other functionalities in android phone.
can any one guide me how to achieve this?
any help would be appricated.
EDIT
You can do it by implementing a custom extension of ListView which you set as the list to use in your XML file. Then in your CustomListView, implement the onTouchEvent method and only call super.onTouchEvent if you want the touch to be processed by the list. Here's what I mean:
Have something to this effect in the layout file that contains your list.
<com.steve.CustomListView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/start_menu_background"
android:cacheColorHint="#00000000"
android:id="@android:id/list">
</com.steve.CustomListView>
Then have a custom class like this:
public class CustomListView extends ListView {
Context mContext;
public CustomListView (Context context, AttributeSet attrs){
super(context, attrs);
mContext = context;
}
public boolean onTouchEvent(MotionEvent event){
if (event.getRawY() < 100){
Log.d("Your tag", "Allowing the touch to go to the list.");
super.onTouchEvent(event);
return true;
} else {
Log.d("Your tag", "Not allowing the touch to go to the list.");
return true;
}
}
}
This code will only allow touch events to get processed by the ListView if they're in the top 100 pixels of the screen. Obviously, replace that if statement with something more appropriate for your application. Also don't leave in the Log statements once you've got it to work since you'll spam yourself with hundreds of logging lines after each gesture; they're only their to make obvious what is happening.