Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在清单中找不到类_Android_Eclipse - Fatal编程技术网

Android 在清单中找不到类

Android 在清单中找不到类,android,eclipse,Android,Eclipse,我在这里使用了这个代码来裁剪图像。我是这样实现的。但当我运行应用程序并裁剪图像时,我没有收到错误: 我在舱单上声明 10-21 15:09:21.556: E/AndroidRuntime(25037): FATAL EXCEPTION: main 10-21 15:09:21.556: E/AndroidRuntime(25037): android.content.ActivityNotFoundException: Unable to find explicit activity clas

我在这里使用了这个代码来裁剪图像。我是这样实现的。但当我运行应用程序并裁剪图像时,我没有收到错误: 我在舱单上声明

10-21 15:09:21.556: E/AndroidRuntime(25037): FATAL EXCEPTION: main
10-21 15:09:21.556: E/AndroidRuntime(25037): android.content.ActivityNotFoundException: Unable to find explicit activity class {android.app.cut/android.app.cut.SomeView$CropActivity}; have you declared this activity in your AndroidManifest.xml?
主要代码:

public class main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

}

@Override
protected void onResume() {
    super.onResume();
    setContentView(new SomeView(main.this));
}}
someview类:

public class SomeView extends View implements OnTouchListener {
private Paint paint;
public static List<Point> points;
int DIST = 2;
boolean flgPathDraw = true;

Point mfirstpoint = null;
boolean bfirstpoint = false;

Point mlastpoint = null;






Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
        R.drawable.ic_launcher);
Context mContext;

public SomeView(Context c) {
    super(c);

    mContext = c;
    setFocusable(true);
    setFocusableInTouchMode(true);

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.STROKE);
    paint.setPathEffect(new DashPathEffect(new float[] { 10, 20 }, 0));
    paint.setStrokeWidth(5);
    paint.setColor(Color.WHITE);

    this.setOnTouchListener(this);
    points = new ArrayList<Point>();

    bfirstpoint = false;
}

public SomeView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;
    setFocusable(true);
    setFocusableInTouchMode(true);

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(2);
    paint.setColor(Color.WHITE);

    this.setOnTouchListener(this);
    points = new ArrayList<Point>();
    bfirstpoint = false;

}

public void onDraw(Canvas canvas) {
    canvas.drawBitmap(bitmap, 0, 0, null);

    Path path = new Path();
    boolean first = true;

    for (int i = 0; i < points.size(); i += 2) {
        Point point = points.get(i);
        if (first) {
            first = false;
            path.moveTo(point.x, point.y);
        } else if (i < points.size() - 1) {
            Point next = points.get(i + 1);
            path.quadTo(point.x, point.y, next.x, next.y);
        } else {
            mlastpoint = points.get(i);
            path.lineTo(point.x, point.y);
        }
    }
    canvas.drawPath(path, paint);
   }

public boolean onTouch(View view, MotionEvent event) {
    // if(event.getAction() != MotionEvent.ACTION_DOWN)
    // return super.onTouchEvent(event);

    Point point = new Point();
    point.x = (int) event.getX();
    point.y = (int) event.getY();

    if (flgPathDraw) {

        if (bfirstpoint) {

            if (comparepoint(mfirstpoint, point)) {
                // points.add(point);
                points.add(mfirstpoint);
                    flgPathDraw = false;
                                    showcropdialog();
            } else {
                points.add(point);
            }
        } else {
            points.add(point);
        }

        if (!(bfirstpoint)) {

            mfirstpoint = point;
            bfirstpoint = true;
        }
    }

    invalidate();
    Log.e("Hi  ==>", "Size: " + point.x + " " + point.y);

    if (event.getAction() == MotionEvent.ACTION_UP) {
        Log.d("Action up*******~~~~~~~>>>>", "called");
        mlastpoint = point;
        if (flgPathDraw) {
            if (points.size() > 12) {
                if (!comparepoint(mfirstpoint, mlastpoint)) {
                    flgPathDraw = false;
                    points.add(mfirstpoint);
                    showcropdialog();
                }
            }
        }
    }

    return true;
}

private boolean comparepoint(Point first, Point current) {
    int left_range_x = (int) (current.x - 3);
    int left_range_y = (int) (current.y - 3);

    int right_range_x = (int) (current.x + 3);
    int right_range_y = (int) (current.y + 3);

    if ((left_range_x < first.x && first.x < right_range_x)
            && (left_range_y < first.y && first.y < right_range_y)) {
        if (points.size() < 10) {
            return false;
        } else {
            return true;
        }
    } else {
        return false;
    }

}

public void fillinPartofPath() {
    Point point = new Point();
    point.x = points.get(0).x;
    point.y = points.get(0).y;

    points.add(point);
    invalidate();
}

public void resetView() {
    points.clear();
    paint.setColor(Color.WHITE);
    paint.setStyle(Style.STROKE);
    flgPathDraw = true;
    invalidate();
}

