[android-developers] Better way to debug when there is jar dependancies?

2009-04-16 Thread Bin Chen

My application app depends on jar_a, which depends on jar_b. Now I
want to debug jar_b by changing it's code. Both the jar_a and jar_b is
built by ant tool. So my process is:

1) change jar_b
2) build jar_b
3) copy jar_b to the lib/ directory of jar_a
4) build jar_a
5) delete the reference to jar_a and jar_b in eclipse (Properties of
project) of app
6) re add the jar_a and jar_b into the eclipse

It's really painful, I don't know if I am doing the right way?

Thanks.
Bin
--~--~-~--~~~---~--~~
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] What the difference of this pointer?

2009-04-15 Thread Bin Chen

I see some of the examples contain such code to refer to this
pointer:

mProgressDialog = new ProgressDialog(AlertDialogSamples.this);

So this usage has some special meaning other than the standalone
this?

Thanks.
Bin
--~--~-~--~~~---~--~~
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: Can't use the findViewById() in an second view

2009-04-15 Thread Bin Chen

It's weird, if I change the code into:

new 
DialogInterface.OnClickListener() {
public void 
onClick(DialogInterface dialog,

int whichButton) {
String 
user;
String 
password;


setContentView(R.layout.alert_dialog_text_entry);

EditText user_edit = (EditText)findViewById
(R.id.username_edit);

EditText password_edit = (EditText)findViewById
(R.id.password_edit);
user = 
user_edit.getText().toString();

setContentView(R.layout.main);
}

Then the button in the main view has no effect at all, is it a bug? Or
the way I do is wrong?

On Apr 15, 5:16 pm, Bin Chen binary.c...@gmail.com wrote:
 Sovled by adding a setContentView()...

 On Apr 15, 5:10 pm, Bin Chen binary.c...@gmail.com wrote:

  I have a main.xml as the main view and another
  alert_dialog_text_entry.xml for one dialog when a button is clicked in
  the main.xml view. In the click handler of the button, the findViewById
  () can't work, the returned vaule is null, the code is like this:

          protected Dialog onCreateDialog(int id) {
                  switch (id) {
                  case DIALOG_ACCOUNT_SETTING:
                          LayoutInflater factory = 
  LayoutInflater.from(mymsn.GetContext());
                          View textEntryView = factory.inflate(
                                          R.layout.alert_dialog_text_entry, 
  null);
                          return new AlertDialog.Builder(this)
                                          .setIcon(R.drawable.icon)
                                          
  .setTitle(R.string.alert_dialog_text_entry)
                                          .setView(textEntryView)
                                          
  .setPositiveButton(R.string.alert_dialog_ok,
                                                          new 
  DialogInterface.OnClickListener() {
                                                                  public void 
  onClick(DialogInterface dialog,
                                                                              
      int whichButton) {
                                                                          
  String user;
                                                                          
  String password;

                                                                          
  EditText user_edit = (EditText)findViewById
  (R.id.username_edit);
                                                                          
  EditText password_edit = (EditText)findViewById
  (R.id.password_edit);
                                                                          
  user = user_edit.getText().toString();

                                                                  }
                                                          })
                                          
  .setNegativeButton(R.string.alert_dialog_cancel,
                                                          new 
  DialogInterface.OnClickListener() {
                                                                  public void 
  onClick(DialogInterface dialog,
                                                                              
      int whichButton) {
                                                                  }
                                                          })
                                          .create();
                  }

  The alert_dialog_text_entry.xml:

  LinearLayout xmlns:android=http://schemas.android.com/apk/res/
  android
      android:layout_width=fill_parent
      android:layout_height=wrap_content
      android:orientation=vertical

      TextView
          android:id=@+id/username_view
          android:layout_height=wrap_content
          android:layout_width=wrap_content
          android:layout_marginLeft=20dip
          android:layout_marginRight=20dip
          android:text=@string/alert_dialog_username
          android:gravity=left
          android:textAppearance=?android:attr/textAppearanceMedium /

      EditText
          android:id=@+id/username_edit
          android:layout_height=wrap_content
          android:layout_width=fill_parent
          android:layout_marginLeft=20dip
          android:layout_marginRight=20dip

[android-developers] Can't use the findViewById() in an second view

2009-04-15 Thread Bin Chen

I have a main.xml as the main view and another
alert_dialog_text_entry.xml for one dialog when a button is clicked in
the main.xml view. In the click handler of the button, the findViewById
() can't work, the returned vaule is null, the code is like this:

protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_ACCOUNT_SETTING:
LayoutInflater factory = 
LayoutInflater.from(mymsn.GetContext());
View textEntryView = factory.inflate(
R.layout.alert_dialog_text_entry, null);
return new AlertDialog.Builder(this)
.setIcon(R.drawable.icon)

.setTitle(R.string.alert_dialog_text_entry)
.setView(textEntryView)

.setPositiveButton(R.string.alert_dialog_ok,
new 
DialogInterface.OnClickListener() {
public void 
onClick(DialogInterface dialog,

int whichButton) {
String 
user;
String 
password;


EditText user_edit = (EditText)findViewById
(R.id.username_edit);

EditText password_edit = (EditText)findViewById
(R.id.password_edit);
user = 
user_edit.getText().toString();

}
})

.setNegativeButton(R.string.alert_dialog_cancel,
new 
DialogInterface.OnClickListener() {
public void 
onClick(DialogInterface dialog,

int whichButton) {
}
})
.create();
}

The alert_dialog_text_entry.xml:

LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=wrap_content
android:orientation=vertical

TextView
android:id=@+id/username_view
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_marginLeft=20dip
android:layout_marginRight=20dip
android:text=@string/alert_dialog_username
android:gravity=left
android:textAppearance=?android:attr/textAppearanceMedium /

EditText
android:id=@+id/username_edit
android:layout_height=wrap_content
android:layout_width=fill_parent
android:layout_marginLeft=20dip
android:layout_marginRight=20dip
android:scrollHorizontally=true
android:autoText=false
android:capitalize=none
android:gravity=fill_horizontal
android:textAppearance=?android:attr/textAppearanceMedium /

TextView
android:id=@+id/password_view
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_marginLeft=20dip
android:layout_marginRight=20dip
android:text=@string/alert_dialog_password
android:gravity=left
android:textAppearance=?android:attr/textAppearanceMedium /

EditText
android:id=@+id/password_edit
android:layout_height=wrap_content
android:layout_width=fill_parent
android:layout_marginLeft=20dip
android:layout_marginRight=20dip
android:scrollHorizontally=true
android:autoText=false
android:capitalize=none
android:gravity=fill_horizontal
android:password=true
android:textAppearance=?android:attr/textAppearanceMedium /

--~--~-~--~~~---~--~~
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: Can't use the findViewById() in an second view

2009-04-15 Thread Bin Chen
Sovled by adding a setContentView()...

On Apr 15, 5:10 pm, Bin Chen binary.c...@gmail.com wrote:
 I have a main.xml as the main view and another
 alert_dialog_text_entry.xml for one dialog when a button is clicked in
 the main.xml view. In the click handler of the button, the findViewById
 () can't work, the returned vaule is null, the code is like this:

         protected Dialog onCreateDialog(int id) {
                 switch (id) {
                 case DIALOG_ACCOUNT_SETTING:
                         LayoutInflater factory = 
 LayoutInflater.from(mymsn.GetContext());
                         View textEntryView = factory.inflate(
                                         R.layout.alert_dialog_text_entry, 
 null);
                         return new AlertDialog.Builder(this)
                                         .setIcon(R.drawable.icon)
                                         
 .setTitle(R.string.alert_dialog_text_entry)
                                         .setView(textEntryView)
                                         
 .setPositiveButton(R.string.alert_dialog_ok,
                                                         new 
 DialogInterface.OnClickListener() {
                                                                 public void 
 onClick(DialogInterface dialog,
                                                                               
   int whichButton) {
                                                                         
 String user;
                                                                         
 String password;

                                                                         
 EditText user_edit = (EditText)findViewById
 (R.id.username_edit);
                                                                         
 EditText password_edit = (EditText)findViewById
 (R.id.password_edit);
                                                                         user 
 = user_edit.getText().toString();

                                                                 }
                                                         })
                                         
 .setNegativeButton(R.string.alert_dialog_cancel,
                                                         new 
 DialogInterface.OnClickListener() {
                                                                 public void 
 onClick(DialogInterface dialog,
                                                                               
   int whichButton) {
                                                                 }
                                                         })
                                         .create();
                 }

 The alert_dialog_text_entry.xml:

 LinearLayout xmlns:android=http://schemas.android.com/apk/res/
 android
     android:layout_width=fill_parent
     android:layout_height=wrap_content
     android:orientation=vertical

     TextView
         android:id=@+id/username_view
         android:layout_height=wrap_content
         android:layout_width=wrap_content
         android:layout_marginLeft=20dip
         android:layout_marginRight=20dip
         android:text=@string/alert_dialog_username
         android:gravity=left
         android:textAppearance=?android:attr/textAppearanceMedium /

     EditText
         android:id=@+id/username_edit
         android:layout_height=wrap_content
         android:layout_width=fill_parent
         android:layout_marginLeft=20dip
         android:layout_marginRight=20dip
         android:scrollHorizontally=true
         android:autoText=false
         android:capitalize=none
         android:gravity=fill_horizontal
         android:textAppearance=?android:attr/textAppearanceMedium /

     TextView
         android:id=@+id/password_view
         android:layout_height=wrap_content
         android:layout_width=wrap_content
         android:layout_marginLeft=20dip
         android:layout_marginRight=20dip
         android:text=@string/alert_dialog_password
         android:gravity=left
         android:textAppearance=?android:attr/textAppearanceMedium /

     EditText
         android:id=@+id/password_edit
         android:layout_height=wrap_content
         android:layout_width=fill_parent
         android:layout_marginLeft=20dip
         android:layout_marginRight=20dip
         android:scrollHorizontally=true
         android:autoText=false
         android:capitalize=none
         android:gravity=fill_horizontal
         android:password=true
         android:textAppearance=?android:attr/textAppearanceMedium /
--~--~-~--~~~---~--~~
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

[android-developers] Re: Can't use the findViewById() in an second view

2009-04-15 Thread Bin Chen
Finally I resolved this problem by invoking the flattened view's
findViewById(), hope this can be helpful for others.

On Apr 15, 5:20 pm, Bin Chen binary.c...@gmail.com wrote:
 It's weird, if I change the code into:

                                                         new 
 DialogInterface.OnClickListener() {
                                                                 public void 
 onClick(DialogInterface dialog,
                                                                               
   int whichButton) {
                                                                         
 String user;
                                                                         
 String password;

                                                                         
 setContentView(R.layout.alert_dialog_text_entry);
                                                                         
 EditText user_edit = (EditText)findViewById
 (R.id.username_edit);
                                                                         
 EditText password_edit = (EditText)findViewById
 (R.id.password_edit);
                                                                         user 
 = user_edit.getText().toString();
                                                                         
 setContentView(R.layout.main);
                                                                 }

 Then the button in the main view has no effect at all, is it a bug? Or
 the way I do is wrong?

 On Apr 15, 5:16 pm, Bin Chen binary.c...@gmail.com wrote:

  Sovled by adding a setContentView()...

  On Apr 15, 5:10 pm, Bin Chen binary.c...@gmail.com wrote:

   I have a main.xml as the main view and another
   alert_dialog_text_entry.xml for one dialog when a button is clicked in
   the main.xml view. In the click handler of the button, the findViewById
   () can't work, the returned vaule is null, the code is like this:

           protected Dialog onCreateDialog(int id) {
                   switch (id) {
                   case DIALOG_ACCOUNT_SETTING:
                           LayoutInflater factory = 
   LayoutInflater.from(mymsn.GetContext());
                           View textEntryView = factory.inflate(
                                           R.layout.alert_dialog_text_entry, 
   null);
                           return new AlertDialog.Builder(this)
                                           .setIcon(R.drawable.icon)
                                           
   .setTitle(R.string.alert_dialog_text_entry)
                                           .setView(textEntryView)
                                           
   .setPositiveButton(R.string.alert_dialog_ok,
                                                           new 
   DialogInterface.OnClickListener() {
                                                                   public 
   void onClick(DialogInterface dialog,
                                                                             
         int whichButton) {
                                                                           
   String user;
                                                                           
   String password;

                                                                           
   EditText user_edit = (EditText)findViewById
   (R.id.username_edit);
                                                                           
   EditText password_edit = (EditText)findViewById
   (R.id.password_edit);
                                                                           
   user = user_edit.getText().toString();

                                                                   }
                                                           })
                                           
   .setNegativeButton(R.string.alert_dialog_cancel,
                                                           new 
   DialogInterface.OnClickListener() {
                                                                   public 
   void onClick(DialogInterface dialog,
                                                                             
         int whichButton) {
                                                                   }
                                                           })
                                           .create();
                   }

   The alert_dialog_text_entry.xml:

   LinearLayout xmlns:android=http://schemas.android.com/apk/res/
   android
       android:layout_width=fill_parent
       android:layout_height=wrap_content
       android:orientation=vertical

       TextView
           android:id=@+id/username_view
           android:layout_height=wrap_content
           android:layout_width=wrap_content
           android:layout_marginLeft=20dip
           android:layout_marginRight=20dip
           android:text=@string/alert_dialog_username
           android:gravity=left
           android:textAppearance

[android-developers] Can I use UNIQUE in the query() parameter?

2009-04-12 Thread Bin Chen

My contacts contain a lot of duplicated records, I want to use the
traditional SQL clause UNIQUE to get the unique records, is it
doable thru the query() method call? Thanks. I tried with the
selectionArgs argument but failed.

Bin
--~--~-~--~~~---~--~~
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] Embed Contacts activity

2009-04-12 Thread Bin Chen

I seached this forum and someone said for the security reason, we can
only embed the activity we own, but I am wondering how the phone app
embeds the activity from contacts? Is there any tricks for that?

Thanks.
Bin
--~--~-~--~~~---~--~~
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 can the user event callback be invoked?

2009-04-02 Thread Bin Chen

See:

public class CompassActivity extends Activity implements Renderer,
SensorEventListener {

The CompassActivity implements SensorEventListener  and override the
onSensorChanged() method. I am curious when the hardware accelerator
is moving, how can the system invoke this callback? I mean how can the
Compass application register itself to the system so that the system
can know it has the registered callback need to be notified when the
events happen?

Thanks.
Bin
--~--~-~--~~~---~--~~
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] Some of the strange JAVA syntax - android specifics?

2009-04-01 Thread Bin Chen

I am a C programmer before, and I am looking into android source code
right now, some JAVA syntax is confusing, I am not sure whether or not
it's android related, see:

@Override
protected void onDraw(Canvas canvas) {
synchronized (this) {
if (mBitmap != null) {
final Paint paint = mPaint;
final Path path = mPath;
final int outer = 0xFFC0C0C0;
final int inner = 0xFFff7010;

1) What's the meaning of Override? Is it ommitable?
2) What does the synchronized mean?

Thanks.
Bin

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