[android-developers] Re: How to force Activity in landscape mode without Activity restart

2009-08-21 Thread yoshitaka tokusho

Hi String,

 Are you able to use android:screenOrientation=landscape

It works perfectly fine!! Thanks for your comment! I really
appreciated!!

Y.T.

On Aug 21, 3:11 am, String sterling.ud...@googlemail.com wrote:
 On Aug 21, 5:36 am, yoshitaka tokusho ytoku...@gmail.com wrote:

  I have a problem to start/create Activity in landscape mode. My
  Activity need to start in landscape mode and be used in landscape mode
  by users.

 Are you able to use android:screenOrientation=landscape in your
 manifest's activity tag? I don't know if that's mutable at runtime, or
 if you need it to be. But it might be an option for you.

 String
--~--~-~--~~~---~--~~
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 force Activity in landscape mode without Activity restart

2009-08-20 Thread yoshitaka tokusho

Hi folks,

I have a problem to start/create Activity in landscape mode. My
Activity need to start in landscape mode and be used in landscape mode
by users. So far, I used

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)

to force screen orientation of my Activity to landscape mode in
onCreate() method.

In addition to this screen mode requirement, my application need to
start another background thread in onResume() method, and this thread
takes some seconds in order to finish an initialization process, and
it is not desirable to to stop/restart this thread's service during
the initialization process.

However setRequestedOrientation
(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) forces my Activity restart
in a very little while (means onCreate-onResume-onPause-onStop are
executed twice at the first place). As a result, my background thread
be stopped/restarted during the initialization process, and this makes
me a mess at this moment.

If anyone has any idea, please share and discuss here.
Thank you.

--~--~-~--~~~---~--~~
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: Experimental Bluetooth Library

2009-08-17 Thread yoshitaka tokusho

This is a great work. Thank you, Stefano.

Just one question. I'm wondering if this API is not thread-safe. Is
this assumption correct?

Y.T.

--~--~-~--~~~---~--~~
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: What SensorManager.getOrientation returns?

2009-07-12 Thread yoshitaka tokusho

To make getRotationMatrix work, just pass the accelerometer and
magnetic field sensor's observed values array to gravity and
geomagnetic parameters and memory-allocated 4x4 float array to R and I
parameters.
I tried to pass 3x3 arrays as api doc say, but it didn't work.

Y.T.

On Jul 7, 6:28 am, Herbert herbert.broeuschm...@gmail.com wrote:
 On my phone (HTC Magic) SensorManager.getRotationMatrix(...)  fails
 always: it returns false and does not fill the arrays parameter with
 something usable.
 I'm surely doing something wrong...
 However if getRotationMatrix() doesn't work
 SensorManager.getOrientation() is also useless.

 If someone knows how to use SensorManager.getRotationMatrix(...), can
 he help me ?
--~--~-~--~~~---~--~~
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: What SensorManager.getOrientation returns?

2009-06-21 Thread yoshitaka tokusho

Thank you for replying, Serge. I have known exactly what api document
says about this method.
But after some times of trial to figure out what it means, finally I
realized values[] is in radian and this is everything what I needed to
know...

On Jun 15, 6:01 pm, sm1 sergemas...@gmail.com wrote:
 It's still June 15. Here's what is in the documentation:

 athttp://developer.android.com/reference/android/hardware/SensorManager...[],
 float[])

 you'll find:

 public static float[] getOrientation (float[] R, float[] values)

 Computes the device's orientation based on the rotation matrix.
 When it returns, the array values is filled with the result:
 values[0]: azimuth, rotation around the Z axis.
 values[1]: pitch, rotation around the X axis.
 values[2]: roll, rotation around the Y axis.
 Parameters
 R       rotation matrix see getRotationMatrix(float[], float[], float[],
 float[]).
 values  an array of 3 floats to hold the result.
 Returns
 The array values passed as argument.

 Regards,
 serge

 On Jun 15, 5:29 pm, yoshitaka tokusho ytoku...@gmail.com wrote:



  Is there no body here, or is my question too silly?

  On Jun 15, 6:53 am, yoshitaka tokusho ytoku...@gmail.com wrote:

   Hi all,

   Simply what I have to suppose SensorManager.getOrientation()'s return
   values are? I expected getOrientation returns yaw/pitch/roll values in
   degrees like SensorEvent dose when callback returned. But all I can
   get is some strenge floating number something about between -3.0 and
   +3.0. Would someone knowledgeable teach me what it is?

   Any help will be so appreciated.- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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 SensorManager.getOrientation returns?

2009-06-15 Thread yoshitaka tokusho

Hi all,

Simply what I have to suppose SensorManager.getOrientation()'s return
values are? I expected getOrientation returns yaw/pitch/roll values in
degrees like SensorEvent dose when callback returned. But all I can
get is some strenge floating number something about between -3.0 and
+3.0. Would someone knowledgeable teach me what it is?

Any help will be so appreciated.
--~--~-~--~~~---~--~~
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: What SensorManager.getOrientation returns?

2009-06-15 Thread yoshitaka tokusho

Is there no body here, or is my question too silly?

