Hi,
thanks for ur reply ... Right now, this is the code i have
This is the activity i have written :
package hari.image;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.widget.ImageView;
public class imageexp extends Activity {
over drawView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Paint paint1=new Paint();
drawView = new over(this);
drawView.setBackgroundColor(Color.BLACK);
setContentView(drawView);
}
}
This is the class that actually displayes an image of a map n draws a
line over it...
package hari.image;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
public class over extends View {
Paint paint = new Paint();
Paint paint1=new Paint();
public over(Context context) {
super(context);
paint.setColor(Color.RED);
paint.setAlpha(255);
paint.setStrokeWidth(3);
paint1.setAlpha(230);
}
@Override
public void onDraw(Canvas canvas) {
canvas.drawLine(100, 100, 250, 250, paint);
//canvas.drawCircle(150, 200, 3, paint)
Bitmap bit = BitmapFactory.decodeResource(getResources(),
R.drawable.map);
canvas.drawBitmap(bit,30,30,paint1);
}
}
Here,i have drawn the line at some random co-ordinate... Instead,i
want to draw the line in some co-ordinate... This co-ordinate must be
specified by the Activity .... Can u please tell me what i should do
now ??
On Nov 20, 8:06 pm, Mark Murphy <[email protected]> wrote:
> Either your "another file which extends View class" is a widget in
> your activity that has "some co-ordinate values", or it is not.
>
> If it is, have the activity call a method on that View to pass the values.
>
> If the View is a widget in some other activity, then you have some
> fundamental architectural problems, IMHO.
>
>
>
> On Sat, Nov 20, 2010 at 7:46 PM, hari <[email protected]> wrote:
> > Hi guys,
>
> > I have a need where i must pass some values from an Activity to
> > another file which extends View class (instead of Activity) .... Its
> > not the normal passing of values from one activity to another...
>
> > In my Activity,i will pass some co-ordinate values to the class that
> > extends View... In this class,i will draw an image and place points
> > over the image on the required co-ordinates... But , the problem is ,i
> > cant send values using Intent ...
>
> > Is there any way to do this?? Pls reply ASAP....
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.2 Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en