[android-beginners] Re: Question Regarding the Background Menu

2009-08-09 Thread Hamed3d

Thank u so much Liviu, I will try it and see if it works..



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



[android-beginners] Newbie to Java needing some help!

2009-08-09 Thread Hugh

My code is quite simple. When the gunbutton is pressed it should check
that there are bullets left. If so, it should check wether the
silencer is on or off, if its off it should bang and if its on it
should be a quiet bang. If there are no bulelts left it should make a
ammo_out noise.

It counts ammo correctly but the silencer is always on, despite me
declaring it as off. Please help!

The code is as follows:

package hand.gun.app;

import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;


public class HandGunApp extends Activity {

private int roundsleft = 6;
private MediaPlayer gunreload, gunshot, ammo_out, silencedgunshot;
public boolean silenceron = false;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


ImageButton GunButton = (ImageButton)findViewById
(R.id.GunButton);
gunshot = MediaPlayer.create(this, R.raw.gunshot);
ammo_out = MediaPlayer.create(this, R.raw.ammo_out);
gunreload = MediaPlayer.create(this, R.raw.gunreload);
silencedgunshot = MediaPlayer.create(this,
R.raw.silencedpistol);


GunButton.setOnClickListener(new OnClickListener() {
MediaPlayer mp;
@Override
public void onClick(View arg0) {
if (roundsleft = 0)
{
mp = ammo_out;
mp.seekTo(0);
mp.start();
}
else
{
if (silenceron = false)
{
mp = gunshot;
mp.seekTo(0);
roundsleft = roundsleft - 1;
mp.start();
}
else
{
mp = silencedgunshot;
mp.seekTo(0);
roundsleft = roundsleft - 1;
mp.start();
}
 }
ImageButton ReloadButton = (ImageButton)findViewById
(R.id.Reload);
ReloadButton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0)
{
roundsleft = 6;
mp = gunreload;
mp.seekTo(0);
mp.start();
}
});
ImageButton SilencerButton = (ImageButton)findViewById
(R.id.Silencer);
SilencerButton.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
 if (silenceron = true) /** If the Silencer is on this
should turn it off */
 {
 silenceron = false;
 mp = gunreload;
 mp.seekTo(0);
 mp.start();
 }else{
 silenceron = true; /** If the Silencer is off this
should turn it on */
 mp = gunreload;
 mp.seekTo(0);
 mp.start();
 }
 }
 }

/** Insert other buttons in here */

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



[android-beginners] HD Family Club -- download HD DVD Movies with rapidshare, megaupload, torrent link ... 100% free?

2009-08-09 Thread Huynh Nhu Thuy


HD Family Club -- download HD DVD Movies with rapidshare, megaupload,
torrent link ... 100% free


Fast and Furious (2009) RAPIDSHARE LINK; torrent, megaupload,
mediafire link  Download now!
http://hd-family.blogspot.com/2009/06/fast-and-furious-4-2009.html


Downloadd Transformers 2009 NOW with RAPIDSHARE LINK:
http://hd-family.blogspot.com/2009/08/transformers-2-revenge-of-fallen-2009.html


21.twenty.one.2008.m-HD.x264 - RAPIDSHARE LINK
http://hd-family.blogspot.com/2009/08/21twentyone2008m-hdx264-rapidshare.html


Michael Jackson - The Memorial 1958-2009 - HDTV XviD-2HD  ---
RAPIDSHARE LINK
http://hd-family.blogspot.com/2009/07/michael-jackson-memorial-1958-2009-hdtv.html


Transformers 2 Revenge of The Fallen (hot of 2009)
http://hd-family.blogspot.com/2009/06/transformers-revenge-of-fallen.html


More and more here:
Home page: http://hd-family.blogspot.com/

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



[android-beginners] Re: Newbie to Java needing some help!

2009-08-09 Thread Casper Bang

