Android 使用菜单项onclick重置path.reset

Android 使用菜单项onclick重置path.reset,android,view,reset,Android,View,Reset,我正在制作一个绘画应用程序,只是为了学习如何使用eclipse 每当我单击菜单项“重置”时,我想清除我的paintview 菜单项“重置”位于XML文件中。现在我知道我必须使用path.reset,但不知道如何编写它。希望有人能帮助我 <item android:id="@+id/ResetAction" android:orderInCategory="100" android:title="Reset" android:showAsAc

我正在制作一个绘画应用程序,只是为了学习如何使用eclipse

每当我单击菜单项“重置”时,我想清除我的paintview 菜单项“重置”位于XML文件中。现在我知道我必须使用path.reset,但不知道如何编写它。希望有人能帮助我

 <item android:id="@+id/ResetAction"
        android:orderInCategory="100"
        android:title="Reset"
        android:showAsAction="never" 
        android:menuCategory="container"
        ></item>

重置是一种用于重用路径对象的方法

例如,如果使用路径对象绘制在每一帧更改的形状,则在drawCanvas或onDrawCanvas方法中的帧绘制开始时,可以重置路径,将新形状添加到路径,然后绘制路径canvas.drawPath

public class SingleTouchActivity extends Activity 

{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new SingleTouchEventView(this, null));
      }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.main_fragment, container,
                    false);
            return rootView;
        }
    }

}