Hello all
I am doing a tutorial through you tube I have my java correct but still my
button wont enable the view class, it's like button is not linked. I think
my manifest might be lacking something, I have listed that below java stuff.
My code is
This is the first java class that references java view class
package com.cornboyz.thebasics;
import android.app.Activity;
import android.os.Bundle;
public class tutorialFive extends Activity {
Cornboyz sweetBK;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
sweetBK = new Cornboyz(tutorialFive.this);
setContentView(sweetBK);
}
}
This is the java meant to create rectangle (without using XML if I
understand this all correctly)
package com.cornboyz.thebasics;
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.graphics.Rect;
import android.view.View;
public class Cornboyz extends View{
Bitmap cloud;
int x = 0;
int y = 0;
Paint paint = new Paint();
public Cornboyz(Context context) {
super(context);
// TODO Auto-generated constructor stub
cloud = BitmapFactory.decodeResource(getResources(), R.drawable.cloud1);
}
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
//set background
Rect cBK = new Rect();
cBK.set(0, 0, canvas.getWidth(), canvas.getHeight());
Paint pBlue = new Paint();
pBlue.setColor(Color.BLUE);
pBlue.setStyle(Paint.Style.FILL);
canvas.drawRect(cBK, pBlue);
drawCloud(x, y, canvas);
if(x < canvas.getWidth()){
x = x+10;
}else{
y = y+10;
x = 0;
}
invalidate();
}
private void drawCloud(int x2, int y2, Canvas canvas) {
// TODO Auto-generated method stub
canvas.drawBitmap(cloud, x2, y2, paint);
}
}
This is the Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cornboyz.thebasics"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".myMain"
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=".myMenu"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="com.cornboyz.thebasics.CLEARSCREEN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".sweet"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog"
>
<intent-filter>
<action android:name="com.cornboyz.thebasics.SWEET" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".tutorialOne"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.cornboyz.thebasics.TUTORIALONE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".listV"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.cornboyz.thebasics.TUTORIALTWO" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".tutorialThree"
android:label="@string/app_name"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="com.cornboyz.thebasics.TUTORIALTHREE"
/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".tutorialFour"
android:label="@string/app_name"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="com.cornboyz.thebasics.TUTORIALFOUR"
/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".tutorialFive"
android:label="@string/app_name"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="com.cornboyz.thebasics.TUTORIALFIVE"
/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
</manifest>
--
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