Your problem is a classic one in Java, on this line:

 if (silenceron = true) /** If the Silencer is on this

...you are effectively testing whether you can assign the boolean
value true to silenceon, which you always can (hence it's always
true). Add another equals to test whether sileneron is equal to true.

/Casper

On 9 Aug., 11:37, Hugh lordhornb...@googlemail.com wrote:
 My code is quite simple. When the gunbutton is pressed it should check
 that there are bullets left. If so, it should check wether the
 silencer is on or off, if its off it should bang and if its on it
 should be a quiet bang. If there are no bulelts left it should make a
 ammo_out noise.

 It counts ammo correctly but the silencer is always on, despite me
 declaring it as off. Please help!

 The code is as follows:

 package hand.gun.app;

 import android.app.Activity;
 import android.media.MediaPlayer;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.ImageButton;

 public class HandGunApp extends Activity {

     private int roundsleft = 6;
     private MediaPlayer gunreload, gunshot, ammo_out, silencedgunshot;
     public boolean silenceron = false;

         /** Called when the activity is first created. */
     @Override
         public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

         ImageButton GunButton = (ImageButton)findViewById
 (R.id.GunButton);
         gunshot = MediaPlayer.create(this, R.raw.gunshot);
         ammo_out = MediaPlayer.create(this, R.raw.ammo_out);
         gunreload = MediaPlayer.create(this, R.raw.gunreload);
         silencedgunshot = MediaPlayer.create(this,
 R.raw.silencedpistol);

         GunButton.setOnClickListener(new OnClickListener() {
         MediaPlayer mp;
             @Override
             public void onClick(View arg0) {
                 if (roundsleft = 0)
                 {
                     mp = ammo_out;
                     mp.seekTo(0);
                     mp.start();
                 }
                 else
                 {
                     if (silenceron = false)
                     {
                             mp = gunshot;
                             mp.seekTo(0);
                     roundsleft = roundsleft - 1;
                     mp.start();
                     }
                     else
                     {
                     mp = silencedgunshot;
                     mp.seekTo(0);
                     roundsleft = roundsleft - 1;
                     mp.start();
                     }
                  }
             ImageButton ReloadButton = (ImageButton)findViewById
 (R.id.Reload);
             ReloadButton.setOnClickListener(new OnClickListener() {

             @Override
             public void onClick(View arg0)
             {
             roundsleft = 6;
             mp = gunreload;
             mp.seekTo(0);
             mp.start();
             }
             });
             ImageButton SilencerButton = (ImageButton)findViewById
 (R.id.Silencer);
             SilencerButton.setOnClickListener(new OnClickListener()
             {
                         @Override
             public void onClick(View arg0)
             {
              if (silenceron = true) /** If the Silencer is on this
 should turn it off */
                  {
                  silenceron = false;
                  mp = gunreload;
                  mp.seekTo(0);
                  mp.start();
              }else{
                  silenceron = true; /** If the Silencer is off this
 should turn it on */
                  mp = gunreload;
                  mp.seekTo(0);
                  mp.start();
              }
              }
              }

             /** Insert other buttons in here */

         );
       };
     });
   }

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



[android-beginners] Re: Newbie to Java needing some help!

2009-08-09 Thread Hugh

Damn, now i feel stupid.

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



[android-beginners] Re: Newbie to Java needing some help!

2009-08-09 Thread Abhiram Alamuru
Not a problem. If you are new to Java and eclipse, I would suggest you use
eclipse debugger which will step through your code and you can see what the
value of the variable is at every step of the code. That way you'd notice
the variable value change right after the 'if' statement.

On Sun, Aug 9, 2009 at 9:02 AM, Hugh lordhornb...@googlemail.com wrote:


 Damn, now i feel stupid.

 Thanks Guys! :)
 



-- 
Abhiram Alamuru

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



[android-beginners] Re: Pictures and EXIF data

2009-08-09 Thread Abhiram Alamuru
Regarding the question about libraries, if I do use a third party library,
shouldn't it be possible to package the jar in my apk so that I can use it
on my android enabled phone? There are a lot of open source java libraries
which can come in useful.

On Sat, Aug 8, 2009 at 4:47 PM, Mark Murphy mmur...@commonsware.com wrote:


 tinyang wrote:
  Thanks Mark, looks good!  Is it possible to incorporate purely
  java/non-android libraries into an android app?

 Possible, yes. Not all libraries will compile, because they require APIs
 not available on Android.

  Does the G1 not have a built-in option for geotagging a picture taken
 with
  the camera already?

 I have not seen one; then again, I have not really looked.

  Also, Are there any code examples one might recommend for taking a
 picture
  with your app/calling the camera library?

 The SDK ships with some camera examples.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://twitter.com/commonsguy

 Warescription: Three Android Books, Plus Updates, $35/Year

 



-- 
Abhiram Alamuru

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



[android-beginners] Re: Pictures and EXIF data

2009-08-09 Thread Mark Murphy