private void showcropdialog() {
    DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent;
            switch (which) {
            case DialogInterface.BUTTON_POSITIVE:
                // Yes button clicked
                // bfirstpoint = false;

                intent = new Intent(mContext, CropActivity.class);
                intent.putExtra("crop", true);
                mContext.startActivity(intent);
                break;

            case DialogInterface.BUTTON_NEGATIVE:
                // No button clicked

                intent = new Intent(mContext, CropActivity.class);
                intent.putExtra("crop", false);
                mContext.startActivity(intent);

                bfirstpoint = false;
                // resetView();

                break;
            }
        }
    };

    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setMessage("Do you Want to save Crop or Non-crop image?")
            .setPositiveButton("Crop", dialogClickListener)
            .setNegativeButton("Non-crop", dialogClickListener).show()
            .setCancelable(false);
}}
public类SomeView扩展了视图实现的OnTouchListener{
私人油漆;
公共静态列表点;
int-DIST=2;
布尔值flgPathDraw=true;
点mfirstpoint=null;
布尔bfirstpoint=false;
点mlastpoint=null;
位图位图=BitmapFactory.decodeResource(getResources(),
R.可牵引ic_发射器);
语境;
公共视图(上下文c){
超级(c);
mContext=c;
设置聚焦(真);
setFocusableInTouchMode(真);
油漆=新油漆(油漆.防油漆别名标志);
绘制.设置样式(绘制.样式.笔划);
setPathEffect(新的DashPathEffect(新的float[]{10,20},0));
油漆。设置行程宽度(5);
油漆。设置颜色(颜色。白色);
this.setOnTouchListener(this);
points=新的ArrayList();
bfirstpoint=false;
}
公共SomeView(上下文、属性集属性){
超级(上下文,attrs);
mContext=上下文;
设置聚焦(真);
setFocusableInTouchMode(真);
油漆=新油漆(油漆.防油漆别名标志);
绘制.设置样式(绘制.样式.笔划);
油漆。设置行程宽度(2);
油漆。设置颜色(颜色。白色);
this.setOnTouchListener(this);
points=新的ArrayList();
bfirstpoint=false;
}
公共空白onDraw(画布){
drawBitmap(位图,0,0,null);
路径路径=新路径();
布尔值优先=真;
对于(int i=0;i”,“Size:+point.x+”+point.y);
if(event.getAction()==MotionEvent.ACTION\u UP){
Log.d(“操作启动******~~~~~~~~~~>>>>”,“调用”);
mlastpoint=点;
if(flgPathDraw){
如果(points.size()>12){
如果(!比较点(mfirstpoint,mlastpoint)){
flgPathDraw=假;
添加点(mfirstpoint);
showcropdialog();
}
}
}
}
返回true;
}
专用布尔比较点(点优先,点当前){
int left_range_x=(int)(当前.x-3);
int left_range_y=(int)(当前.y-3);
int right_range_x=(int)(当前.x+3);
int right_range_y=(int)(当前.y+3);
if((左范围x
作物类别:

 public class CropActivity extends Activity {

        ImageView compositeImageView;
        boolean crop;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.someview);

            Bundle extras = getIntent().getExtras();
            if (extras != null) {
                crop = extras.getBoolean("crop");
            }
            int widthOfscreen = 0;
            int heightOfScreen = 0;

            DisplayMetrics dm = new DisplayMetrics();
            try {
                getWindowManager().getDefaultDisplay().getMetrics(dm);
            } catch (Exception ex) {
            }
            widthOfscreen = dm.widthPixels;
            heightOfScreen = dm.heightPixels;

            compositeImageView = (ImageView) findViewById(R.id.someview);

            Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(),
                    R.drawable.ic_launcher);

            Bitmap resultingImage = Bitmap.createBitmap(widthOfscreen,
                    heightOfScreen, bitmap2.getConfig());

            Canvas canvas = new Canvas(resultingImage);
            Paint paint = new Paint();
            paint.setAntiAlias(true);

            Path path = new Path();
            for (int i = 0; i < SomeView.points.size(); i++) {
                path.lineTo(SomeView.points.get(i).x, SomeView.points.get(i).y);
            }
            canvas.drawPath(path, paint);
            if (crop) {
                paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));

            } else {
                paint.setXfermode(new PorterDuffXfermode(Mode.SRC_OUT));
            }
            canvas.drawBitmap(bitmap2, 0, 0, paint);
            compositeImageView.setImageBitmap(resultingImage);
        }
    }
公共类CropActivity扩展活动{
ImageView compositeImageView;
布尔裁剪;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.someview);
Bundle extras=getIntent().getExtras();
如果(附加值!=null){
裁剪=额外的getBoolean(“裁剪”);
}
屏幕的int宽度=0;
屏幕的内部高度=0;
显示器
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".main"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


      <activity
        android:name=".CropActivity"
        android:label="@string/app_name" >

    </activity>

    <activity
        android:name=".SomeView"
        android:label="@string/app_name" >

    </activity>
</application>