Re: [android-developers] Android Compass help

2012-06-27 Thread sajjan androiddeveloper
You have compass application already in android sample code.Have a look on
that

On Sun, Jun 24, 2012 at 2:52 AM, axesh ajmera ajmeraax...@gmail.com wrote:

 Hi Guys,
  I need your help on developing an android compass
 application.Here is the source code...I want to know if i am using correct
 algorithm and sensors for developing the app and secondly I am unable to
 understand why my compass jitters so much

 package com.android.compass.example

 import android.app.Activity;
 import android.hardware.Sensor;
 import android.hardware.SensorEvent;
 import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
 import android.os.Bundle;

 public class CompassExample4Activity extends Activity implements
 SensorEventListener{
  private SensorManager mSensorManager;
 CompassView mCompassView;
 Sensor accelerometer;
 Sensor magnetometer;
 float azimut;
 float[] mGravity;
 float[] mGeomagnetic;
 static final float ALPHA = 0.2f;
 double SmoothFactorCompass = 0.5;
 double SmoothThresholdCompass = 30.0;
 double oldCompass = 0.0;
 int oldCompass2 = 0;
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 mCompassView = new CompassView(this);
 //this.setRequestedOrientation(0);
 setContentView(mCompassView);

 mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
 accelerometer =
 mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
 magnetometer =
 mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
 }

 @Override
 public void onResume() {
 super.onResume();
 mSensorManager.registerListener(this, accelerometer,
 SensorManager.SENSOR_DELAY_UI);
 mSensorManager.registerListener(this, magnetometer,
 SensorManager.SENSOR_DELAY_UI);
 }
 @Override
 public void onPause() {
 super.onPause();
 mSensorManager.unregisterListener(this);
 }

 @Override
 public void onAccuracyChanged(Sensor sensor, int accuracy) {
 // TODO Auto-generated method stub
  }

 @Override
 public void onSensorChanged(SensorEvent event) {
 // TODO Auto-generated method stub
 if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
   mGravity = lowPass(event.values, mGravity);
 if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
   mGeomagnetic = lowPass(event.values, mGeomagnetic);

 if (mGravity != null  mGeomagnetic != null) {
   float R[] = new float[9];
   float I[] = new float[9];
   boolean success = SensorManager.getRotationMatrix(R, I, mGravity,
 mGeomagnetic);
   // Correct if screen is in Landscape
   SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X,
 SensorManager.AXIS_Z, R);

   if (success) {
 float orientation[] = new float[3];
 SensorManager.getOrientation(R, orientation);
 float azimut = orientation[0]; // orientation contains: azimut,
 pitch and roll
 //float azimuth = (float)
 Math.round((Math.toDegrees(orientation[0]))*7)/7;
 //azimuth = ( azimuth + 360)%360;


  
 mCompassView.updateDirection((float)smoothnessFunction(azimut*360/(2*3.14159f)));
 //mCompassView.updateDirection(azimuth);
   }
  }
 }
  protected float[] lowPass( float[] input, float[] output ) {
 if ( output == null ) return input;

 for ( int i=0; iinput.length; i++ ) {
 output[i] = output[i] + ALPHA * (input[i] - output[i]);
 }
 return output;
 }
  public double smoothnessFunction( double newCompass) {
  if (Math.abs(newCompass - oldCompass)  180) {
 if (Math.abs(newCompass - oldCompass)  SmoothThresholdCompass) {
 oldCompass = newCompass;
 }
 else {
 oldCompass = oldCompass + SmoothFactorCompass * (newCompass -
 oldCompass);
 }
 } else {
 if (360.0 - Math.abs(newCompass - oldCompass) 
 SmoothThresholdCompass) {
 oldCompass = newCompass;
 } else {
 if (oldCompass  newCompass) {
 oldCompass = (oldCompass + SmoothFactorCompass * ((360 +
 newCompass - oldCompass) % 360) + 360) % 360;
 } else {
 oldCompass = (oldCompass - SmoothFactorCompass * ((360 -
 newCompass + oldCompass) % 360) + 360) % 360;
 }
 }
 }
 return oldCompass;
 }
  public int smoothnessFunction2(double newCompass){
 if ((int)newCompass % 360 != oldCompass2) {
 oldCompass2 = (int) newCompass;
 }
 return oldCompass2;
 }
 }

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

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send 

Re: [android-developers] button

2012-06-21 Thread sajjan androiddeveloper
Use selector that will be easy for you