On Jun 15, 6:53 am, yoshitaka tokusho ytoku...@gmail.com wrote:
 Hi all,

 Simply what I have to suppose SensorManager.getOrientation()'s return
 values are? I expected getOrientation returns yaw/pitch/roll values in
 degrees like SensorEvent dose when callback returned. But all I can
 get is some strenge floating number something about between -3.0 and
 +3.0. Would someone knowledgeable teach me what it is?

 Any help will be so appreciated.
--~--~-~--~~~---~--~~
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 force hierarchy change to PreferenceActivity?

2009-06-13 Thread yoshitaka tokusho
(R.string.title_preference_des_gamma);
mDesgammaPref.setSummary
(R.string.summary_preference_des_gamma);
mDesgammaPref.setDefaultValue(1.0);
mOriantationSmoothingParameterPrefCat.addPreference
(mDesgammaPref);
}
}

@Override
public void onSharedPreferenceChanged(SharedPreferences
sharedPreferences, String key)
{
if ( key.equals(getResources().getString
(R.string.key_preference_orientation_smoothing_method)) )
{
mOrientationSmoothingPref.removePreference
(mOriantationSmoothingParameterPrefCat);
createOrientationSmoothingParameterPreferenceCategory();
}
}
-

Y.T.

On Jun 13, 10:14 am, Jason Parekh jasonpar...@gmail.com wrote:
 The preference framework will refresh the UI when a preference has a
 UI-visible attribute changed, for example the summary.  So, you can just do
 myPreference.setSummary(myPreference.getValue()) (assuming you want to show
 the selected item as the summary of the preference).

 On Fri, Jun 12, 2009 at 4:29 AM, yoshitaka tokusho ytoku...@gmail.comwrote:





  I have a PreferenceActivity building screen hierarchy from code, and I
  need to force display hierarchy change dynamically when one of
  SharedPreference value changed. I know this might be a kind of easy
  quesiton, but I couldn't find answer anywhere in documentations or
  discussion.

  My PreferenceActivity is forming like this.

  -
  public class MyPreferenceActivity extends PreferenceActivity
  ...
        setPreferenceScreen(createPreferenceHierarchy());
  }

  private PreferenceScreen createPreferenceHierarchy()
  {
         // Root
         PreferenceScreen root = getPreferenceManager
  ().createPreferenceScreen(this);

         // Orientation tracking smoothing method preference
         PreferenceScreen orientationsmoothingPref = getPreferenceManager
  ().createPreferenceScreen(this);
         orientationsmoothingPref.setKey( (String) getResources().getText
  (R.string.key_screen_orientation_smoothing_method) );
         orientationsmoothingPref.setTitle
  (R.string.title_screen_orientation_smoothing_method);
         orientationsmoothingPref.setSummary
  (R.string.summary_screen_orientation_smoothing_method);
         root.addPreference(orientationsmoothingPref);

         // List preference
         ListPreference orientationsmoothinglistPref = new ListPreference
  (this);
         orientationsmoothinglistPref.setEntries
  (R.array.entries_orientation_smoothing_method_preference);
         orientationsmoothinglistPref.setEntryValues
  (R.array.entryvalues_orientation_smoothing_method_preference);
         orientationsmoothinglistPref.setKey( (String) getResources().getText
  (R.string.key_preference_orientation_smoothing_method) );
         orientationsmoothinglistPref.setTitle
  (R.string.title_preference_orientation_smoothing_method);
         orientationsmoothinglistPref.setSummary
  (R.string.summary_preference_orientation_smoothing_method);
         orientationsmoothinglistPref.setDefaultValue(No);

   orientationsmoothingPref.addPreference(orientationsmoothinglistPref);

         // Orientation smoothing parameters category
         PreferenceCategory orientationsmoothingparameterPrefCat = new
  PreferenceCategory(this);
         orientationsmoothingparameterPrefCat.setTitle
  (R.string.title_category_orientation_smoothing_method_parameter);
         orientationsmoothingPref.addPreference
  (orientationsmoothingparameterPrefCat);

         String orientationsmoothingmethodStr =
  orientationsmoothinglistPref.getValue();

         if ( orientationsmoothingmethodStr.compareTo(no) == 0 )
         {
                 /* In case orientation smoothing method is No */
                 // Nothing to do.
         }
         else if ( orientationsmoothingmethodStr.compareTo(ma) == 0 )
         {
                 /* In case orientation smoothing method is Moving
  Averaging */

             // Edit text preference
             EditTextPreference maNPref = new EditTextPreference(this);
             maNPref.setKey( (String) getResources().getText
  (R.string.key_preference_ma_n) );
             maNPref.setDialogTitle(R.string.title_preference_ma_n);
             maNPref.setTitle(R.string.title_preference_ma_n);
             maNPref.setSummary(R.string.summary_preference_ma_n);
             maNPref.setDefaultValue(10);
             orientationsmoothingparameterPrefCat.addPreference(maNPref);

         }
         else if ( orientationsmoothingmethodStr.compareTo(ses) == 0 )
         {
                 /* In case orientation smoothing method is Single
  Exponential
  Smoothing */

             // Edit text preference
             EditTextPreference sesalphaPref = new EditTextPreference(this);
             sesalphaPref.setKey( (String) getResources().getText
  (R.string.key_preference_ses_alpha) );
             sesalphaPref.setTitle(R.string.title_preference_ses_alpha);

   sesalphaPref.setDialogTitle(R.string.title_preference_ses_alpha);
             sesalphaPref.setSummary

[android-developers] How to force hierarchy change to PreferenceActivity?

2009-06-12 Thread yoshitaka tokusho

I have a PreferenceActivity building screen hierarchy from code, and I
need to force display hierarchy change dynamically when one of
SharedPreference value changed. I know this might be a kind of easy
quesiton, but I couldn't find answer anywhere in documentations or
discussion.

My PreferenceActivity is forming like this.

-
public class MyPreferenceActivity extends PreferenceActivity
...
   setPreferenceScreen(createPreferenceHierarchy());
}

private PreferenceScreen createPreferenceHierarchy()
{
// Root
PreferenceScreen root = getPreferenceManager
().createPreferenceScreen(this);

// Orientation tracking smoothing method preference
PreferenceScreen orientationsmoothingPref = getPreferenceManager
().createPreferenceScreen(this);
orientationsmoothingPref.setKey( (String) getResources().getText
(R.string.key_screen_orientation_smoothing_method) );
orientationsmoothingPref.setTitle
(R.string.title_screen_orientation_smoothing_method);
orientationsmoothingPref.setSummary
(R.string.summary_screen_orientation_smoothing_method);
root.addPreference(orientationsmoothingPref);

// List preference
ListPreference orientationsmoothinglistPref = new ListPreference
(this);
orientationsmoothinglistPref.setEntries
(R.array.entries_orientation_smoothing_method_preference);
orientationsmoothinglistPref.setEntryValues
(R.array.entryvalues_orientation_smoothing_method_preference);
orientationsmoothinglistPref.setKey( (String) getResources().getText
(R.string.key_preference_orientation_smoothing_method) );
orientationsmoothinglistPref.setTitle
(R.string.title_preference_orientation_smoothing_method);
orientationsmoothinglistPref.setSummary
(R.string.summary_preference_orientation_smoothing_method);
orientationsmoothinglistPref.setDefaultValue(No);
orientationsmoothingPref.addPreference(orientationsmoothinglistPref);

// Orientation smoothing parameters category
PreferenceCategory orientationsmoothingparameterPrefCat = new
PreferenceCategory(this);
orientationsmoothingparameterPrefCat.setTitle
(R.string.title_category_orientation_smoothing_method_parameter);
orientationsmoothingPref.addPreference
(orientationsmoothingparameterPrefCat);

String orientationsmoothingmethodStr =
orientationsmoothinglistPref.getValue();

if ( orientationsmoothingmethodStr.compareTo(no) == 0 )
{
/* In case orientation smoothing method is No */
// Nothing to do.
}
else if ( orientationsmoothingmethodStr.compareTo(ma) == 0 )
{
/* In case orientation smoothing method is Moving Averaging */

// Edit text preference
EditTextPreference maNPref = new EditTextPreference(this);
maNPref.setKey( (String) getResources().getText
(R.string.key_preference_ma_n) );
maNPref.setDialogTitle(R.string.title_preference_ma_n);
maNPref.setTitle(R.string.title_preference_ma_n);
maNPref.setSummary(R.string.summary_preference_ma_n);
maNPref.setDefaultValue(10);
orientationsmoothingparameterPrefCat.addPreference(maNPref);

}
else if ( orientationsmoothingmethodStr.compareTo(ses) == 0 )
{
/* In case orientation smoothing method is Single Exponential
Smoothing */

// Edit text preference
EditTextPreference sesalphaPref = new EditTextPreference(this);
sesalphaPref.setKey( (String) getResources().getText
(R.string.key_preference_ses_alpha) );
sesalphaPref.setTitle(R.string.title_preference_ses_alpha);
sesalphaPref.setDialogTitle(R.string.title_preference_ses_alpha);
sesalphaPref.setSummary(R.string.summary_preference_ses_alpha);
sesalphaPref.setDefaultValue(0.3);
orientationsmoothingparameterPrefCat.addPreference(sesalphaPref);

}
else if ( orientationsmoothingmethodStr.compareTo(des) == 0 )
{
/* In case orientation smoothing method is Single Exponential
Smoothing */

// Edit text preference
EditTextPreference desalphaPref = new EditTextPreference(this);
desalphaPref.setKey( (String) getResources().getText
(R.string.key_preference_des_alpha) );
desalphaPref.setTitle(R.string.title_preference_des_alpha);
desalphaPref.setDialogTitle(R.string.title_preference_des_alpha);
desalphaPref.setSummary(R.string.summary_preference_des_alpha);
desalphaPref.setDefaultValue(0.3);
orientationsmoothingparameterPrefCat.addPreference(desalphaPref);

// Edit text preference
EditTextPreference desgammaPref = new EditTextPreference(this);
desgammaPref.setKey( (String) getResources().getText
(R.string.key_preference_des_gamma) );