Hi

Just Change the *android:versionCode="1.1"*  present in the mainfest.xml
file

regards
sandeep


On Mon, Sep 6, 2010 at 5:39 PM, Dhrumil Shah <[email protected]> wrote:

> I developed one game its code is here:
>
> *Testing.java*
> *
>
> package
> * com.paad.testing;
>
> *
>
> import
> * android.app.Activity;*
>
> import
> * android.os.Bundle;*
>
> import
> * android.os.Handler;*
>
> import
> * android.os.Message;*
>
> import
> * android.view.*;*
>
> import
> * android.graphics.*;*
>
> import
> * android.content.*;
>
> *
>
> public
> * *class* Testing *extends* Activity {
>
> RandomView
> randomView = *null*;
>
> *public* *static* *final* *int* *DIRECTION_RIGHT* = 0, *DIRECTION_LEFT* =
> 1, *DIRECTION_DOWN* = 2, *DIRECTION_UP* = 3;
>
> *protected* *static* *final* *int* *GUIUPDATEIDENTIFIER* = 0x101;
>
> *private* Panel main;
>
> *private* Bitmap scratch;
>
> *private* Canvas offscreen;
>
> *public* *boolean* start = *true*;
>
> *private* *volatile* *boolean* running = *false*;
>
> *private* *int* direction = *DIRECTION_RIGHT*;
>
> *private* *int* boxx = 10;
>
> *private* *int* boxy = 10;
>
> Thread
> myRefreshThread = *null*;
>
> Handler
> GUIUpdateHandler = *new* Handler() {
>
> // @Override
>
> *public* *void* handleMessage(Message msg) {
>
> *switch* (msg.what) {
>
> *case* Testing.*GUIUPDATEIDENTIFIER*:
>
> randomView.invalidate();
>
> *break*;
>
> }
>
> *super*.handleMessage(msg);
>
> }
>
> };
>
> @Override
>
> *public* *void* onCreate(Bundle savedInstanceState)
>
> {
>
> *super*.onCreate(savedInstanceState);
>
> *this*.randomView = *new* RandomView(*this*);
>
> *this*.setContentView(*this*.randomView);
>
> (
> *new* Thread(*new* Refresh())).start();
>
> setOffscreenBitmap();
>
> main = *new* Panel(*this*);
>
> setContentView(
> main,*new* ViewGroup.LayoutParams(320,480));
>
> (
> *new* Thread(*new* AnimationLoop())).start();
>
> }
>
> *private* *void* setOffscreenBitmap()
>
> {
>
> scratch = Bitmap.*createBitmap*(30,30,Bitmap.Config.*ARGB_8888*);
>
> offscreen = *new* Canvas();
>
> offscreen.setBitmap(scratch);
>
> offscreen.drawColor(Color.*RED*);
>
> }
>
> *private* *synchronized* *void* updatePhysics()
>
> {
>
> *if*(boxx < 10){
>
> direction = *DIRECTION_RIGHT*;
>
> }
>
> *else* *if*(boxx > 250){
>
> direction = *DIRECTION_LEFT*;
>
> }
>
> *if*(boxy < 10){
>
> direction = *DIRECTION_DOWN*;
>
> }
>
> *else* *if*(boxy > 350){
>
> direction = *DIRECTION_UP*;
>
> }
>
> *if*(direction == *DIRECTION_RIGHT*){
>
> boxx = boxx + 10;
>
> }
>
> *else* *if* (direction == *DIRECTION_LEFT*)
>
> {
>
> boxx = boxx - 10;
>
> }
>
> *else* *if*(direction == *DIRECTION_UP*){
>
> boxy = boxy - 10;
>
> }
>
> *else* *if*(direction == *DIRECTION_DOWN*){
>
> boxy = boxy + 10;
>
> }
>
> *else*{
>
> //Do nothing
>
> }
>
> }
>
> *private* *synchronized* *void* doDraw(Canvas canvas, Paint paint)
>
> {
>
> *if*(start)
>
> {
>
> canvas.drawColor(Color.
> *GREEN*);
>
> canvas.drawBitmap(
> scratch,10,10,paint);
>
> start = *false*;
>
> }
>
> *else*
>
> {
>
> canvas.save();
>
> canvas.clipRect(
> boxx,boxy,boxx+30,boxy+30);
>
> canvas.drawColor(Color.
> *RED*);
>
> canvas.drawBitmap(
> scratch,boxx,boxy,paint);
>
> canvas.restore();
>
> }
>
> }
>
> //@Override
>
> *public* *boolean* onKeyDown(*int* keyCode, KeyEvent event){
>
> *if*(keyCode == KeyEvent.*KEYCODE_DPAD_CENTER*){
>
> *if*(running!=*true*){
>
> running = *true*;
>
> }
>
> *else*{
>
> running = *false*;
>
> }
>
> }
>
> *else* *if*(keyCode == KeyEvent.*KEYCODE_DPAD_LEFT*){
>
> direction = *DIRECTION_LEFT*;
>
> }
>
> *else* *if*(keyCode == KeyEvent.*KEYCODE_DPAD_RIGHT*){
>
> direction = *DIRECTION_RIGHT*;
>
> }
>
> *else* *if*(keyCode == KeyEvent.*KEYCODE_DPAD_DOWN*){
>
> direction = *DIRECTION_DOWN*;
>
> }
>
> *else* *if* (keyCode == KeyEvent.*KEYCODE_DPAD_UP*){
>
> direction = *DIRECTION_UP*;
>
> }
>
> *else* *if*(keyCode == KeyEvent.*KEYCODE_BACK*){
>
> finish();
>
> }
>
> *return* *true*;
>
> }
>
> *class* Panel *extends* View
>
> {
>
> Paint
> paint;
>
> *public* Panel(Context context)
>
> {
>
> *super*(context);
>
> paint = *new* Paint();
>
> }
>
> @Override
>
> *protected* *void* onDraw(Canvas canvas)
>
> {
>
> doDraw(canvas,
> paint);
>
> }
>
> }
>
> *class* AnimationLoop *implements* Runnable
>
> {
>
> *public* *void* run()
>
> {
>
> *while*(*true*)
>
> {
>
> *while*(running)
>
> {
>
> *try*
>
> {
>
> Thread.*sleep*(100);
>
> }
>
> *catch*(InterruptedException ex) {}
>
> updatePhysics();
>
> main.postInvalidate();
>
> }
>
> }
>
> }
>
> }
>
> *class* Refresh *implements* Runnable{
>
> *public* *void* run(){
>
> *while*(!Thread.*currentThread*().isInterrupted()){
>
> Message message =
> *new* Message();
>
> message.
> what = Testing.*GUIUPDATEIDENTIFIER*;
>
> Testing.
> *this*.GUIUpdateHandler.sendMessage(message);
>
> *try*{
>
> Thread.*sleep*(100);
>
> }
>
> *catch* (Exception e) {
>
> Thread.*currentThread*().interrupt();
>
> }
>
> }
>
> }
>
> }
>
> }
> my another class file:
> *RandomView.java*
>
> **
> *
>
> package
> * com.paad.testing;
>
> *
>
> import
> * android.content.Context;*
>
> import
> * android.graphics.Canvas;*
>
> import
> * android.graphics.Color;*
>
> import
> * android.graphics.Point;*
>
> import
> * android.graphics.drawable.Drawable;*
>
> import
> * android.view.View;
>
> *
>
> public
> * *class* RandomView *extends* View{
>
> *protected* Drawable myPosition;
>
> *protected* Point myPoint = *new* Point(10,10);
>
> *protected* *enum* HorizontalDirection{*LEFT*,*RIGHT*}
>
> *protected* *enum* VerticalDirection{*UP*,*DOWN*}
>
> *protected* HorizontalDirection myXDirection = HorizontalDirection.*RIGHT*;
>
>
> *protected* VerticalDirection myYDirection = VerticalDirection.*UP*;
>
> *public* RandomView(Testing testing) {
>
> *super*((Context)testing);
>
> *this*.setBackgroundColor(Color.*BLUE*);
>
> *this*.myPosition = *this*.getResources().getDrawable(R.drawable.*
> greenball*);
>
> }
>
> *public* *void* onDraw(Canvas canvas){
>
> *if*(myPoint.x>= *this*.getWidth() - myPosition.getBounds().width()){
>
> *this*.myXDirection = HorizontalDirection.*LEFT*;
>
> }
>
> *else* *if*(myPoint.x <= 0){
>
> *this*.myXDirection = HorizontalDirection.*RIGHT*;
>
> }
>
> *if*(myPoint.y>= *this*.getHeight() - myPosition.getBounds().height()){
>
> *this*.myYDirection = VerticalDirection.*UP*;
>
> }
>
> *else* *if*(myPoint.y<=0){
>
> *this*.myYDirection = VerticalDirection.*DOWN*;
>
> }
>
> *if*(*this*.myXDirection == HorizontalDirection.*RIGHT*){
>
> *this*.myPoint.x += 10;
>
> }
>
> *else*{
>
> *this*.myPoint.x -= 10;
>
> }
>
> *if*(*this*.myYDirection == VerticalDirection.*DOWN*){
>
> *this*.myPoint.y += 10;
>
> }
>
> *else*{
>
> *this*.myPoint.y -= 10;
>
> }
>
> *this*.myPosition.setBounds(*this*.myPoint.x, *this*.myPoint.y, *this*.
> myPoint.x + 50, *this*.myPoint.y + 50);
>
> *this*.myPosition.draw(canvas);
>
> }
>
> }
>
> This is my code. In that game, the box is moving left, right , top and
> down. In the same, I used one image of ball, which is bouncing. But my
> problem is the bouncing ball is not visible.
>
> How to solve it? Please suggest me.
> ~Dhrumil
>
>
>
>
> On Mon, Sep 6, 2010 at 4:26 PM, Miguel Morales <[email protected]>wrote:
>
>> How are you upgrading your game?
>>
>> On Mon, Sep 6, 2010 at 3:28 AM, dhrumil <[email protected]> wrote:
>> > Hello 2all,
>> >
>> > I have developed one simple game application.
>> > In that, the box is moving in all four directions. Now I want to
>> > upgrade my game. So for that I just add one ball image on this
>> > application. This ball image is bouncing all over the android screen.
>> > I tried a lot but not able to upgrade my game. The only box is visible
>> > on the screen and the ball image is not visible.
>> >
>> > I want to display both of them on the screen.
>> > How to do this?
>> > Any suggestions.
>> > Please anyone knows give me a reply.
>> >
>> > ~Dhrumil
>> >
>> > --
>> > 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]<android-developers%[email protected]>
>> > For more options, visit this group at
>> > http://groups.google.com/group/android-developers?hl=en
>>
>>
>>
>> --
>> ~ Jeremiah:9:23-24
>> Android 2D MMORPG: http://developingthedream.blogspot.com/,
>> http://diastrofunk.com,
>> http://www.youtube.com/user/revoltingx
>>
>> --
>>   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]<android-developers%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>  --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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

Reply via email to