Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:57:00+00:00 2026-05-31T20:57:00+00:00

I currently have a class called clientActivity that contains a finger paintig activity that

  • 0

I currently have a class called clientActivity that contains a finger paintig activity that draws onto a canvas, the class has a extension of View Called MyView. I want to make it so that the canvas appears in a relative layout on my xml chat layout.

This is the class ClientActivity

public class ClientActivity extends GraphicsActivity
implements ColorPickerDialog.OnColorChangedListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new MyView(this));
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(Color.BLACK);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(20);

    mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 },
            0.4f, 6, 3.5f);

    mBlur = new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL);

}

private Paint       mPaint;
private MaskFilter  mEmboss;
private MaskFilter  mBlur;

public void colorChanged(int color) {
    mPaint.setColor(color);
}


public class MyView extends View {

    ClientNetwork net = new ClientNetwork();

    private static final float MINP = 0.25f;
    private static final float MAXP = 0.75f;

    private Bitmap  mBitmap;
    private Canvas  mCanvas;
    private Path    mPath;
    private Paint   mBitmapPaint;

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

        mPath = new Path();
        mBitmapPaint = new Paint(Paint.DITHER_FLAG);
        Thread fred = new Thread(net);
        fred.start();
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);

        mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
        mCanvas = new Canvas(mBitmap);



    }

My chat.xml looks like this.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:weightSum="1">

<RelativeLayout android:id="@+id/relativeLayout3"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0.83">

<com.DrawTastic.ClientActivity android:id="@+id/MyView1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"/>


</RelativeLayout>

<ListView 
android:id="@+id/listView"
    android:layout_width="match_parent" 
    android:layout_height="152dp" android:layout_weight="0.17">
    </ListView>



    <RelativeLayout 
    android:id="@+id/relativeLayout2"
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" 
        android:layout_alignParentLeft="true">


        <EditText 
        android:layout_width="232dp"
            android:layout_alignParentTop="true" 
            android:layout_alignParentLeft="true"
            android:layout_height="wrap_content" 
            android:id="@+id/input">
            </EditText>


        <Button 
        android:layout_width="wrap_content"
            android:layout_alignParentTop="true" 
            android:layout_marginRight="16dp"
            android:layout_alignParentRight="true" 
            android:text="Send"
            android:onClick="sent" android:id="@+id/send" 
            android:layout_height="wrap_content">
            </Button>

    </RelativeLayout>

I just need the canvas to appear in the the chat.xml inside one of the layouts so I can lay a listview beneath it.

Any help is greatly appreciated!

Thanks

EDIT: Stack trace.

03-22 15:32:21.310: ERROR/AndroidRuntime(1301): FATAL EXCEPTION: main
03-22 15:32:21.310: ERROR/AndroidRuntime(1301): java.lang.RuntimeException: Unable to     start activity ComponentInfo{com.DrawTastic/com.DrawTastic.GameActivity}:     android.view.InflateException: Binary XML file line #8: Error inflating class     com.DrawTastic.ClientActivity.MyView
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at         android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at     android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at     android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
       03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.os.Looper.loop(Looper.java:123)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.app.ActivityThread.main(ActivityThread.java:3683)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at java.lang.reflect.Method.invokeNative(Native Method)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at java.lang.reflect.Method.invoke(Method.java:507)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at dalvik.system.NativeStart.main(Native Method)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.DrawTastic.ClientActivity.MyView
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.app.Activity.setContentView(Activity.java:1657)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at com.DrawTastic.GameActivity.onCreate(GameActivity.java:13)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     ... 11 more
03-22 15:32:21.310: ERROR/AndroidRuntime(1301): Caused by: java.lang.ClassNotFoundException: com.DrawTastic.ClientActivity.MyView in loader     dalvik.system.PathClassLoader[/data/app/com.DrawTastic-2.apk]
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.createView(LayoutInflater.java:471)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
03-22 15:32:21.310: ERROR/AndroidRuntime(1301):     ... 21 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:57:01+00:00Added an answer on May 31, 2026 at 8:57 pm

    you need to declare your Custom view like this in your layout chat.xml :

    //Notice that i've added .MyView
    
    <com.DrawTastic.ClientActivity.MyView  android:id="@+id/MyView1"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:layout_gravity="center"/>
    

    another thing , you should Override other Consturctors of the View in your MyView class like this :

    public MyView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }
    
    
    public MyView(Context context, AttributeSet attrs ) {
        super(context, attrs);
    }
    

    EDIT :

    about the problem that you got , you should declare your Activity in your Manifest file like this :

    <activity android:name=".YourActivity" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have a class called user that I want to create with different
I'm currently working on an OO PHP application. I have a class called validation
I have a class named Page with a private property currently called _pageData which
Currently I have a class that looks like this: public class MyClass : IMyClass
Currently I have a class that is extending the ListActivity class. I need to
We currently have a utilities class that handles a lot of string formatting, date
I'm working on a forum software currently. I have a class called User, within
I have a class called 'Constants' that I am storing a String variable in.
Say I have a class called Person, and it contains things such as last
I'm using cocos2d with objective C. I have a class called CrystalineBubble that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.