Abhiram Alamuru wrote:
 Regarding the question about libraries, if I do use a third party
 library, shouldn't it be possible to package the jar in my apk so that I
 can use it on my android enabled phone?

As I wrote:

 Not all libraries will compile, because they require APIs not
 available on Android.

Case in point: Android does not have all of the classes in the
java.beans package, for various possible reasons (space, missing
capabilities in Dalvik, too much maintenance work, no demand, etc.). If
the third-party library needs classes in java.beans that are not in
Android, it will not work without modification.

With open source third-party libraries, all problems like this are
solvable, given sufficient time and Red Bull.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 In Print!

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



[android-beginners] Re: plz send me example of startActivityForResult in android

2009-08-09 Thread Jack Ha

Take a look at the notepad tutorial:

http://developer.android.com/guide/tutorials/notepad/notepad-ex2.html

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Aug 8, 8:23 am, saurabh sinha saurso...@gmail.com wrote:
 plz send me example of startActivityForResult in android
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] TableLayout problem

2009-08-09 Thread Stefan

Hi,

i have a problem with the TableLayout. I want to put 4 buttons in one
TableRow and i set the size.
But the size of the first button is equal to the size of a TextView in
an other TableRow. Why??

Here's my xml file:
?xml version=1.0 encoding=utf-8?
TableLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=fill_parent
android:layout_height=fill_parent
android:stretchColumns=1
...
...
...
TableRow
TextView
android:text=Abbiegepunkt hinzufügen
android:layout_gravity=left|center/
/TableRow
TableRow

THE NEXT BUTTON HAS THE SIZE OF THE TEXTVIEW ABOVE:

Button
android:id=@+id/left
android:layout_width=60sp
android:layout_height=50sp
android:text=Links/
Button
android:id=@+id/halblinks
android:layout_width=60sp
android:layout_height=50sp
android:text=Halblinks/
Button
android:id=@+id/halbrechts
android:layout_height=50sp
android:text=Halbrechts
android:layout_width=100sp/
Button
android:id=@+id/rechts
android:layout_width=60sp
android:layout_height=50sp
android:text=Rechts /
/TableRow
/TableLayout

I hope somebody can help me.

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



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Mark Murphy

Stefan wrote:
 i have a problem with the TableLayout. I want to put 4 buttons in one
 TableRow and i set the size.
 But the size of the first button is equal to the size of a TextView in
 an other TableRow. Why??

TableLayout works like HTML tables -- the column widths are set by their
contents. The width of your first column will be the maximum width among
all of the first items in each row. The first item in your first row is
the TextView, and the first item in the second row is the first Button.
Whichever of those is wider (presumably the TextView) will determine the
width of the column.

Moreover:

The children of a TableRow do not need to specify the layout_width and
layout_height attributes in the XML file. TableRow always enforces those
values to be respectively FILL_PARENT and WRAP_CONTENT.