On Thu, Jun 21, 2012 at 3:22 PM, bob b...@coolfone.comze.com wrote:

 Are you talking about using this?

 void setOnTouchListener(View.OnTouchListener l)


 On Wednesday, June 20, 2012 10:34:42 AM UTC-5, Kristopher Micinski wrote:

 Sure, in the onPressed event, change the image, when it's not pressed,
 change it back.?

 kris

 On Wed, Jun 20, 2012 at 11:32 AM, bob b...@coolfone.comze.com wrote:
  I'm trying to make a button that uses two different images - one for
 when it
  is pressed, and one for when it's not.
 
 
  Anyone know an easy way to do this?
 
 
  --
  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 android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/**group/android-developers?hl=enhttp://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 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


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

Re: [android-developers] Re: About Phone GAP

2011-12-01 Thread sajjan androiddeveloper
Unfortunately ,If you need same code to be working on multiple
platforms(iPhone and Blackberry) no other way now..

On Thu, Dec 1, 2011 at 10:30 AM, Mukesh Srivastav mukicha...@gmail.comwrote:

 JQuery,PhoneGAP,Snecha are all Same Web-Development tools.


 I suspect, one day, Mobile companies would HIRE Web-Developes who are good
 at HTML and CSS and will ask to work on PhoneGAP or Jquery


 -*Mukesh*

 On Thu, Dec 1, 2011 at 3:53 PM, Alessandro Pellizzari a...@amiran.itwrote:

 Il Thu, 01 Dec 2011 14:59:16 +0530, Mukesh Srivastav ha scritto:

  I just wanted to check how many Android/iPhone Developers would really
  likes it work on PhoneGAP which is like Developing Web-programming
 usinge
  HTML/Javascript and CSS.

 The primary field I work in is HTML+CSS+JS (+PHP). I do it 8-12 hours a
 day, 6 or 7 days a week. :)

 I still find it quite hard to adapt a web interface for a mobile device.
 It is much easier to use Android Activities instead of juggling DOM
 pieces thru Javascript.

 Maybe with PhoneGAP, Sencha and jQueryMobile it is/will be easier.
 But performance is (still) much poorer.

 Bye.


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




 --
 Warm Regards,
 *Mukesh Kumar*,
 Android Consultant/Freelancer,
 India,Hyderabad.

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


-- 
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 change the normal behaviour of a listview

2010-04-15 Thread androidDeveloper
Hello Android Developers,

does anyone know how to imitate the behaviour of the iPhone list used
in the cineplexx iPhone app shown on this page:

http://itunes.apple.com/de/app/cineplex-kinoprogramm/id361227953?mt=8

I refer to the left image, which shows a list with different locations
to choose.

Special about this list is, that everytime a location has been
choosen, the list is adjusted automatically, so that the nearest
location is centered in the blue border. The adjusting process is
animated.


Thanks in advance!


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

To unsubscribe, reply using remove me as the subject.


[android-developers] Re: How to change the normal behaviour of a listview

2010-04-15 Thread androidDeveloper
Yes, that would be the way, thanks.

Has anyone done someting similar and could share sample code?


On 15 Apr., 14:11, tony obrien tobsourcecode...@gmail.com wrote:
 By extending the LISTVIEW and overriding the GetView() you can do
 whatever you want.

 On Apr 15, 5:35 am, androidDeveloper stepmas...@googlemail.com
 wrote:

  Hello Android Developers,

  does anyone know how to imitate the behaviour of the iPhone list used
  in the cineplexx iPhone app shown on this page:

 http://itunes.apple.com/de/app/cineplex-kinoprogramm/id361227953?mt=8

  I refer to the left image, which shows a list with different locations
  to choose.

  Special about this list is, that everytime a location has been
  choosen, the list is adjusted automatically, so that the nearest
  location is centered in the blue border. The adjusting process is
  animated.

  Thanks in advance!

-- 
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] Experience with different Android devices and apps shown in Android Market

2010-02-23 Thread androidDeveloper
I am interested in your experience with Android apps. Do you have
problems with some devices (errors, crashes...), apps that are not
shown on some devices or other problems?

If you have some of these problems,  is it clear to you where the
problem comes from?

Greetings
Android Developer

-- 
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] Can not find my own App in Android Application with G!

2009-11-08 Thread androidDeveloper
Is there a reason why I do not find my own app on Android Market with
my G1?
The G1 is registered to my Google account, that I used to submit the
APP.
I too have a Samsung Galaxy, which is registered to another Google
account, and with that I found my app!

Does anyone know why this is?

-- 
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] Problems updating my app on Android Market and switching to copy protection

2009-11-08 Thread androidDeveloper
I have uploaded an update for my app on Android Market. And at the
same time I have enabled the copy protection of the app. When I
downloaded my the update, there was an exception and the app crashed.
I had to reinstall it. After reinstall it worked fine...

Exception was:
W/zipro   ( 1103): Unable to open zip '/data/app-private/...':
Permission denied
D/asset   ( 1103): failed to open Zip archive '/data/app-private/...'
W/ResourceType( 1103): No package identifier when getting value for
resource number 0x7f09


Is this a know bug when switching to copy protection? Or is there
another reason this error occured?

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] 3D Primitives in opengl ES (sphere)

2009-09-25 Thread androidDeveloper

Anyone know how to draw a 3D-sphere with OpenGL ES in android?

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 gluUnProject

2009-09-21 Thread androidDeveloper

Have you checked the MatrixGrabber?

I tried to use the MatrixGrabber, but I got an class Cast Exception in
the MatrixGrabber Row 56:
private void getMatrix(GL10 gl, int mode, float[] mat) {
MatrixTrackingGL gl2 = (MatrixTrackingGL) gl;
 ...}

Does anyone know how to use it?

On 8 Sep., 15:53, Streets Of Boston flyingdutc...@gmail.com wrote:

--~--~-~--~~~---~--~~
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] OpenGL ES - How to map 2D-X-Y-screen Coordinates to 3D-X-Y-Z Object

2009-09-21 Thread androidDeveloper

Does anyone know how to map 2D-X-Y screen coordinates to 3D-X-Y-Z
Object coordinates in a openGL World
(Or  3D-X-Y-Z to 2D-X-Y)?

What I want is to determine on which 3D-Object a user clicked, when he
touches the phone screen (onTouchEvent).

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 gluUnProject

2009-09-21 Thread androidDeveloper

Thanks. I found the error. The Code example is found in the ApiDemos
com.example.android.apis.graphics.spritetext SpriteTextActivity.


On 21 Sep., 14:56, Streets Of Boston flyingdutc...@gmail.com wrote:

--~--~-~--~~~---~--~~
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: ADC 2 Submission Site -- Now live

2009-08-26 Thread androidDeveloper

  So...will ADC2 apps be used by people outside of ADC2 judging?

 No, apps will be removed from the device after the judging period is
 over. If developers want to, they may release their app into the
 standard Market, but that will be the only version they will need to
 support.


Ok, I understood, that apps will be deleted from the devices of the
judging people after the judging period. And no other persons can
download or install the ADC2 apps.

Now I have a question about the Eligibility. In the Eligibility of
ADC2 there is written that:
 If you intend to sell your application after the conclusion of
the contest, you may submit a trial version of the application for
judging.
  We recommend that your trial version include full functionality,
but with a timed expiration

Why do I have to publish a trial version of my app, or include a time
expiration, when the app will be deleted automatically at the end of
the judging period?


Thanks!
Stepmas
--~--~-~--~~~---~--~~
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] get Projection Matrix from mapView in Overlay method draw

2009-05-28 Thread androidDeveloper

Hello,

does anyone know how to get the projection Matrix of the mapView?

Usually when drawing an Overlay you have to call projection.toPixels
(geoPoint, point) for each GeoPoint you want to draw. I Think it
would be faster to put the GeoPoints in a Path an then call
path.transform(matrix).
Whil debugging, I saw that the Projection class has a member Varibale
mMatrix, which is private. But there is no getter for the matrix...

Anybody knows how to get it?

Greetings and 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] Performant implementation of the overlay (like in myTracks)

2009-05-11 Thread androidDeveloper

Hello Guys,

anyone knows how to implement an overlay on googles mapview very fast
and performant just like in the application mytracks? Especially when
many points have to be drawn on the overly.  In the mytracks app, it
is alwas very fast independent how much points are drawn...

Here is the code snippet how I do it, but it is, like I said, not very
fast when drawing many points on the Overlay.
Here is the way I do do it:
Every time the user changes the mapView the draw-method of the
ItemizedOverlay class is called and the Projection.toPixels method
must be called for each point to draw on the map to get the right x/y
coordinates. Code looks like this(this is the fastest method i know
all others that i have tried are slower):
 Projection projection = mapView.getProjection();
  for (int i =0; i  geoPoints.size(); i++ ) {
. ..
projection.toPixels(geoPoints.get(i), point);
...
path.moveTo(point.x, point.y);
 ...
 path.lineTo(point.x, point.y);
  }
  canvas.drawPath(path, paint);
  
When I compare the performance of the overlay of myTracks and the
overlay of my program, I wonder how they achieved a much better
performance than me. I have googled very long to find a solution to my
problem, but I have not found any code examples, which show how to
make it better. The Android Api Demos doesen't include an example that
is useful, or I missed it?  Thats why I post the problem here, and i
hope someone knows the answer and could send me an code example to do
it better

Thanks and best Regards!
Stefan from Germany

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