[android-developers] Re: Accelerometer/Orientation sensor problem

2009-04-03 Thread chow

I have noticed that the speaker output does effect the magnetic
compass reading a bit. Not too surprising, since the speaker uses an
electromagnet. This is probably what is causing the sensor to jitter
around. As for the accelerometers, I would guess that the movement of
the speaker cone itself is what is causing the fluctuations there.
Perhaps its not a problem, but more of a filtering issue, have your
tried any simple averaging on the sensor output?

chow

On Mar 31, 11:55 am, Liz  wrote:
> On my T-Mobile G1 (firmware 1.1, build PLAT-RC33), developing in
> SDK1.1r1,  I am experiencing a problem where playing sounds causes the
> output of the accelerometer and orientation sensors to fluctuate
> wildly.     The degree of fluctuation is directly proportional to the
> volume of the sound being played.
>
> I am using SensorManager per the documentation and examples :
>
> <=  From my implementation of SensorListener>
> public void init() {
>     SensorManager sm = (SensorManager) cx..getSystemService
> (Context.SENSOR_SERVICE);
>     boolean success = sm.registerListener(this,
>          SensorManager.SENSOR_ORIENTATION,
>          SensorManager.SENSOR_DELAY_GAME);
>     // success is true, i.e. no problems acquiring the sensor
>
> }
>
> public void onSensorChanged(int sensor, float[] values) {
>     if (sensor == SensorManager.SENSOR_ORIENTATION) {
>          // print/draw/do something with the sensor output in values[]
>     }}
>
> <==>
>
> I have tried playing sounds with both SoundPool and MediaPlayer, with
> identical results.   When a sample is played at max volume the
> Orientation sensor outputs will bounce around as much as +-/30
> degrees.   All axes are affected.
>
> I have tested and confirmed this behaviour for SENSOR_ACCELEROMETER,
> SENSOR_ORIENTATION, and SENSOR_ORIENTATION_RAW.  Other sensors may
> also be impacted, but I haven't tested them.
>
> I have also tested with all of the available sensor sampling rates --
> SENSOR_DELAY_FASTEST through SENSOR_DELAY_UI.   All result in the same
> behavior.
>
> On a random guess I tried muting the microphone with
> AudioManager.setMicrophoneMute(true) -- same results.
>
> I thought to try testing this in the Android emulator to see if it
> might be hardware-related, but unfortunately there is currently no
> accelerometer/orientation sensor support in the emulator.
>
> Is this a known problem?  Or am I doing something wrong here?
>
> 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: Obtaining Frequency from Mic on Android

2009-06-28 Thread chow

Well so far, I think you can defiantly record some audio, and take
that raw data and do a fft to get the freq, but im not too sure about
getting more "live" than that. im looking for a solution to get
freqencies from the microphone as well. any luck checking out some
code associated with the various guitar tuner programs out there?


On Jun 9, 3:27 am, Tez  wrote:
> Hi,
>
> I wish to obtain the frequency of an input signal from the mic. Can
> anyone send me some pointers on how this may be accomplished.
>
> Earlence
--~--~-~--~~~---~--~~
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] I want to join the group

2010-05-19 Thread sewiz chow
HI,
   please let me join .
   thanks very much

-- 
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 background color of ToggleButton?

2011-01-26 Thread Eric Chow
Hello,

How can I change the background color of a ToggleButton?

-- 
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 change the background color of ToggleButton?

2011-01-30 Thread Eric Chow
Yes, I just want to change the button background.
How can I do it at runtime?
Would you please to give me a simple example?

Best regards,
Eric



On Jan 29, 2:17 am, Kostya Vasilyev  wrote:
> If you only want tochangethe way aToggleButtonlooks (not behaves),
> you can replace the background from XML with your own.
>
> Note thatToggleButtonuses a layer-list drawable to overlay the toggle
> state over the standard button background, to reduce the number of
> needed images.
>
> You can find the resource in "data" directory inside the
> platforms\platform-\data\res folder on your computer.
>
> -- Kostya
>
> 28.01.2011 21:08, Roger Podacter пишет:
>
>
>
> > I was interested in doing something like this as well. My app has 6
> > toggle buttons in a row on one line, and it doesn't quite fit on
> > portrait screen. I wanted to make a custom toggle button, color,
> > width, etc.
>
> > You could also make your own state-list drawable I think It's called.
> > Anyway in the source of the s d k I think you can find the toggle
> > button and then edit it, not sure though.
>
> > On Jan 27, 7:08 pm, TreKing  wrote:
> >> On Tue, Jan 25, 2011 at 10:43 PM, Eric Chow  wrote:
> >>> How can Ichangethe background color of aToggleButton?
> >> Go to the documentation, find the entry forToggleButton, then start
> >> reading. There-in lies the answer.
>
> >> ---
> >>  --
> >> TreKing<http://sites.google.com/site/rezmobileapps/treking>  - Chicago
> >> transit tracking app for Android-powered devices
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

-- 
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 pass parameters to the AlarmService?

2011-05-17 Thread Eric Chow
Hello,

Please see the following code. It could not pass those extra
parameters to the intent.
When I tried show the keys in the intent, it only gets the key
"android.intent.extra.ALARM_COUNT".
Anything I did wrong?
Please teach me how can I pass some parameters to the AlarmService
when the alarm activate?

Best regards,
Eric





AlarmManager alarmManager =
(AlarmManager)getSystemService(ALARM_SERVICE);
Intent myIntent = new Intent(this, TVAlarmService.class);

PendingIntent pendingIntent = PendingIntent.getService(Main.MAIN, 0,
myIntent, PendingIntent.FLAG_UPDATE_CURRENT);

myIntent.putExtra("name", lValue);
myIntent.putExtra("program", program);
myIntent.putExtra("today", today);

alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
pendingIntent);

===


public class MyAlarmService extends Service {
@Override
public void onStart(Intent intent, int startId) {
Bundle extras = intent.getExtras();

 for(String k : extras.keySet()) {
 Log.i(TAG, "key >>> " + k);
 }

}



-- 
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] it doesn't fire, setOnLongClickListener on AppWidgetHostView

2012-10-04 Thread Wing Fung Chow
i set OnLongClickListner, but it doesn't fire. Can anybody help me?
i just follow 
[url]http://www.anddev.org/appwidgethost_tutorial-t10329.html[/url], and 
change some, as it is posted in 2010.

Some part of code:
//declare under class
private AppWidgetHostView widgets[] = new AppWidgetHostView[16];

widgets[widgCount] = attachWidget(mAppWidgetHost.createView(this, 
appWidgetId, appWidgetInfo), width, height);
parent.addView(widgets[widgCount]);
widgets[widgCount].setOnLongClickListener(new OnLongClickListener() {
public boolean onLongClick(View v) {
 Toast.makeText(MainActivity.this, "hello hello ", 
Toast.LENGTH_SHORT).show();
return true;
}
});

My code:
package com.example.test5;

import java.util.ArrayList;

import android.os.Bundle;
import android.app.Activity;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.Toast;

public class MainActivity extends Activity {
private Button b1;
private AppWidgetManager mAppWidgetManager;
 
private AppWidgetHost mAppWidgetHost;
static final int APPWIDGET_HOST_ID = 2037;
private static final int REQUEST_CREATE_APPWIDGET = 5;
 
private static final int REQUEST_PICK_APPWIDGET = 9;
 
 
 
private AppWidgetHostView widgets[] = new AppWidgetHostView[16];
 
private int widgCount = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=(Button)findViewById(R.id.button1);
b1.setOnLongClickListener(new OnLongClickListener() {
   
public boolean onLongClick(View v) {
doWidgetPick();
return false;
}

});
mAppWidgetManager = AppWidgetManager.getInstance(this);



mAppWidgetHost = new AppWidgetHost(this, APPWIDGET_HOST_ID);
 
mAppWidgetHost.startListening();
}




@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
menu.add(0, 1, 0, "Add Widget");
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
 
switch (item.getItemId()) {
 
case 1:
 
doWidgetPick();
 
return true;
 
}
 
return false;
 
}
protected void doWidgetPick() {
 
int appWidgetId = this.mAppWidgetHost.allocateAppWidgetId();
 
 
 
Intent pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
 
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
 
   
 
/* custom extra that has to be there or else NPE will happen due to 
android bug   */
 
  //this is pulled from the Launcher source, I just changed a few things as 
it's just a dummy entry at this point
 
ArrayList customInfo =
 
new ArrayList();
 
AppWidgetProviderInfo info = new AppWidgetProviderInfo();
 
info.provider = new ComponentName(getPackageName(), "XXX.YYY");
 
info.label = "i love android";
 
info.icon = R.drawable.ic_launcher;
 
customInfo.add(info);
 
pickIntent.putParcelableArrayListExtra(
 
AppWidgetManager.EXTRA_CUSTOM_INFO, customInfo);
 
ArrayList customExtras = new ArrayList();
 
Bundle b = new Bundle();
 
b.putString("custom_widget", "search_widget");
 
customExtras.add(b);
 
pickIntent.putParcelableArrayListExtra(
 
AppWidgetManager.EXTRA_CUSTOM_EXTRAS, customExtras);
 
/* that's a lot of lines that are there for no function at all */
 
   
 
   
 
// start the pick activity
 
startActivityForResult(pickIntent, REQUEST_PICK_APPWIDGET);
 
//because we've defined ourselves as a singleTask activity, it will 
allow this intent to be part of the task
 
 
 
}
@Override
 
protected void onActivityResult(int requestCode, int resultCode, Intent 
data) {
 
Log.v("result",requestCode + ", " + resultCode + ", " + data);
 
  //when the user completes the pick process, both these cases come back, 
according to log.
 
  //looks like this is happening because Pick does a check to see if a 
config needs to be launched first
 
  //if not it just sends the create intent
 
   
 
   
 
if (resultCode == RESULT_OK) {
 
switch (requestCode) {
 
case REQUEST_PICK_APPWIDGET:
 
addAppWidget(data);
 
break;
 
case REQUEST_CREATE_APPWIDGET:
 
completeAddAppWidget(data);
 
break;
 
}
 
}
 
else if ((requestCode == REQUEST_PICK_APPWIDGET ||
 
r

[android-developers] it can't scroll after i set OnTouchListener to its child, i add Google Calender appWidgetHostView in app

2012-10-19 Thread Wing Fung Chow
It is a application that can add appWidget. The widget can be deleted by 
long press. 
This function, i set onTouchListener and GestureDetector to do it and set 
onTouchListener per 3s to prevent it become invaild after update.
However, i found that the google calender can't be scroll, Could anyone 
help me?
any ideas for this situation?

-- 
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: L2TP/IPSEC PSK with Android 4

2011-12-27 Thread Franklin Chow (Zhou Shulin)
Thank you buddy.
在 2011-12-28 上午9:12,"Nikolay Elenkov" 写道:

> On Mon, Dec 26, 2011 at 6:19 PM, Franklin  wrote:
> > I also met this problem. It shows "Time out" in Galaxy Nexus but the
> > same setting works fine with my Nexus One.
> >
>
> Check the logcat, that might give you an idea about the error (if any).
> Other than that, try different settings, and if none work, go to
> http://b.andorid.com and file a bug.
>
> BTW, this does not seem related to development, so this is probably
> not the right list to discuss it.
>
> --
> 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