(from http://developer.android.com/reference/android/widget/TableRow.html)

Hence, the smaller widgets in the column will expand to fill the space
set aside by the largest widget.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.0 Available!

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



[android-beginners] Re: setLayoutParams on a TextView prevents TextView from being displayed

2009-08-09 Thread Jack Ha

Add the following line in your code:

results_table.setColumnShrinkable(0, true);

And comment out the descripton_e.setLayoutParams() line as your
mentioned.

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Aug 8, 1:52 pm, Stu stuart.gilb...@gmail.com wrote:
 I'm populating a TableLayout with TableRows containing a TextView
 each. I want the TextViews to FILL_PARENT width and WRAP_CONTENT on
 the height.

 If I don't specify any LayoutParams for the TextView then it shows up
 in the emulator all on one line going off the screen on the right.

 If I specify some LayoutParams like the ones below then absolutely no
 text shows up whatsoever:

 description_element.setLayoutParams(new LayoutParams
 (LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

 I'll paste the relevant code (it gets looped over for a number of
 JSONObjects)

 //CODE BEGINS HERE
 // Create a new TableRow element.
 TableRow description_row = new TableRow(this);
 description_row.setLayoutParams(new LayoutParams
 (LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

 // Create the new textview for the list and style it.
 TextView description_e = new TextView(this);
 description_e.setLayoutParams(new LayoutParams
 (LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
 description_e.setText(description);
 description_e.setPadding(0, 3, 0, 1);

 // Put the TextView into the row and the row into the table.
 description_row.addView(description_e);
 results_table.addView(description_row, new TableLayout.LayoutParams(
         LayoutParams.FILL_PARENT,
         LayoutParams.WRAP_CONTENT));
 //CODE ENDS HERE

 That code results in the none of the TextViews showing up.

 Commenting the descripton_e.setLayoutParams line results in single-
 line TextViews that overshoot the screen width.

 Adding something like description_e.setWidth(240) results in the
 TextView being multiple lines, but obviously at a fixed width, which
 isn't really much use to me.

 Has anyone encountered this before, or does anyone have any ideas/
 suggestions?

 I'll post my layout file below in case that has anything to do with
 it:

 ?xml version=1.0 encoding=utf-8?
 TableLayout xmlns:android=http://schemas.android.com/apk/res/
 android
     android:layout_width=fill_parent
     android:layout_height=fill_parent
     android:stretchColumns=0
     android:padding=10sp
     TableRow
         TextView
                 android:id=@+id/showName /
     /TableRow
     TableRow
         android:layout_width=fill_parent
         ScrollView
                 android:id=@+id/resultsScrollView
                 android:layout_width=fill_parent
                 android:layout_height=wrap_content
                 android:layout_span=2
                 TableLayout
                         android:id=@+id/showResults
                         android:layout_width=fill_parent
                         android:layout_height=wrap_content
                 /TableLayout
         /ScrollView
         /TableRow
 /TableLayout

 Any help or suggestions will be thankfully received as this is driving
 me crazy!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: How to share data between the program that launches the thread and the thread itself?

2009-08-09 Thread Jack Ha

You may declare pippo outside of onCreate(). Appropriate locking is
needed for shared variable.

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Aug 7, 2:43 am, Android Beginner codesys.cano...@gmail.com wrote:
 Sorry... must be a very easy question... otherwise I would't be a real
 Android Beginner... :-)

 How to share the variable pippo between the program that launches the
 thread and the thread itself?

 @Override
 public void onCreate() {
         super.onCreate();
         int pippo = 5;
         new Timer().scheduleAtFixedRate(new TimerTask() {
                 public void run() {pippo;
         };};},0,1000);

 This is the result of the compiler...

 Cannot refer to a non-final variable pippo inside an inner class
 defined in a different method.

 Many thanks in advance.
 Regards

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



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Stefan

Hi,
thanks for the fast answer. I try to create a UI with DroidDraw, but
its very difficult to get the right position of the widgets.
I think I will try it now with the RelativeLayout.

Thanks,
Stefan


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



[android-beginners] Re: Accelerometer and dpad

2009-08-09 Thread Jack Ha

The accelerometer supports three axes of rotation: forward-backward,
left-right, and up-down.

Take a look at his sensor simulator:

http://code.google.com/p/openintents/wiki/SensorSimulator

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Aug 6, 3:37 pm, Steeler cowboyd...@yahoo.com wrote:
 I want to include accelerometer support in my app, but the
 documentation seemed pretty spotty. How many axes of rotation does the
 accelerometer support, and how do you differentiate between the axes?

 Also, do *any* current Android phones actually have a dpad? The
 emulator's not as useful as it could be if it doesn't have any
 emulation of the accelerometer (if it does, please let me know) and
 has a dpad instead of the real-life trackball.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Android general question

2009-08-09 Thread tinyang
For each class/activity created in an application, does a separate xml file
need to be created for the gui layout?
 
-- 
:-) 
P Please don't print this e-mail unless you really need to. 
 
 http://www.crossloop.com/Teenah 

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



[android-beginners] Re: Android general question

2009-08-09 Thread Mark Murphy

tinyang wrote:
 For each class/activity created in an application, does a separate xml
 file need to be created for the gui layout?

Not necessarily. Multiple activities can share a layout if they all look
the same. One activity might use many layout files (one for the overall
screen, one for rows in a ListView, etc.).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

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



[android-beginners] Re: Android general question

2009-08-09 Thread tinyang

Thanks Mark for the reply.  Does that then mean that FindViewById searches
all xml files to find the correct view? 

-Original Message-
From: android-beginners@googlegroups.com
[mailto:android-beginn...@googlegroups.com] On Behalf Of Mark Murphy
Sent: Sunday, August 09, 2009 2:34 PM
To: android-beginners@googlegroups.com
Subject: [android-beginners] Re: Android general question


tinyang wrote:
 For each class/activity created in an application, does a separate xml 
 file need to be created for the gui layout?

Not necessarily. Multiple activities can share a layout if they all look the
same. One activity might use many layout files (one for the overall screen,
one for rows in a ListView, etc.).

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org


No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.169 / Virus Database: 270.13.24/2255 - Release Date: 8/8/2009
6:17 PM


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



[android-beginners] Re: Android general question

2009-08-09 Thread Mark Murphy

tinyang wrote:
 Thanks Mark for the reply.  Does that then mean that FindViewById searches
 all xml files to find the correct view? 

No, calling findViewById() on an Activity searches the layout you
provided in setContentView().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

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



[android-beginners] Center an element

2009-08-09 Thread tinyang
Hi, when formatting the layout in xml, how do I center an element?  I looked
in Declaring layout section of the dev guide, but I only saw ways to define
an absolute postion.  Is there a way to center an element so that if the
orientation is changes or the activity is viewed on a different sized
screen/device, it can auto center itself?
 
-- 
:-) 
P Please don't print this e-mail unless you really need to. 
 
 http://www.crossloop.com/Teenah 

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



[android-beginners] Re: Center an element

2009-08-09 Thread Mark Murphy

tinyang wrote:
 Hi, when formatting the layout in xml, how do I center an element?  I
 looked in Declaring layout section of the dev guide, but I only saw ways
 to define an absolute postion.  Is there a way to center an element so
 that if the orientation is changes or the activity is viewed on a
 different sized screen/device, it can auto center itself?

Put it inside a RelativeLayout and use android:layout_centerInParent=true.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 In Print!

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



[android-beginners] Struggling with google maps

2009-08-09 Thread trostum

Hi.

I was following this tutorial: 
http://mobiforge.com/developing/story/using-google-maps-android
on creating map activities, Now i am unable to understand why my
application crashes. I get a NoClassDefFoundError and that exception
is caused by a  Caused by: java.lang.IllegalAccessError: cross-loader
access from pre-verified class.

Now i have added the uses-library
android:name=com.google.android.maps / as a child element to my
aplication and
uses-permission
android:name=android.permission.ACCESS_FINE_LOCATION/uses-
permission and
uses-permission android:name=android.permission.INTERNET/
as children of the Manifest element.

My avd is running on api level 4 with the google apis.

What is wrong? i have searched the web, but nnot found a solution to
my problem.

Appreciate any thoughts or comments on what might be wrong
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Stefan

Hi,

i take a look in your, Mark M., book (Busy coders guide to android
development 2nd version) and I try to change your RelativeLayout
example in my own xml layout file. But all widgets (Buttons, TextView,
EditText) are in one row and they lie on top of each other.

I have not much experience with the layout files, but i think their
can not be very much wrong??

Here my new xml file:
?xml version=1.0 encoding=utf-8?
RelativeLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=fill_parent
android:layout_height=wrap_content

TextView
android:id=@+id/ep
android:text=erfasste Punkte:
android:layout_width=wrap_content
android:layout_height=wrap_content/

   SHOULD BE RIGHT OF THE TXTVIEW
EditText
android:id=@+id/epe
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=0
android:layout_toRightOf=@id/ep
android:layout_alignBaseline=@id/ep/

SHOULD BE UNDER THE FIRST TEXTVIEW
TextView
android:id=@+id/ak
android:text=aktuelle km:
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_below=@id/epe
android:layout_alignRight=@id/epe/


SHOULD BE RIGHT OF THE SECOND TEXTVIEW
EditText
android:id=@+id/ake
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_toRightOf=@id/ak
android:layout_alignBaseline=@id/ak
android:text=0/

  UNDER THE SECOND TEXTVIEW
  TextView
android:id=@+id/ab
android:text=Abbiegepunkt hinzufügen
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_below=@id/ak
android:layout_alignRight=@id/ak
/
UNDER THE THIRD TEXTVIEW AND THAN ALL 4 BUTTONS IN ONE
ROW
Button
android:id=@+id/left
android:layout_width=wrap_content
android:layout_height=wrap_content
android:text=Links
android:layout_below=@id/ab
android:layout_alignLeft=@id/ab/

   RIGHT OF THE FIRST BUTTON
Button
android:id=@+id/halblinks
android:layout_width=wrap_content
android:layout_height=wrap_content
android:text=Halblinks
android:layout_toRightOf=@id/left
android:layout_alignTop=@id/left/
Button
android:id=@+id/halbrechts
android:layout_width=wrap_content
android:layout_height=wrap_content
android:text=Halbrechts
android:layout_toRightOf=@id/halblinks
android:layout_alignTop=@id/left/
Button
android:id=@+id/rechts
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_toRightOf=@id/halbrechts
android:layout_alignTop=@id/left
android:text=Rechts /
/RelativeLayout
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Mark Murphy

Stefan wrote:
 i take a look in your, Mark M., book (Busy coders guide to android
 development 2nd version) and I try to change your RelativeLayout
 example in my own xml layout file. But all widgets (Buttons, TextView,
 EditText) are in one row and they lie on top of each other.

They don't for me. Here is your file, as rendered in Android 1.5r3:

http://imagebin.ca/view/a9G9zjd0.html

Whether or not this look is what you want is another matter, but the
widgets are not in one row. Some are pushed off the screen, but that
is what you told the RelativeLayout to do.

For example:

TextView
android:id=@+id/ak
android:text=aktuelle km:
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_below=@id/epe
android:layout_alignRight=@id/epe/


Your android:layout_alignRight=@id/epe attribute means you want the
*right edge* of @id/ak to align with the *right edge* of @id/epe. That,
in itself, is not necessarily strange. Since @id/epe is set to
fill_parent, it's right edge is the right edge of the screen, and so the
right edge of @id/ak is set to the right edge of the screen.

But then, your next widget has:

EditText
android:id=@+id/ake
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_toRightOf=@id/ak
android:layout_alignBaseline=@id/ak
android:text=0/

Here, you are trying to put @id/ake to right of @id/ak, which will not
work well, since your previous rule set @id/ak to have its right edge on
the right edge of the screen.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, $35/Year

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



[android-beginners] Re: Struggling with google maps

2009-08-09 Thread Jack Ha

Which line in the code that caused the exception? Can you post the
complete stack trace here?

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Aug 9, 2:20 pm, trostum tros...@gmail.com wrote:
 Hi.

 I was following this 
 tutorial:http://mobiforge.com/developing/story/using-google-maps-android
 on creating map activities, Now i am unable to understand why my
 application crashes. I get a NoClassDefFoundError and that exception
 is caused by a  Caused by: java.lang.IllegalAccessError: cross-loader
 access from pre-verified class.

 Now i have added the uses-library
 android:name=com.google.android.maps / as a child element to my
 aplication and
 uses-permission
 android:name=android.permission.ACCESS_FINE_LOCATION/uses-
 permission and
 uses-permission android:name=android.permission.INTERNET/
 as children of the Manifest element.

 My avd is running on api level 4 with the google apis.

 What is wrong? i have searched the web, but nnot found a solution to
 my problem.

 Appreciate any thoughts or comments on what might be wrong
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Stefan

thanks for the fast answer again. i work with the 1.5r3 version, too.
but in eclipse, if i switch in the Layout tab, all widget are in one
row. i don't test it, if I run an app with this layout.
Now I have another view in the DroidDraw application. Thats view has
more to do with my xml file. Now I will continue work with this tool
to correct the mistakes.

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



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Mark Murphy

Stefan wrote:
 thanks for the fast answer again. i work with the 1.5r3 version, too.
 but in eclipse, if i switch in the Layout tab, all widget are in one
 row.

I'd trust the emulator over the Layout tab. But, then again, I don't use
Eclipse...

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Looking for Android opportunities? http://wiki.andmob.org/hado

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



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Stefan

thanks for the fast answer again. i work with the 1.5r3 version, too.
but in eclipse, if i switch in the Layout tab, all widget are in one
row. i don't test it, if I run an app with this layout.
Now I have another view in the DroidDraw application. Thats view has
more to do with my xml file. Now I will continue work with this tool
to correct the mistakes.

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



[android-beginners] Re: TableLayout problem

2009-08-09 Thread Stefan

 But then, your next widget has:

                 EditText
                         android:id=@+id/ake
                         android:layout_width=fill_parent
                         android:layout_height=wrap_content
                         android:layout_toRightOf=@id/ak
                         android:layout_alignBaseline=@id/ak
                         android:text=0/

 Here, you are trying to put @id/ake to right of @id/ak, which will not
 work well, since your previous rule set @id/ak to have its right edge on
 the right edge of the screen.

That was the biggest mistake. After few other modifications and a run
in the emulator, all looks fine now.

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



[android-beginners] GestureListener events

2009-08-09 Thread ayush

i'm using the GestureDetector and GestureListener in a program. i want
to have separate actions for the onFling and onScroll events. for a
scroll event there is no problem - only the onScroll event is
called. however for a fling event BOTH the onFling and onScroll
events are being called. i tried returning true in the onFling
method to prevent further propagation of the event but that didnt
help. following is the code excerpt from the onTouchEvent and the
related gesture events:

private static boolean fling, scroll; //two boolean values to detect
whether the performed action is a fling or scroll
private GestureDetector scanner; //this is the gesture detector

public boolean onTouchEvent(MotionEvent me){

fling = false;
scroll = false;

scanner.onTouchEvent(me);

if (fling) {
scroll = false;
return true;
} else if (scroll){

return true;
}


return super.onTouchEvent(me);
}

public boolean onFling(MotionEvent e1, MotionEvent e2, float
velocityX,
float velocityY) {

fling = true;

return false; //changing this to return true at this point 
makes no
difference
}


public boolean onScroll(MotionEvent e1, MotionEvent e2, float
distanceX,
float distanceY) {

scroll = true;

return false;
}


what i tried in the onTouchEvent method above is to put a kind of a
lock so that if a fling is detected then the appropriate action is
taken and the event is not propagated further. however despite trying
every combination of returning true / false in each of the above
methods, i am unable to separate out the fling event from the
scroll event.

as i said - there is no problem in the conventional scroll - in this
case only the action for scroll is being performed.

for the gesture events, is there any particular sequence in which the
event is propagated? i.e. does it first go to the onClick, then the
onFling, then the onScroll ... etc?

any inputs will be greatly appreciated

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



[android-beginners] Need code sample for double lon= loc.getLongitude();

2009-08-09 Thread cellurl

From GPS, I am trying to get latitude longitude, bearing and speed.
Just a one time snapshot.

My code is here:
http://code.google.com/p/speedlimit/source/browse/#svn/trunk/Speedlimit/src/org/speedlimit

Pblm:
The loc is always 0.

Q: Must I initialize the GPS provider somehow??
Any complete code snippet most welcomed...


-excerpt from Speedlimit.java---

 Gps gps = new Gps();
 gps.doit();

--Gps.java

package org.speedlimit;

import android.app.Activity;
import android.location.Location;

public class Gps extends Activity
{
   private Location loc;

public void doit() {

if (loc != null) {
double lat= loc.getLatitude();
double lon= loc.getLongitude();
}
}
}
--

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



[android-beginners] Re: how can I use dmtracedump?

2009-08-09 Thread wook

thank you, fadden.

I generated another trace file in a linux box, and then
dmtracedump worked fine with that one.


On Aug 8, 8:49 am, fadden fad...@android.com wrote:
 On Aug 7, 1:21 am, wook wook.s...@gmail.com wrote:

  actually I tried several combinations of the options, but it always
  output the same error message
  ERROR: unable to read 216321 bytes from trace file

 Sounds like your .trace file is truncated or broken somehow.  Do you
 see errors if you simply dmtracedump-h tracefilename  /dev/
 null ?

 Also: do you have dot?  If not, you'll just get:

 %dmtracedump-h foo.trace  /dev/null
 sh: dot: not found
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: Need code sample for double lon= loc.getLongitude();

2009-08-09 Thread Jack Ha

You need to use the LocationManager:

lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Aug 9, 9:22 pm, cellurl gpscru...@gmail.com wrote:
 From GPS, I am trying to get latitude longitude, bearing and speed.
 Just a one time snapshot.

 My code is 
 here:http://code.google.com/p/speedlimit/source/browse/#svn/trunk/Speedlim...

 Pblm:
 The loc is always 0.

 Q: Must I initialize the GPS provider somehow??
 Any complete code snippet most welcomed...

 -excerpt from Speedlimit.java---

          Gps gps = new Gps();
          gps.doit();

 --Gps.java

 package org.speedlimit;

 import android.app.Activity;
 import android.location.Location;

 public class Gps extends Activity
 {
    private Location loc;

     public void doit() {

         if (loc != null) {
                 double lat= loc.getLatitude();
                 double lon= loc.getLongitude();
         }
     }}

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



[android-beginners] want some ebboks to download

2009-08-09 Thread kapnkore

Hello all;
I am new at android sevolopment.i need to have some ebooks n pdf to
start programming with android.will you please give me some link which
will start from basic.
Thank you

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