[android-developers] Custom Views Timerview

2009-10-01 Thread andr0id

Hi everyone,

I've made a simple countdown timer and I would like to use it as a
custom view in my xml layout.

The view works perfectly well if i add it manually like this:

this.myTimerView = new TimerView(this);
layout.addView(myTimerView);

However when I use it in the xml file, the program crashes. This is
what i've done:

XML:

RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:id=@+id/layout
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

ImageView
android:id=@+id/imgv /

TextView
android:id=@+id/txtv /

com.myproject.TimerView
android:id=@+id/timer
android:layout_width=wrap_content
android:layout_height=wrap_content /

/RelativeLayout

TimerView class:

public class TimerView extends View
{

 // Constructors
 public TimerView(Context context)
 {
  super(context);
  init();
 }

 public TimerView(Context context, AttributeSet attrs)
 {
  super(context, attrs);
  init();
 }


 @Override
 protected void onDraw(Canvas canvas)
 {
//code
 }

}

What am I doing wrong ?

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Custom Views Timerview

2009-10-01 Thread andr0id

I figured it out, the problem wasn't coming from this piece of code,
my bad..


On 1 oct, 15:53, Gopal Biyani gopalbiy...@gmail.com wrote:
 If you can send the exact exception from log cat, then it will be easy to
 find error.

 On Thu, Oct 1, 2009 at 8:42 AM, andr0id sgrang...@gmail.com wrote:

  Hi everyone,

  I've made a simple countdown timer and I would like to use it as a
  custom view in my xml layout.

  The view works perfectly well if i add it manually like this:

  this.myTimerView = new TimerView(this);
  layout.addView(myTimerView);

  However when I use it in the xml file, the program crashes. This is
  what i've done:

  XML:

  RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
  android
         android:id=@+id/layout
     android:orientation=vertical
     android:layout_width=fill_parent
     android:layout_height=fill_parent

         ImageView
         android:id=@+id/imgv /

         TextView
         android:id=@+id/txtv /

         com.myproject.TimerView
         android:id=@+id/timer
         android:layout_width=wrap_content
         android:layout_height=wrap_content /

  /RelativeLayout

  TimerView class:

  public class TimerView extends View
  {

      // Constructors
      public TimerView(Context context)
      {
           super(context);
           init();
      }

      public TimerView(Context context, AttributeSet attrs)
      {
           super(context, attrs);
           init();
      }

      @Override
      protected void onDraw(Canvas canvas)
      {
             //code
      }

  }

  What am I doing wrong ?

  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to use motion events with multiple layouts

2009-10-07 Thread andr0id

Could you be a little more specific on how to register the
motionListeners ?

I declare the gesture detector at the top of my program like so:
private GestureDetector gestureScanner;

and  just before loading the layout that uses motion detectors i have
this: gestureScanner = new GestureDetector(this);

I define what must be done for a single tap like so:

@Override
public boolean onSingleTapUp(MotionEvent e)
{
   // do something
}

Thanks for the help.

On 7 sep, 19:29, Isuru danagalle iisuru@gmail.com wrote:
 Register your motionListeners with layouts.You can use layout id in the
 layout.xml file

 Thanks
 Isuru

 On Mon, Sep 7, 2009 at 10:42 PM, andr0id sgrang...@gmail.com wrote:

  Please help me.

  Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] invalid username and password when trying to unlock g2

2009-10-14 Thread andr0id

Hi all,

I know this is not really the place to post this message, but this is
the closest thing I could find to google android support.

So a friend of mine did too many wrong patterns and the phone is
asking for my username and password.

When i fill in my login and password, it says invalid username or
password. I tried it like 20 times.I have of course verified the
username and password on my gmail, and it works fine.

Has this ever happened to anyone ? Is there a way around it ?

I refuse to reset my phone to factory settings, i have all my
contacts, and important notes in there...

I was really looking forward to android, but stuff like this is just
unacceptable, really disappointing...

Please help me.

Regards,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to use motion events with multiple layouts

2009-08-24 Thread andr0id

Hi everyone, I'm beginning in android development, and I've stumbled
upon a problem.

My application has different layouts stored in xml files, and I use
motion events such as onFling or onSingleTapup.
These motion events seem to apply whatever layout i'm in.

My problem is simply identifying which layout i'm currently using so I
can define the appropriate action.

I guess what i'm trying to do is a bit like this:

@Override
public boolean onSingleTapUp(MotionEvent e)
{
if(using main layout)
{
//do this
}
   else if (using settings layout)
{
  // do that
}
return false;
}

Is this the right way to do things ?

Thanks for the much needed help !

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to use motion events with multiple layouts

2009-08-24 Thread andr0id

Hi everyone, I'm beginning in android development, and I've stumbled
upon a problem.

My application has different layouts stored in xml files, and I use
motion events such as onFling or onSingleTapup.
These motion events seem to apply whatever layout i'm in.

My problem is simply identifying which layout i'm currently using so I
can define the appropriate action.

I guess what i'm trying to do is a bit like this:

@Override
public boolean onSingleTapUp(MotionEvent e)
{
   if(using main layout)
   {
   //do this
   }
  else if (using settings layout)
   {
 // do that
   }
   return false;
}

Is this the right way to do things ?

Thanks for the much needed help !

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to use motion events with multiple layouts

2009-09-07 Thread andr0id

Please help me.

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---