[android-developers] Re: button text change

2009-01-31 Thread Chander Pechetty

Have you done setContentView(R.layout.yourLayout) before calling
this. Looks ok to me, it certainly works for me.
if you are doing this on a certain click , then make sure its
clickable...
button1.setClickable(true);


-Chander

On Jan 31, 10:37 am, Bob bshumsk...@yahoo.com wrote:
 Hi,
 How do I change the text on a button at run-time?  This code doesn't
 appear to do anything, what am I doing wrong:

  Button button1=(Button)findViewById(R.id.button1);
         button1.setText(Change text);

 Thanks,
 Bob
--~--~-~--~~~---~--~~
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: gapless playback

2009-01-31 Thread Phill Midwinter
That works perfectly, thanks for the help.

Do you know why it works?

2009/1/31 Dave Sparks davidspa...@android.com


 Use Ogg files, you can get a nice seamless loop. We use this for the
 ringtones.

 On Jan 30, 10:30 am, ph...@grantmidwinter.com
 ph...@grantmidwinter.com wrote:
  Hoya,
 
  When using a mediaplayer to play back an audio file, you can set
  looping to true - that's not the issue here.
 
  If looping is set to true, there's still an audible gap between the
  file finishing and then starting again.
 
  How could I achieve true gapless playback? I've attempted using two
  instances of the same file, overriding oncomplete and onseek.. can't
  seem to improve the gap though. Any help appreciated.
 



-- 
Phill Midwinter
Director
Grant Midwinter Limited
d: 0844 736 5234 x: 0
m: 07538 082156
e: ph...@grantmidwinter.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] the imageview object supports which formats images other than png and jpg

2009-01-31 Thread jj

Hello everybody
The imageview  object supports, which formats of images other than
png and jpg?
 Is it supporting *.jif, *.bmp. *.tiff, etc. to display them on sceen
of activity?

   The picture application(on emulator) shows only *.jpg and *.png
format it does not shows other format images(*.jif, *.bmp, etc).

Will anybody clear me regarding this issue?

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: Memory leak in BitmapFactory/Gallery?

2009-01-31 Thread blindfold

Thank you very much, fadden! It is much appreciated. For now I appear
to have fixed not only my run-to-run memory leaks but also the
frequent multi-run crashes by ensuring that my threads finish. From
reading this group I had just been looking in the wrong direction when
hunting for context leaks in relation to bitmaps and the camera,
because in hindsight I could with every run see the number of threads
grow in the thread view of DDMS (just not visible by default).

When compiling hprofConv.c I noticed that stdint.h is not included
with Visual Studio C++ products (http://en.wikipedia.org/wiki/
Stdint.h), so I fetched the portable stdint.h pstdint.h from the web
(http://www.azillionmonkeys.com/qed/pstdint.h). Next I found that I
had to redefine DBUG for lack of support for variable length argument
lists in my (old) C preprocessor, and I had to apply a few explicit
casts to HprofBasicType to satisfy the VC compiler. Of course I fully
understand that HprofConv was not yet developed for maximum
portability but for in-house use. I will experiment with your
HprofConv utility later.

Thanks!


On Jan 31, 3:15 am, fadden fad...@android.com wrote:
 On Jan 30, 3:39 pm, blindfold seeingwithso...@gmail.com wrote:

  Never mind, I found the culprit and fixed it. Not killing all threads
  when pressing the back button seems to have been the root cause of my
  problems.

 FYI, we do now have a tool that can convert Android hprof output
 into a format accepted by common heap analysis tools.  It's checked
 into cupcake but hasn't yet appeared in the git repository.

 For lack of a better place I'm hanging a temporary copy 
 here:http://bigflake.com/HprofConv.c.txt

 Once you get the hprof data (there are instructions somewhere, can't
 find them at the moment) you just need to run:

 % hprof-conv  android.hprof  standard.hprof

 This can then be fed into jhat (part of the JDK) or MAT or your
 favorite tool.
--~--~-~--~~~---~--~~
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: (simple?) problem with table layout

2009-01-31 Thread madcoder

Thanks guys, just what I needed!
--~--~-~--~~~---~--~~
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] filtering images for mime type

2009-01-31 Thread jj

Demo Tutorial for  filtering images for mime type
I am browsing list of images names of *.png ,*,jpeg, it is working
correctly
I am filtering images of type png and jpeg, IS there in other smart
way to achieve this, some thing we can do in manifest or   coding so
that we will get desired cursor of images(*.png and *.jpeg).

cursor = managedQuery(Media.EXTERNAL_CONTENT_URI, null, null, null,
null);

private void getColumnData(Cursor cur){
if (cur.moveToFirst()) {

String id;
String title;
String name;
String mime;
String imagePath;

int idColumn = cur.getColumnIndex(Media._ID);
int titleColumn = cur.getColumnIndex(Media.TITLE);
int nameColumn = cur.getColumnIndex(Media.DISPLAY_NAME);
int mimeColumn = cur.getColumnIndex
(Media.MIME_TYPE);

do {
// Get the field values
id = cur.getString(idColumn);
title = cur.getString(titleColumn);
name = cur.getString(nameColumn);
mime = cur.getString(mimeColumn);
if(mime.equals(image/jpeg)||mime.equals(image/png))
{
imagePath = id + : + title + : + name;

directoryFiles.add(imagePath);
}
} while (cur.moveToNext());

}
}


--~--~-~--~~~---~--~~
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: headset button

2009-01-31 Thread deepdr...@googlemail.com

you may want to look at

http://groups.google.com/group/android-developers/browse_thread/thread/1c64cf65f87c9895/1d9464c96b91dbd8?show_docid=1d9464c96b91dbd8



On Jan 30, 8:20 pm, Brodsky peter.brod...@gmail.com wrote:
 Hi!  Does anyone know how to tell when the headset button is being
 pressed?  I'd like to support the usb headsets and possibly bluetooth
 headsets.  My app is a media player and ideally, I could register it
 somewhere so that if no app that uses the headset button has focus it
 button press would act as a play/pause command in my app. If the phone
 is ringing or a call is in progress, I'd like to be sensitive to that
 and let the button do what it normally does: pickup and hang up
 calls.  we've been trying to chase the button down using this:

 IntentFilter headsetFilter = new IntentFilter
 (Intent.ACTION_HEADSET_PLUG);
 headsetFilter.addAction
 (android.intent.action.HEADSET_STATE_CHANGED);
 headsetFilter.addAction(android.bluetooth.intent.HEADSET_STATE);
 headsetFilter.addAction
 (android.bluetooth.intent.HEADSET_STATE_CHANGED);
 headsetFilter.addAction
 (android.bluetooth.intent.action.MODE_CHANGED);
 headsetFilter.addAction(android.intent.action.MODE_CHANGED);

 no luck as of yet.  Any help would be greatly appreciated!  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] WiFi in Emulator

2009-01-31 Thread Billy Bob

Hi all,

  I've been trying to create a local connection to a computer with a
Socket from the emulator thinking that it would automagically uses a
emulated wifi connection. It doesn't work, in particular because wifi
is not supported on the emulator:
  - Does a Socket connection automatically choose the fastest
connection (the wifi one if it exists).
  - Why wifi not supported by the emulator? Will it be?

   For those in countries still not blessed by the grace of having the
possibility to buy a Gphone, that can be useful...

BB
--~--~-~--~~~---~--~~
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] custom View using Adapter iface

2009-01-31 Thread skink

hi,

i want to create custom View showing possibly several items.

i think using Adapter interface would be good idea.

my question is: should i extend AdapterView? if so, what is the most
imortant when doing this (e.g. AdapterView is ViewGroup, so how should
i manage children)?

thanks,
pskink

--~--~-~--~~~---~--~~
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: custom View using Adapter iface

2009-01-31 Thread Marco Schmitz

take a look into the api samples. there are 14 lists, and one of them
has a very performant adapter...

greetings,
darolla

2009/1/31 skink psk...@gmail.com:

 hi,

 i want to create custom View showing possibly several items.

 i think using Adapter interface would be good idea.

 my question is: should i extend AdapterView? if so, what is the most
 imortant when doing this (e.g. AdapterView is ViewGroup, so how should
 i manage children)?

 thanks,
 pskink

 


--~--~-~--~~~---~--~~
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] custom View using Adapter iface

2009-01-31 Thread skink

hi,

i want to create custom View showing possibly several items.

i think using Adapter interface would be good idea.

my question is: should i extend AdapterView? if so, what is the most
imortant when doing this (e.g. AdapterView is ViewGroup, so how should
i manage children)?

thanks,
pskink

--~--~-~--~~~---~--~~
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: custom View using Adapter iface

2009-01-31 Thread Marco Schmitz

/**
 * Demonstrates how to write an efficient list adapter. The adapter
used in this example binds
 * to an ImageView and to a TextView for each row in the list.
 *
 * To work efficiently the adapter implemented here uses two techniques:
 * - It reuses the convertView passed to getView() to avoid inflating
View when it is not necessary
 * - It uses the ViewHolder pattern to avoid calling findViewById()
when it is not necessary
 *
 * The ViewHolder pattern consists in storing a data structure in the
tag of the view returned by
 * getView(). This data structures contains references to the views we
want to bind data to, thus
 * avoiding calls to findViewById() every time getView() is invoked.
 */
public class List14 extends ListActivity {

private static class EfficientAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private Bitmap mIcon1;
private Bitmap mIcon2;

public EfficientAdapter(Context context) {
// Cache the LayoutInflate to avoid asking for a new one each time.
mInflater = LayoutInflater.from(context);

// Icons bound to the rows.
mIcon1 =
BitmapFactory.decodeResource(context.getResources(),
R.drawable.icon48x48_1);
mIcon2 =
BitmapFactory.decodeResource(context.getResources(),
R.drawable.icon48x48_2);
}

/**
 * The number of items in the list is determined by the number
of speeches
 * in our array.
 *
 * @see android.widget.ListAdapter#getCount()
 */
public int getCount() {
return DATA.length;
}

/**
 * Since the data comes from an array, just returning the index is
 * sufficent to get at the data. If we were using a more complex data
 * structure, we would return whatever object represents one row in the
 * list.
 *
 * @see android.widget.ListAdapter#getItem(int)
 */
public Object getItem(int position) {
return position;
}

/**
 * Use the array index as a unique id.
 *
 * @see android.widget.ListAdapter#getItemId(int)
 */
public long getItemId(int position) {
return position;
}

/**
 * Make a view to hold each row.
 *
 * @see android.widget.ListAdapter#getView(int, android.view.View,
 *  android.view.ViewGroup)
 */
public View getView(int position, View convertView, ViewGroup parent) {
// A ViewHolder keeps references to children views to
avoid unneccessary calls
// to findViewById() on each row.
ViewHolder holder;

// When convertView is not null, we can reuse it directly,
there is no need
// to reinflate it. We only inflate a new View when the
convertView supplied
// by ListView is null.
if (convertView == null) {
convertView =
mInflater.inflate(R.layout.list_item_icon_text, null);

// Creates a ViewHolder and store references to the
two children views
// we want to bind data to.
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.text);
holder.icon = (ImageView) convertView.findViewById(R.id.icon);

convertView.setTag(holder);
} else {
// Get the ViewHolder back to get fast access to the TextView
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
}

// Bind the data efficiently with the holder.
holder.text.setText(DATA[position]);
holder.icon.setImageBitmap((position  1) == 1 ? mIcon1 : mIcon2);

return convertView;
}

static class ViewHolder {
TextView text;
ImageView icon;
}
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new EfficientAdapter(this));
}

private static final String[] DATA = {
Abbaye de Belloc, Abbaye du Mont des Cats, Abertam,
Abondance, Ackawi, Acorn, Adelost, Affidelice au Chablis,
Afuega'l Pitu, Airag, Airedale, Aisy Cendre, ...


2009/1/31 skink psk...@gmail.com:

 hi,

 i want to create custom View showing possibly several items.

 i think using Adapter interface would be good idea.

 my question is: should i extend AdapterView? if so, what is the most
 imortant when doing this (e.g. AdapterView is ViewGroup, so how should
 i manage children)?

 thanks,
 pskink

 


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

[android-developers] Re: custom themes?

2009-01-31 Thread Marco Schmitz

take a look here:

http://code.google.com/p/android-titlebar/

http://www.anddev.org/my_own_titlebar_backbutton_like_on_the_iphone-t4591.html

and here:

http://code.google.com/p/android-misc-widgets/

http://www.anddev.org/making_own_theme-t4052.html

greetings,
darolla

2009/1/31 Craig csab...@gmail.com:

 Could anyone post or point me to an example of using custom items in a
 theme?

 I've created a theme that uses custom attributes as item names, and I
 want to refer to those items in the code. I can see the theme is
 working because it also sets the android:windowBackground color.

 As a concrete example, I want an inactiveColor item in my
 Theme.GreenWithYellow to use in onDraw methods in my Views.

 I think this would be the right mechanism to use to have multiple
 color schemes for application specific purposes, but I would be happy
 to entertain other approaches, too.


 


--~--~-~--~~~---~--~~
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: button text change

2009-01-31 Thread Marco Schmitz

sometimes you need to invalidate()

greetings,
darolla

2009/1/31 Chander Pechetty cspeche...@gmail.com:

 Have you done setContentView(R.layout.yourLayout) before calling
 this. Looks ok to me, it certainly works for me.
 if you are doing this on a certain click , then make sure its
 clickable...
 button1.setClickable(true);


 -Chander

 On Jan 31, 10:37 am, Bob bshumsk...@yahoo.com wrote:
 Hi,
 How do I change the text on a button at run-time?  This code doesn't
 appear to do anything, what am I doing wrong:

  Button button1=(Button)findViewById(R.id.button1);
 button1.setText(Change text);

 Thanks,
 Bob
 


--~--~-~--~~~---~--~~
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: custom View using Adapter iface

2009-01-31 Thread skink



On 31 Sty, 12:39, Marco Schmitz netzprofi.ma...@googlemail.com
wrote:
 /**
  * Demonstrates how to write an efficient list adapter. */

thanks Marco, but i don't want to use ListViews.

i want to write my own custom View, since from some reasons ListViews
dont fit to my requirenents
--~--~-~--~~~---~--~~
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] texts are not adding to intent for email

2009-01-31 Thread jj

Hello
I am sending image using following. the image successfully send by
application. But The subject and text r not getting added to email.

I want to add body containing some hyperlink, I am doing this
Intent.EXTRA_TEXT but it is not going to added.

Will somebody will clear suggest me for. None of EXTRA working
(subject, title, text);

Uri uri = ContentUris.withAppendedId(Media.EXTERNAL_CONTENT_URI, 2);

Intent i = new Intent();

i.setAction(Intent.ACTION_SEND);
i.setType(image/jpeg);

i.putExtra(Intent.EXTRA_SUBJECT, jigsaw);
 i.putExtra(Intent.EXTRA_TEXT, http://code.google.com/
android);

i.putExtra(Intent.EXTRA_TITLE, ETitle);
i.putExtra(Intent.EXTRA_STREAM, uri);
i = Intent.createChooser(i, Send);
startActivity(i);
--~--~-~--~~~---~--~~
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: i hope to Android dev.

2009-01-31 Thread Fred Grott(shareme)

ahem, use android discuss list please

On Jan 30, 8:43 pm, agus tegar agoestafin.gr...@gmail.com wrote:
 i hope android dev .
 focus to :
 Theme Style    = with multi theme ( mac , android, iphon , vista ,win
 7 ) ,
 effect animation ,
 google earth ,
 google Drive for android ,
 and
 Window Child in Desktop Android  ( it's for netbook or PC android )

 we have big enemy ..
 (iphone frimware 2.2 ,nokia , palm pre ,and BB , )

 and i hope . android cupcake  make big revolution ..

 think deffreent ...with them

 think deffreent ... with them

 think deffreent ... with them

 think deffreent ... with them

 think deffreent ... with them

 make big revolution 
--~--~-~--~~~---~--~~
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] MediaRecorder - No value other than 0 returned from getMaxAmplitude

2009-01-31 Thread ph...@grantmidwinter.com

I've got a media recorder, prepared and started in the following way:

mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat
(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder
(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile(/sdcard/test.3gpp);
mRecorder.prepare();
mRecorder.start();

I'm then using a thread to return the mRecorder.getMaxAmplitude int,
but it never returns as anything but 0. I've looked all over for why
this might be happening - but I'm at a complete loss now so help would
really be appreciated.

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: custom themes?

2009-01-31 Thread Craig

I'm sorry if I missed it, but I didn't see what I was looking for
behind any of those links. I know I can create a custom theme to use
android attributes; what I want to do is create a custom theme with
custom attributes, and refer to those in my code.


--~--~-~--~~~---~--~~
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: button text change

2009-01-31 Thread Phill Midwinter
Have you set the button id correctly in the XML layout?

2009/1/31 Marco Schmitz netzprofi.ma...@googlemail.com


 sometimes you need to invalidate()

 greetings,
 darolla

 2009/1/31 Chander Pechetty cspeche...@gmail.com:
 
  Have you done setContentView(R.layout.yourLayout) before calling
  this. Looks ok to me, it certainly works for me.
  if you are doing this on a certain click , then make sure its
  clickable...
  button1.setClickable(true);
 
 
  -Chander
 
  On Jan 31, 10:37 am, Bob bshumsk...@yahoo.com wrote:
  Hi,
  How do I change the text on a button at run-time?  This code doesn't
  appear to do anything, what am I doing wrong:
 
   Button button1=(Button)findViewById(R.id.button1);
  button1.setText(Change text);
 
  Thanks,
  Bob
  
 

 



-- 
Phill Midwinter
Director
Grant Midwinter Limited
d: 0844 736 5234 x: 0
m: 07538 082156
e: ph...@grantmidwinter.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] Re: custom themes?

2009-01-31 Thread skink



Craig wrote:
 I'm sorry if I missed it, but I didn't see what I was looking for
 behind any of those links. I know I can create a custom theme to use
 android attributes; what I want to do is create a custom theme with
 custom attributes, and refer to those in my code.

hi,

all you need to do is obtain current theme by getTheme()

than call on it obtainStyledAttributes()

you will receive TypedArray

and finally you can call any get* on it

pskink
--~--~-~--~~~---~--~~
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: Emulator crashs when accessing sd card settings

2009-01-31 Thread Chander Pechetty

Did anyone taste success?  I am facing the same issue with SD card
settings/Image application settings crashing with the same exception
reported above..
Here's what i did:
1. emulator -sdcard ./sdcard1.iso  (sdcard image in my current
directory)
2. adb push PaymentError.png /sdcard/
Steps 1 and 2 are ok . But going to SD settings , it goes haywire

I am on

Ubuntu 8.10
java version 1.6.0_10
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)



On Jan 25, 6:49 pm, Mariano Kamp mariano.k...@gmail.com wrote:
 Nope, at least not in my case.

 I specify one using the sdcard option, but it also fails for the built-in
 one. Anyway accessing the emulated sdcard works for me.

 On Sat, Jan 24, 2009 at 10:37 PM, Mark Murphy mmur...@commonsware.comwrote:



  Jeremy Leibs wrote:
   Any progress on this?  I am having the exact same problem.  It is
   driving me crazy.

  Where is the image?

  I had some problems for a while trying to use an SD image stored on a
  USB thumb drive formatted vfat. I just moved the image to the main drive
  (ext3).

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

  Android Training on the Ranch! -- Mar 16-20, 2009
 http://www.bignerdranch.com/schedule.shtml
--~--~-~--~~~---~--~~
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: local service getting killed

2009-01-31 Thread Guillaume Perrot

Yes, i ran into the very same problem.
From what I understood with documentation and logcat traces, I may be
wrong for some details but here's the general idea:
My background service (I use startService/stopService to handle an
XMPP connection and notifying the user of events when no activity is
running/binding to it) can be killed when the phone is on low memory
(e.g. under 16 MB on my G1, this the value of the threshold, see the
ActivityManager class, very interesting monitoring functions...).
Android first calls onLowMemory() on Activity, Service and Application
classes to give applications a chance to free some memory.
After that, android kills the most memory consumer services until the
phone's free memory is greater than the threshold, in the logcat you
will see tons of traces about all that process.
Services that are killed for memory reasons are scheduled for a
restart (you will also see a logcat trace for that).

On Jan 30, 9:09 pm, brs bernhard.r.su...@gmail.com wrote:
 I have an app loosely based on the LocalService example from the SDK
 with a controller activity and a long-running, stateful service which
 is doing stuff on a periodic handler. The service is also a bit of a
 memory hog.

 It seems that the service is sometimes killed by the activity-manager
 and immediately restarted. I don't see any stack trace, so I assume it
 is not the application crashing but the system doing that, presumably
 to claim resources. Is that what is going on here?

 Is there a way to tell the system that this process is kind of
 important, even though it has no foreground activity and should only
 be killed as a last resort?

 Bernhard
--~--~-~--~~~---~--~~
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: Memory leak in BitmapFactory/Gallery?

2009-01-31 Thread Guillaume Perrot

There is bug in BitmapFactory memory allocation, there are tons of
threads in this mailing list dealing with that.
To sum up:
At a normal time when you create an object, the heap size is
automatically grown if not sufficient enough (there is an absolute
limit of 16MB per process though, you will crash if you exceed this).
But the bitmap factory allocates memory in a non Java way, it uses
native code to do that, and the heap growing process fails if not
enough memory in this case!
So even if you are far under the 16MB limit, if you are unlucky enough
to have the heap grown up for your image to be allocated, you will
have an OutOfMemoryError
Some guys claim that this crash can be avoided by catching this error
(catching an error instead of an exception is quite unusual by the
way)...

On Jan 18, 12:31 am, EboMike ebom...@gmail.com wrote:
 Hey gym,

 1) You don't have to go that far. No need to close or reset anything,
 simply run the app from within the emulator (obviously, you need to
 update it via adb install -r or something if you changed it). It will
 show up in the process list in the DDMS, but you'll see that it
 doesn't have that cute bug next to it. You can still add the heap
 watch to it, this will not affect anything. And you can always attach
 the debugger later if you need to debug something -- if you have the
 heap watch on too, you might be able to see a change in behavior as
 soon as you attach it. In my test app that repeatedly called
 BitmapFactory.decodeFile and/or threw an exception, I noticed an
 immediate continual increase in memory usage until it OOMed.

 2) You won't necessarily see any garbage collection until the VM
 decides to collect. That's okay. It doesn't matter if your app takes
 up 15MB without ever collecting garbage. But as soon as you do an
 allocation that exceeds the amount of available RAM, the gc should
 kick in and take out the trash. Basically, it's all good as long as
 you don't OOM. If you OOM, something went wrong.

 Please note the very beginning of this thread - there is a known
 problem in the Gallery class, it never recycles its views. However, I
 have an app that uses two Galleries, both of them using
 BitmapFactory.decodeFile(). I've run it on my device, sometimes with
 1000 entries in the Gallery and scrolling like crazy, and I've never
 OOMed. If I have the debugger attached, I OOM pretty quickly.

 3) Interesting. SHOULDN'T happen, the VM should automatically gc as
 soon as you're running out of memory.

 Are you doing anything funky with your Bitmap/Drawable objects? How do
 you manage them?

 On Jan 17, 9:03 am, gymshoe gyms...@bresnan.net wrote:

  I have noted the following discrepancies compared to the descriptions
  here, using a similar, simple application which uses Gallery, and
  BitmapFactory:

  1) EboMike, How exactly do I run the application without a debugger
  attached?  I assume that closing Eclipse entirely, and launching a
  new emulator from a DOS prompt (without Eclispe running) would be the
  equivalent of not having a debugger attached.

  When I do this, I get the same memory leak problem as I always did...

  2) When I have the DDMS attached and running, the heap size doesn't
  show any garbage collection (see below) going on for my gallery
  application (unless I click on Cause GC)...

  3) If I call System.GC() intermittently directly in my application
  (calling this method alone, and not as part of a {gc() /
  runFinalization() / gc()} sequence), this prevents OOM, and then I can
  see the GC altering the heap size (in DDMS).

  Jim

  On Jan 9, 6:37 pm, fadden fad...@android.com wrote:

   On Jan 9, 4:47 pm, Mark K mark.ka...@gmail.com wrote:

   I've tried it with no de-bugger, on the emulator, and on actual G1
hardware, I can't seem to get rid of the problem entirely. I only
process and use one bitmap at a time, bitmaps are recycled after use,
and I invoke gc(). The Runtime free memory indicates that I always
have over 10 MB free, each bitmap is less than 3.5 MB, yet this
problem still ocurs intermittently.

   What does logcat show at the point of the failure?  Should see some
   additional traffic, e.g.:

   01-09 16:13:02.739 D/dalvikvm(  178): GC freed 494 objects / 31264
   bytes in 265ms
   01-09 16:13:02.829 I/dalvikvm-heap(  178): Grow heap (frag case) to
   4.558MB for 998301-byte allocation
   01-09 16:13:03.039 D/dalvikvm(  178): GC freed 133 objects / 6192
   bytes in 196ms

   Bitmap allocations are done outside of the virtual heap, but are
   counted against it.  This was done somewhat late in the game and not
   all of the tools will include the bitmap heap allocation numbers in
   with the actual virtual heap allocations.  If you're getting an OOM
   you should see it bumping up against the 16MB limit in the logs.

   FWIW, the only thing worse than explicit calls to System.gc() is
   following those with explicit calls to System.runFinalization(), which
   in Dalvik will block 

[android-developers] Can i block certain users in Android Market

2009-01-31 Thread Josh

Is there a way too block individual users access to your applications
on android market?
Also is there a way to reply to comments left for your application?
--~--~-~--~~~---~--~~
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: WiFi in Emulator

2009-01-31 Thread David Turner
there is a single ethernet port in the emulated system. It is connected to
an internal firewall/router within the emulator code that emulates all
connectivity through standard BSD sockets. Which connection is used depends
entirely on your host machine setup, but wifi or no wifi doesn't have any
importance to the emulated system.

second, wifi is not supported in the emulator because it is darn impossible
to properly emulate that at the low-level protocol layer, and doing any kind
of bridging at a higher layer requires invasive modifications to the system
that would be no use to a normal device (except that they introduce much
more complexity and potential for bugs / security issues).

in the future, we're likely to create emulator-specific system images that
can have all kinds of hacks in them to support whatever weird feature, if
possible. Right now, we're essentially using the same system images for
devices and the emulator, which makes this kind of modifications
unreasonable.

(yes, it also means that current device images already have a few
emulator-specific hacks in them, and we want to get rid of them).

On Sat, Jan 31, 2009 at 12:50 PM, Billy Bob billybob5...@gmail.com wrote:


 Hi all,

  I've been trying to create a local connection to a computer with a
 Socket from the emulator thinking that it would automagically uses a
 emulated wifi connection. It doesn't work, in particular because wifi
 is not supported on the emulator:
  - Does a Socket connection automatically choose the fastest
 connection (the wifi one if it exists).
  - Why wifi not supported by the emulator? Will it be?

   For those in countries still not blessed by the grace of having the
 possibility to buy a Gphone, that can be useful...

 BB
 


--~--~-~--~~~---~--~~
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's the trick to do a (forward) geocode?

2009-01-31 Thread Faber Fedor
IIUC, doing a forward geocode (looking up an address from a name) is pretty
straightforward, you do this:

private void findLocation() {

ListAddress locations = null;
Geocoder geocoder = new Geocoder(this, Locale.getDefault());

try {
locations =
geocoder.getFromLocationName(mName.getText().toString(), 5);
} catch (IOException e) {}
}

If I put in The White House or  AP Washington NJ, I get nothing back,
but the application Locale shows both.  If I put in The Empire State
Building, I do get an address back.

What's the trick?

-- 

Faber Fedor
Cloud Computing New Jersey
http://cloudcomputingnj.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] Re: MediaRecorder - No value other than 0 returned from getMaxAmplitude

2009-01-31 Thread Phill Midwinter
Looking at adb logcat I'm getting this error:

*Record channel already open*

Could this be a bug? I don't understand how it could already be open..
nothing else is recording on the device?

2009/1/31 ph...@grantmidwinter.com ph...@grantmidwinter.com


 I've got a media recorder, prepared and started in the following way:

 mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat
 (MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder
 (MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile(/sdcard/test.3gpp);
mRecorder.prepare();
mRecorder.start();

 I'm then using a thread to return the mRecorder.getMaxAmplitude int,
 but it never returns as anything but 0. I've looked all over for why
 this might be happening - but I'm at a complete loss now so help would
 really be appreciated.

 Thanks.
 



-- 
Phill Midwinter
Director
Grant Midwinter Limited
d: 0844 736 5234 x: 0
m: 07538 082156
e: ph...@grantmidwinter.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] Re: button text change

2009-01-31 Thread Bob

Figured it out, real silly mistake.  I was calling setContentView
(R.layout.myLayout) twice, once before and once after my code.  Thanks
for all your help!

On Jan 31, 9:02 am, Phill Midwinter ph...@grantmidwinter.com wrote:
 Have you set the button id correctly in the XML layout?

 2009/1/31 Marco Schmitz netzprofi.ma...@googlemail.com





  sometimes you need to invalidate()

  greetings,
  darolla

  2009/1/31 Chander Pechetty cspeche...@gmail.com:

   Have you done setContentView(R.layout.yourLayout) before calling
   this. Looks ok to me, it certainly works for me.
   if you are doing this on a certain click , then make sure its
   clickable...
   button1.setClickable(true);

   -Chander

   On Jan 31, 10:37 am, Bob bshumsk...@yahoo.com wrote:
   Hi,
   How do I change the text on a button at run-time?  This code doesn't
   appear to do anything, what am I doing wrong:

    Button button1=(Button)findViewById(R.id.button1);
           button1.setText(Change text);

   Thanks,
   Bob

 --
 Phill Midwinter
 Director
 Grant Midwinter Limited
 d: 0844 736 5234 x: 0
 m: 07538 082156
 e: ph...@grantmidwinter.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] Re: MediaRecorder - No value other than 0 returned from getMaxAmplitude

2009-01-31 Thread Dave Sparks

Are you running on a G1 or on the emulator? If on the emulator, maybe
audio input isn't working correctly and it's failing to open the audio
input device.

On Jan 31, 9:59 am, Phill Midwinter ph...@grantmidwinter.com wrote:
 Looking at adb logcat I'm getting this error:

 *Record channel already open*

 Could this be a bug? I don't understand how it could already be open..
 nothing else is recording on the device?

 2009/1/31 ph...@grantmidwinter.com ph...@grantmidwinter.com





  I've got a media recorder, prepared and started in the following way:

  mRecorder = new MediaRecorder();
             mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
             mRecorder.setOutputFormat
  (MediaRecorder.OutputFormat.THREE_GPP);
             mRecorder.setAudioEncoder
  (MediaRecorder.AudioEncoder.AMR_NB);
             mRecorder.setOutputFile(/sdcard/test.3gpp);
             mRecorder.prepare();
             mRecorder.start();

  I'm then using a thread to return the mRecorder.getMaxAmplitude int,
  but it never returns as anything but 0. I've looked all over for why
  this might be happening - but I'm at a complete loss now so help would
  really be appreciated.

  Thanks.

 --
 Phill Midwinter
 Director
 Grant Midwinter Limited
 d: 0844 736 5234 x: 0
 m: 07538 082156
 e: ph...@grantmidwinter.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] Re: MediaRecorder - No value other than 0 returned from getMaxAmplitude

2009-01-31 Thread Phill Midwinter
I was running on a G1.

I've just found the problem though. On previous debug sessions - the
mediarecorder hadn't been properly released.

Solution was to reboot the phone, add overrides to onpause and ondestroy,
making sure it's released in each case and then run again. Works like a
charm!

2009/1/31 Dave Sparks davidspa...@android.com


 Are you running on a G1 or on the emulator? If on the emulator, maybe
 audio input isn't working correctly and it's failing to open the audio
 input device.

 On Jan 31, 9:59 am, Phill Midwinter ph...@grantmidwinter.com wrote:
  Looking at adb logcat I'm getting this error:
 
  *Record channel already open*
 
  Could this be a bug? I don't understand how it could already be open..
  nothing else is recording on the device?
 
  2009/1/31 ph...@grantmidwinter.com ph...@grantmidwinter.com
 
 
 
 
 
   I've got a media recorder, prepared and started in the following way:
 
   mRecorder = new MediaRecorder();
  mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  mRecorder.setOutputFormat
   (MediaRecorder.OutputFormat.THREE_GPP);
  mRecorder.setAudioEncoder
   (MediaRecorder.AudioEncoder.AMR_NB);
  mRecorder.setOutputFile(/sdcard/test.3gpp);
  mRecorder.prepare();
  mRecorder.start();
 
   I'm then using a thread to return the mRecorder.getMaxAmplitude int,
   but it never returns as anything but 0. I've looked all over for why
   this might be happening - but I'm at a complete loss now so help would
   really be appreciated.
 
   Thanks.
 
  --
  Phill Midwinter
  Director
  Grant Midwinter Limited
  d: 0844 736 5234 x: 0
  m: 07538 082156
  e: ph...@grantmidwinter.com
 



-- 
Phill Midwinter
Director
Grant Midwinter Limited
d: 0844 736 5234 x: 0
m: 07538 082156
e: ph...@grantmidwinter.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] Re: gapless playback

2009-01-31 Thread Dave Sparks

Yes, two reasons actually.

One, because the Ogg spec allows for specifying the exact number of
samples in the stream. MP3 does not have an official way to specify
the number of samples (there are unofficial ways).

Two, because the Ogg player has a native loop capability that allows
us to seamlessly loop at the exact sample boundary. OpenCore does not
support seamless loops, we have to explicitly seek to the beginning of
the file in loop mode. Thus any streams that are rendered by OpenCore
(i.e. everything but Ogg and MIDI) will have gaps.

On Jan 31, 1:01 am, Phill Midwinter ph...@grantmidwinter.com wrote:
 That works perfectly, thanks for the help.

 Do you know why it works?

 2009/1/31 Dave Sparks davidspa...@android.com





  Use Ogg files, you can get a nice seamless loop. We use this for the
  ringtones.

  On Jan 30, 10:30 am, ph...@grantmidwinter.com
  ph...@grantmidwinter.com wrote:
   Hoya,

   When using a mediaplayer to play back an audio file, you can set
   looping to true - that's not the issue here.

   If looping is set to true, there's still an audible gap between the
   file finishing and then starting again.

   How could I achieve true gapless playback? I've attempted using two
   instances of the same file, overriding oncomplete and onseek.. can't
   seem to improve the gap though. Any help appreciated.

 --
 Phill Midwinter
 Director
 Grant Midwinter Limited
 d: 0844 736 5234 x: 0
 m: 07538 082156
 e: ph...@grantmidwinter.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] Re: Leaked window in PreferenceActivity

2009-01-31 Thread AusR

Can anyone offer any ideas on this?

Thanks!


On Jan 30, 9:39 am, AusR austinjr...@gmail.com wrote:
 Hi,

 I've created a set of preference screens building on the tuts on
 androidguys.

 My preference XML contains nested PreferenceScreens. The below doesn't
 occur in the root screen, only once clicking to a child
 PreferenceScreen.
 Once in that PreferenceScreen, even before selecting an
 EditPreference, if I change orientation (i.e. flick the G1 keyboard
 out) I get an error:

 01-30 09:33:54.080: ERROR/WindowManager(1261):
 android.view.WindowLeaked: Activity classname has leaked window
 com.android.internal.policy.impl.phonewindow$decorv...@43170d78 that
 was originally added here

 I have previously overcome this in other activities by utilising the
 onPause etc methods with custom dialogs I use. How can I prevent this
 in the PreferenceActivity? What am I missing?

 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: MapView disable?

2009-01-31 Thread Dave Sparks

I don't know anything about MapView. What service are you on e.g.
WiFi, 3G/EDGE (what carrier)? Is there anything useful in the log?
Maybe a proxy failure?

On Jan 30, 5:46 pm, Keiji Ariyama ml_andr...@c-lis.co.jp wrote:
 Hi folks,

 Now, I'm developing an Android app called Echo.
 But 5 hours ago, My Dev phone haven't displayed MapView.

 First, I supposed that my API-key have been disabled.
 I tried to Maps API Key signup agian. But google server response error.

  Server Error
  The server encountered a temporary error and could not complete your 
  request.

  Please try again in 30 seconds.

 And not only Echo but also other all map apps cannot display map.

 Default map apps display error message that [Attention] There is a
 connection problem... we'll keep trying..

 If you can think of anything that may help me, I'll appreciate it.

 --
 Keiji,
 ml_andr...@c-lis.co.jp
--~--~-~--~~~---~--~~
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: gapless playback

2009-01-31 Thread Phill Midwinter
That's extremely useful, I've not looked at the format before, but I'll have
to read up now.

2009/1/31 Dave Sparks davidspa...@android.com


 Yes, two reasons actually.

 One, because the Ogg spec allows for specifying the exact number of
 samples in the stream. MP3 does not have an official way to specify
 the number of samples (there are unofficial ways).

 Two, because the Ogg player has a native loop capability that allows
 us to seamlessly loop at the exact sample boundary. OpenCore does not
 support seamless loops, we have to explicitly seek to the beginning of
 the file in loop mode. Thus any streams that are rendered by OpenCore
 (i.e. everything but Ogg and MIDI) will have gaps.

 On Jan 31, 1:01 am, Phill Midwinter ph...@grantmidwinter.com wrote:
  That works perfectly, thanks for the help.
 
  Do you know why it works?
 
  2009/1/31 Dave Sparks davidspa...@android.com
 
 
 
 
 
   Use Ogg files, you can get a nice seamless loop. We use this for the
   ringtones.
 
   On Jan 30, 10:30 am, ph...@grantmidwinter.com
   ph...@grantmidwinter.com wrote:
Hoya,
 
When using a mediaplayer to play back an audio file, you can set
looping to true - that's not the issue here.
 
If looping is set to true, there's still an audible gap between the
file finishing and then starting again.
 
How could I achieve true gapless playback? I've attempted using two
instances of the same file, overriding oncomplete and onseek.. can't
seem to improve the gap though. Any help appreciated.
 
  --
  Phill Midwinter
  Director
  Grant Midwinter Limited
  d: 0844 736 5234 x: 0
  m: 07538 082156
  e: ph...@grantmidwinter.com
 



-- 
Phill Midwinter
Director
Grant Midwinter Limited
d: 0844 736 5234 x: 0
m: 07538 082156
e: ph...@grantmidwinter.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] Re: custom themes?

2009-01-31 Thread Craig

Thanks! That did it. Here is an example of the code I used:

  final private static int[] colorAttrs = new int[]
{R.attr.activeColor, ...};

I chained my View constructors:
  public MyView(Context context) {this(context, null);}
  public MyView(Context context, AttributeSet attrs) {this(context,
attrs, 0);}
  public MyView(Context context, AttributeSet attrs, int defStyle)
{...}

in the last constructor I have:

  Theme t = context.getTheme();
  Arrays.sort(colorAttrs);
  TypedArray themeStyles = t.obtainStyledAttributes(colorAttrs);
  activeColor = getColor(themeStyles, R.attr.activeColor);
  ...

with the getColor method:

  private int getColor(TypedArray themeStyles, int attrResid) {
return (int)themeStyles.getColor(Arrays.binarySearch(colorAttrs,
attrResid), 0);
  }


I hope this helps someone else.
-Craig

--~--~-~--~~~---~--~~
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: custom themes?

2009-01-31 Thread skink



Craig wrote:
 Thanks! That did it. Here is an example of the code I used:

   final private static int[] colorAttrs = new int[]
 {R.attr.activeColor, ...};

 I chained my View constructors:
   public MyView(Context context) {this(context, null);}
   public MyView(Context context, AttributeSet attrs) {this(context,
 attrs, 0);}
   public MyView(Context context, AttributeSet attrs, int defStyle)
 {...}

 in the last constructor I have:

   Theme t = context.getTheme();
   Arrays.sort(colorAttrs);
   TypedArray themeStyles = t.obtainStyledAttributes(colorAttrs);
   activeColor = getColor(themeStyles, R.attr.activeColor);
   ...

 with the getColor method:

   private int getColor(TypedArray themeStyles, int attrResid) {
 return (int)themeStyles.getColor(Arrays.binarySearch(colorAttrs,
 attrResid), 0);
   }


 I hope this helps someone else.
 -Craig

i believe its somehow overcomplicated...

how and where did you define activeColor, and thus
R.attr.activeColor?
can you post xml file where you did it?

pskink
--~--~-~--~~~---~--~~
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 add extra elements into Cursor or SimpleCursorAdapter?

2009-01-31 Thread Developer

Suppose I get a cursor that contains all rows from my database, and I
want to show them on a spinner, the following code will work. But I
want to show two extra items as the spinner elements, how can I add
those two elements?

For example, if the following code can show 4 spinner elements
Orange Apple Cabbage Green Onion, how can I add an element in
the spinner saying All fruit All Vegetable?

Thanks


class ShowElements extends Activity {
.
private void populateSpinner() {
Cursor cursor = mDbHelper.fetchAllExistingElements();  // get
all items
startManagingCursor(cursor);
String[] from = new String[]{ ShowElements.KEY_NAME };
int[] to = new int[]{android.R.id.text1};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
this, android.R.layout.simple_spinner_item, cursor, 
from,
to);
adapter.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
mCardSpinner.setAdapter(adapter);
}
}
--~--~-~--~~~---~--~~
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: Audio in the emulator...

2009-01-31 Thread nicolas cosson

Hello,

I have been searching for some time and I can't find a detailled
tutorial on how to easily record and then read audio on the emulator
under eclipse. I have found these steps:

- You have to install a virtual sd card with mksdcard.exe 1024M
sdimg.iso

-then run the emulator : emulator.exe -sdcard
sdimg.iso//where sdimg.iso it is the path to
the sdcard

-then run adb.exe : adb push local_file sdcard/remote_file

-then you should put : uses-permission
android:name=android.permission.RECORD_AUDIO/uses-permission in
the androidmanifest.xml

-then there is some code to implement which should look like :
private void startRecord() {

   recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);  //ok so
I say audio source is the microphone, is it windows/linux microphone
on the emulator?
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(/sdcard/test.3gpp);

recorder.prepare();
recorder.start();


}

-then you should stop with : recorder.stop(); // at some point (I have
no idea when and where to decide to stop but I haven't searched yet)

-then you should play it.



I have also heard about : 
http://code.google.com/intl/fr/android/reference/emulator.html#sdcard
in this page of the manual (~1/4 of the total scroll), there are some
informations about Emulator Startup Options, one of them is about
Media  -audio backend
I couldn't find much about that backend thing, google didn't said much
about it. I still don't know if it's important to the audio recording
process.


The fact is all these steps are pretty blurry to me, and I believe I
am not the only android newbie trying to record some sound :)

Anyone knows where we can find a complete tutorial for dummies
teaching this feature?

Any help is of course greatly appreciated

Thanks.

On 27 jan, 20:08, Breno breno.min...@gmail.com wrote:
 Hey Andrei,

            To recordaudioit's pretty easy. But, you must record in
 sdcard, only. Be sure your path to file it's pointing to sdcard, and
 you have one mounted in eclipse (or something else). It's working
 perfectly.

 Regards

 Breno

 On Jan 15, 8:58 am, Andrei Craciun avcrac...@gmail.com wrote:

  Thanks David...

  2009/1/15 David Turner di...@android.com

   the emulator now supportsaudiorecording. If you have problems with it,
   you should report mode detailed information about it here

   On Thu, Jan 15, 2009 at 11:05 AM, Andrei Craciun 
   avcrac...@gmail.comwrote:

   Hi All,
   As reported on this blog:
  http://blog.roychowdhury.org/2008/04/29/sip-ua-for-android-stack-rtp-...some
   problems inrecordingaudioon the emulator, but everything
   works fine on the real phone. Does anyone has a workaround forrecording
  audioon the emulator?

   Thanks in advance,
   A.

--~--~-~--~~~---~--~~
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 get the position of the click point.

2009-01-31 Thread Hongfei Jiang

Hi,
I'm working on a simple application, I need the application to give
different response when the user click different position of the
screen. But it seems I can't get the position in the OnClickLisenter,
I tried OnTouchListener, but it's not as well as I expected. Can you
give me some help on 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
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] Android Maps API Key gets 502 Server Error

2009-01-31 Thread sonxurxo

Hi, I'm trying to sign up my app (even with debug key, I don't need a
custom key by now) and I get a Server Error 502. Anyone knows what's
happening? How long will it take? I need the key for February 2nd.
Please if anyone has a valid debug key could post it for me? (I'm
reading my career thesis and I need that key!) 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] Android Development Forum

2009-01-31 Thread Sushrut Bidwai

Hey Androiders,

  Buzz is happening around Android already. Off course there are
developer groups, where we can find out answers to questions. But we
(www.androidcompetencycenter.com/) have decided to provide support to
all developers through newly launched forums. Do check out the blog,
discuss, bounce each other off with questions. Looking forward for
great discussions on the blog.

Best Regards,
Sushrut
PS - I hope this discussion was not spammy, I thought it was relevant
enough.

--~--~-~--~~~---~--~~
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: MediaRecorder - No value other than 0 returned from getMaxAmplitude

2009-01-31 Thread nicolas cosson

are you testing it on the emulator or on the G1 device?

I'm not sure about it but I've read around some forums that you need a
virtual sd card to record audio on the emulator. (with the
mksdcard.exe in the tools provided with the sdk)
Some other sources also say it isn't possible to record audio on the
emulator yet.

Check if you can read/hear what you have recorded since you are using
a sdcard, maybe the sdcard is too small.

Why would you use a thread to return the max amplitude?

I am myself looking forward to record audio on the emulator and
constantly find contradictory informations about whether it's possible
or not.
the manual says it's not.

Any insight about that is appreciated in addition to the upper
problem.

thanks



On 31 jan, 15:12, ph...@grantmidwinter.com
ph...@grantmidwinter.com wrote:
 I've got a media recorder, prepared and started in the following way:

 mRecorder = new MediaRecorder();
             mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
             mRecorder.setOutputFormat
 (MediaRecorder.OutputFormat.THREE_GPP);
             mRecorder.setAudioEncoder
 (MediaRecorder.AudioEncoder.AMR_NB);
             mRecorder.setOutputFile(/sdcard/test.3gpp);
             mRecorder.prepare();
             mRecorder.start();

 I'm then using a thread to return the mRecorder.getMaxAmplitude int,
 but it never returns as anything but 0. I've looked all over for why
 this might be happening - but I'm at a complete loss now so help would
 really be appreciated.

 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] problem with new SDK version android-sdk-windows-1.0_r2

2009-01-31 Thread Ahsan

Hi, I am using the latest SDK android-sdk-windows-1.0_r2 and android
plugin version 0.8.0.v200809220836-110569 But everytime i try to run
an application, the console shows following messages. and DDMS view
shows no device.

[2009-01-31 23:27:02 - test] --
[2009-01-31 23:27:02 - test] Android Launch!
[2009-01-31 23:27:02 - test] adb is running normally.
[2009-01-31 23:27:02 - test] Launching: com.nextigen.t1.Test
[2009-01-31 23:27:02 - test] Automatic Target Mode: launching new
emulator.
[2009-01-31 23:27:02 - test] Launching a new emulator.
[2009-01-31 23:27:13 - test] New emulator found: emulator-5554
[2009-01-31 23:27:13 - test] Waiting for HOME
('android.process.acore') to be launched...
[2009-01-31 23:28:29 - test] emulator-5554 disconnected! Cancelling
'com.nextigen.t1.Test' launch!

What can be the possible reason? please help

--~--~-~--~~~---~--~~
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 add extra elements into Cursor or SimpleCursorAdapter?

2009-01-31 Thread Mark Murphy

Developer wrote:
 Suppose I get a cursor that contains all rows from my database, and I
 want to show them on a spinner, the following code will work. But I
 want to show two extra items as the spinner elements, how can I add
 those two elements?
 
 For example, if the following code can show 4 spinner elements
 Orange Apple Cabbage Green Onion, how can I add an element in
 the spinner saying All fruit All Vegetable?

Here are some ideas...

Option #1: Put the extra two in the database.

Option #2: Don't pass the Cursor into SimpleCursorAdapter, but rather
iterate over the Cursor, put the results into an ArrayList or something,
and use that with an ArrayAdapter.

Option #3: Create a CursorWrapper that injects your two extra values
into the results.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~-~--~~~---~--~~
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: Want to help us port our iPhone app to Android?

2009-01-31 Thread beachy

keen, can you send me an email with some details

beachy.g...@gmail.com

On Jan 30, 2:55 pm, cmxlgy cmx...@gmail.com wrote:
 Hi all -

 Just curious if anyone would be interested in helping us port our
 iPhone app to Android? It would be on a revenue share basis. Drop us a
 line off-list.

 Link to app:

 http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=297...

 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: Memory leak in BitmapFactory/Gallery?

2009-01-31 Thread EboMike

Guillaume, that kind of sounds like you're running with a debugger
attached... see somewhere in the middle of this long thread, it is
known that the system will leak memory when you run with a debugger
attached - mostly when exceptions are involved, and
BitmapFactory.decodeFile() always throws (and catches) an exception.

Do you get the same results when you run without a debugger? All my
memory woes have been fixed when I stopped using a debugger except
when necessary.

-Mike


On Jan 31, 8:14 am, Guillaume Perrot guillaume.p...@gmail.com wrote:
 There is bug in BitmapFactory memory allocation, there are tons of
 threads in this mailing list dealing with that.
 To sum up:
 At a normal time when you create an object, the heap size is
 automatically grown if not sufficient enough (there is an absolute
 limit of 16MB per process though, you will crash if you exceed this).
 But the bitmap factory allocates memory in a non Java way, it uses
 native code to do that, and the heap growing process fails if not
 enough memory in this case!
 So even if you are far under the 16MB limit, if you are unlucky enough
 to have the heap grown up for your image to be allocated, you will
 have an OutOfMemoryError
 Some guys claim that this crash can be avoided by catching this error
 (catching an error instead of an exception is quite unusual by the
 way)...

 On Jan 18, 12:31 am, EboMike ebom...@gmail.com wrote:

  Hey gym,

  1) You don't have to go that far. No need to close or reset anything,
  simply run the app from within the emulator (obviously, you need to
  update it via adb install -r or something if you changed it). It will
  show up in the process list in the DDMS, but you'll see that it
  doesn't have that cute bug next to it. You can still add the heap
  watch to it, this will not affect anything. And you can always attach
  the debugger later if you need to debug something -- if you have the
  heap watch on too, you might be able to see a change in behavior as
  soon as you attach it. In my test app that repeatedly called
  BitmapFactory.decodeFile and/or threw an exception, I noticed an
  immediate continual increase in memory usage until it OOMed.

  2) You won't necessarily see any garbage collection until the VM
  decides to collect. That's okay. It doesn't matter if your app takes
  up 15MB without ever collecting garbage. But as soon as you do an
  allocation that exceeds the amount of available RAM, the gc should
  kick in and take out the trash. Basically, it's all good as long as
  you don't OOM. If you OOM, something went wrong.

  Please note the very beginning of this thread - there is a known
  problem in the Gallery class, it never recycles its views. However, I
  have an app that uses two Galleries, both of them using
  BitmapFactory.decodeFile(). I've run it on my device, sometimes with
  1000 entries in the Gallery and scrolling like crazy, and I've never
  OOMed. If I have the debugger attached, I OOM pretty quickly.

  3) Interesting. SHOULDN'T happen, the VM should automatically gc as
  soon as you're running out of memory.

  Are you doing anything funky with your Bitmap/Drawable objects? How do
  you manage them?

  On Jan 17, 9:03 am, gymshoe gyms...@bresnan.net wrote:

   I have noted the following discrepancies compared to the descriptions
   here, using a similar, simple application which uses Gallery, and
   BitmapFactory:

   1) EboMike, How exactly do I run the application without a debugger
   attached?  I assume that closing Eclipse entirely, and launching a
   new emulator from a DOS prompt (without Eclispe running) would be the
   equivalent of not having a debugger attached.

   When I do this, I get the same memory leak problem as I always did...

   2) When I have the DDMS attached and running, the heap size doesn't
   show any garbage collection (see below) going on for my gallery
   application (unless I click on Cause GC)...

   3) If I call System.GC() intermittently directly in my application
   (calling this method alone, and not as part of a {gc() /
   runFinalization() / gc()} sequence), this prevents OOM, and then I can
   see the GC altering the heap size (in DDMS).

   Jim

   On Jan 9, 6:37 pm, fadden fad...@android.com wrote:

On Jan 9, 4:47 pm, Mark K mark.ka...@gmail.com wrote:

    I've tried it with no de-bugger, on the emulator, and on actual G1
 hardware, I can't seem to get rid of the problem entirely. I only
 process and use one bitmap at a time, bitmaps are recycled after use,
 and I invoke gc(). The Runtime free memory indicates that I always
 have over 10 MB free, each bitmap is less than 3.5 MB, yet this
 problem still ocurs intermittently.

What does logcat show at the point of the failure?  Should see some
additional traffic, e.g.:

01-09 16:13:02.739 D/dalvikvm(  178): GC freed 494 objects / 31264
bytes in 265ms
01-09 16:13:02.829 I/dalvikvm-heap(  178): Grow heap (frag case) to
4.558MB for 

[android-developers] Re: local service getting killed

2009-01-31 Thread John Spurlock

http://groups.google.com/group/android-developers/browse_thread/thread/fa2848e31636af70/8d967c32df91a7d1?lnk=gstq=keeping+a+service+alive

On Jan 30, 3:09 pm, brs bernhard.r.su...@gmail.com wrote:
 I have an app loosely based on the LocalService example from the SDK
 with a controller activity and a long-running, stateful service which
 is doing stuff on a periodic handler. The service is also a bit of a
 memory hog.

 It seems that the service is sometimes killed by the activity-manager
 and immediately restarted. I don't see any stack trace, so I assume it
 is not the application crashing but the system doing that, presumably
 to claim resources. Is that what is going on here?

 Is there a way to tell the system that this process is kind of
 important, even though it has no foreground activity and should only
 be killed as a last resort?

 Bernhard
--~--~-~--~~~---~--~~
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: custom themes?

2009-01-31 Thread Craig

It well could be over complicated - here is what I did:
In res, values, attrs.xml I have:

?xml version=1.0 encoding=utf-8?
resources
declare-styleable name=MyColors
attr name=inactiveColor format=color/
attr name=activeColor format=color/
...

In res, values, styles.xml:
?xml version=1.0 encoding=utf-8?
resources
style name=Theme parent=android:Theme.NoTitleBar/style

style name=Theme.GreenWithYellow
item name=android:windowBackground@drawable/mid_green/item
item name=inactiveColor#090/item
item name=activeColor#0F0/item
...

...and I specify this theme in my AndroidManifest.xml.


Without specifying the attributes separately, I was getting errors for
my styles.xml like 'No resource found for specified attribute' (not
the exact wording).

Is there a simpler 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
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 overlay an image over the camera preview?

2009-01-31 Thread srajpal

sounds good, do you have an example piece of code or can you please
point me to something.

On Jan 30, 8:44 pm, Dave Sparks davidspa...@android.com wrote:
 No, you don't draw on the camera preview surface. You create a
 transparent surface above it in the Z stack and draw on that.

 On Jan 30, 5:31 pm, srajpal sraj...@gmail.com wrote:

  I checked out the api demo, it helps to place the camera preview on
  top of the surface view, but the buffers are handid over to the camera
  so anything drawn on the canvas, which is received from the handler,
  is ignored.

  There must be some way.  I just don't know it yet.

  On Jan 30, 7:27 pm, Dianne Hackborn hack...@android.com wrote:

   There is an Api Demo showing how to generally do this with a surface view.
   It's very easy, since SurfaceView essentially operates like any other view
   in terms of compositing.

   On Fri, Jan 30, 2009 at 3:48 PM, srajpal sraj...@gmail.com wrote:

Does someone know how I can overlay an image over the camera preview?

   --
   Dianne Hackborn
   Android framework engineer
   hack...@android.com

   Note: please don't send private questions to me, as I don't have time to
   provide private support.  All such questions should be posted on public
   forums, where I and others can see and answer them.
--~--~-~--~~~---~--~~
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: Specific Design significance of Attribute Name Spaces in AndroidManifest Files.

2009-01-31 Thread Raja Nagendra Kumar

Thank you for reply. Any good reason for doing it..

Most of the designs aim to assume reasonal defaults to min typing and
do more with less..

Regards,
Nagendra
--~--~-~--~~~---~--~~
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 overlay an image over the camera preview?

2009-01-31 Thread srajpal

Played around with this a little and solved it just like Dave Sparks
suggested
Thank you Dave
here is the code


import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.hardware.Camera;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.view.ViewGroup.LayoutParams;

public class TestCameraOverlay extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


requestWindowFeature(Window.FEATURE_NO_TITLE);

Preview mPreview = new Preview(this);
DrawOnTop mDraw = new DrawOnTop(this);

setContentView(mPreview);
addContentView(mDraw, new LayoutParams
(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

}
}

class DrawOnTop extends View {

public DrawOnTop(Context context) {
super(context);
// TODO Auto-generated constructor stub
}

@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub

Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.BLACK);
canvas.drawText(Test Text, 10, 10, paint);

super.onDraw(canvas);
}

}

//--

class Preview extends SurfaceView implements SurfaceHolder.Callback {
SurfaceHolder mHolder;
Camera mCamera;

Preview(Context context) {
super(context);

// Install a SurfaceHolder.Callback so we get notified when
the
// underlying surface is created and destroyed.
mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}

public void surfaceCreated(SurfaceHolder holder) {
// The Surface has been created, acquire the camera and tell
it where
// to draw.
mCamera = Camera.open();
mCamera.setPreviewDisplay(holder);
}

public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return, so stop the
preview.
// Because the CameraDevice object is not a shared resource,
it's very
// important to release it when the activity is paused.
mCamera.stopPreview();
mCamera = null;
}

public void surfaceChanged(SurfaceHolder holder, int format, int
w, int h) {
// Now that the size is known, set up the camera parameters
and begin
// the preview.
Camera.Parameters parameters = mCamera.getParameters();
parameters.setPreviewSize(w, h);
mCamera.setParameters(parameters);
mCamera.startPreview();
}

}




On Jan 31, 9:56 pm, srajpal sraj...@gmail.com wrote:
 sounds good, do you have an example piece of code or can you please
 point me to something.

 On Jan 30, 8:44 pm, Dave Sparks davidspa...@android.com wrote:

  No, you don't draw on the camera preview surface. You create a
  transparent surface above it in the Z stack and draw on that.

  On Jan 30, 5:31 pm, srajpal sraj...@gmail.com wrote:

   I checked out the api demo, it helps to place the camera preview on
   top of the surface view, but the buffers are handid over to the camera
   so anything drawn on the canvas, which is received from the handler,
   is ignored.

   There must be some way.  I just don't know it yet.

   On Jan 30, 7:27 pm, Dianne Hackborn hack...@android.com wrote:

There is an Api Demo showing how to generally do this with a surface 
view.
It's very easy, since SurfaceView essentially operates like any other 
view
in terms of compositing.

On Fri, Jan 30, 2009 at 3:48 PM, srajpal sraj...@gmail.com wrote:

 Does someone know how I can overlay an image over the camera preview?

--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.
--~--~-~--~~~---~--~~
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 good to use intents with an application to communcate and modularise it

2009-01-31 Thread Raja Nagendra Kumar

Hi Firedger,

Thank you bringin clarity by way of internal and external.

The one I am refering here is for internal usage. The application I am
refering here has
Main menu list, which has Settings and About and Help as menu items.

On user choosing Settings it would show submenu

Login
Register
Check Updates

On About and Help it would display a Rich Text with Hyperliks to talk
about vendor of the application and how to use the application.


In such impl. is it enough to have one main activity and work on a
model to change the view or Do we need to go for One Activity for Main
Menu, One each for Settings, Help and About.
In one each approach we have to associate a respective view with each
of them and go for intent way to bring them to to life.

In the contex of one each activity approach, we the following
advantages
- Go with just one activity for the enitre
application, hence no need to think of managing many activities life
cycle
- AndroidManifest would have only one configuration
- Switch the view by way of creating views as it
demands and use them
- if each view needs a context to create it self
properly, pass the paratmers to the constructor of the view, this
would also enhance compile checks and enable maintnace as opposed to
intent key value pair approach.


Closure comparision to J2ME is Canvas which has lifecycle, however
many frameworks recommend one instance of canvas only..

We really appricate your inputs on this.


Regards,
Nagendra
--~--~-~--~~~---~--~~
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: Audio in the emulator...

2009-01-31 Thread Dave Sparks

Try this:

emulator -help-audio-in

It will tell you which audio backends are available on your system.
You didn't specify what OS you are using.

I think there was also some sample code in the SDK at one point. Maybe
one of the developer advocates can point you to it. Another option is
to look for the source for the Sound Recorder application on
source.android.com. It should be in packages/apps/SoundRecorder.

On Jan 31, 10:45 am, nicolas cosson dodgemysp...@gmail.com wrote:
 Hello,

 I have been searching for some time and I can't find a detailled
 tutorial on how to easily record and then read audio on the emulator
 under eclipse. I have found these steps:

 - You have to install a virtual sd card with mksdcard.exe 1024M
 sdimg.iso

 -then run the emulator : emulator.exe -sdcard
 sdimg.iso                        //where sdimg.iso it is the path to
 the sdcard

 -then run adb.exe : adb push local_file sdcard/remote_file

 -then you should put : uses-permission
 android:name=android.permission.RECORD_AUDIO/uses-permission in
 the androidmanifest.xml

 -then there is some code to implement which should look like :
 private void startRecord() {

            recorder = new MediaRecorder();
             recorder.setAudioSource(MediaRecorder.AudioSource.MIC);  //ok so
 I say audio source is the microphone, is it windows/linux microphone
 on the emulator?
             recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
             recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
             recorder.setOutputFile(/sdcard/test.3gpp);

             recorder.prepare();
             recorder.start();

                 }

 -then you should stop with : recorder.stop(); // at some point (I have
 no idea when and where to decide to stop but I haven't searched yet)

 -then you should play it.

 I have also heard about 
 :http://code.google.com/intl/fr/android/reference/emulator.html#sdcard
 in this page of the manual (~1/4 of the total scroll), there are some
 informations about Emulator Startup Options, one of them is about
 Media  -audio backend
 I couldn't find much about that backend thing, google didn't said much
 about it. I still don't know if it's important to the audio recording
 process.

 The fact is all these steps are pretty blurry to me, and I believe I
 am not the only android newbie trying to record some sound :)

 Anyone knows where we can find a complete tutorial for dummies
 teaching this feature?

 Any help is of course greatly appreciated

 Thanks.

 On 27 jan, 20:08, Breno breno.min...@gmail.com wrote:

  Hey Andrei,

             To recordaudioit's pretty easy. But, you must record in
  sdcard, only. Be sure your path to file it's pointing to sdcard, and
  you have one mounted in eclipse (or something else). It's working
  perfectly.

  Regards

  Breno

  On Jan 15, 8:58 am, Andrei Craciun avcrac...@gmail.com wrote:

   Thanks David...

   2009/1/15 David Turner di...@android.com

the emulator now supportsaudiorecording. If you have problems with it,
you should report mode detailed information about it here

On Thu, Jan 15, 2009 at 11:05 AM, Andrei Craciun 
avcrac...@gmail.comwrote:

Hi All,
As reported on this blog:
   http://blog.roychowdhury.org/2008/04/29/sip-ua-for-android-stack-rtp-...problems
inrecordingaudioon the emulator, but everything
works fine on the real phone. Does anyone has a workaround forrecording
   audioon the emulator?

Thanks in advance,
A.
--~--~-~--~~~---~--~~
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: MediaRecorder - No value other than 0 returned from getMaxAmplitude

2009-01-31 Thread Dave Sparks

You shouldn't have to reboot the device. The release() call just
forces the release of the hardware resources instead of waiting for
the garbage collector to come along.

You should always call release() in your onPause() if you are using a
singleton hardware resource like a media player, media recorder,
camera, etc.

On Jan 31, 11:10 am, Phill Midwinter ph...@grantmidwinter.com wrote:
 I was running on a G1.

 I've just found the problem though. On previous debug sessions - the
 mediarecorder hadn't been properly released.

 Solution was to reboot the phone, add overrides to onpause and ondestroy,
 making sure it's released in each case and then run again. Works like a
 charm!

 2009/1/31 Dave Sparks davidspa...@android.com





  Are you running on a G1 or on the emulator? If on the emulator, maybe
  audio input isn't working correctly and it's failing to open the audio
  input device.

  On Jan 31, 9:59 am, Phill Midwinter ph...@grantmidwinter.com wrote:
   Looking at adb logcat I'm getting this error:

   *Record channel already open*

   Could this be a bug? I don't understand how it could already be open..
   nothing else is recording on the device?

   2009/1/31 ph...@grantmidwinter.com ph...@grantmidwinter.com

I've got a media recorder, prepared and started in the following way:

mRecorder = new MediaRecorder();
           mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
           mRecorder.setOutputFormat
(MediaRecorder.OutputFormat.THREE_GPP);
           mRecorder.setAudioEncoder
(MediaRecorder.AudioEncoder.AMR_NB);
           mRecorder.setOutputFile(/sdcard/test.3gpp);
           mRecorder.prepare();
           mRecorder.start();

I'm then using a thread to return the mRecorder.getMaxAmplitude int,
but it never returns as anything but 0. I've looked all over for why
this might be happening - but I'm at a complete loss now so help would
really be appreciated.

Thanks.

   --
   Phill Midwinter
   Director
   Grant Midwinter Limited
   d: 0844 736 5234 x: 0
   m: 07538 082156
   e: ph...@grantmidwinter.com

 --
 Phill Midwinter
 Director
 Grant Midwinter Limited
 d: 0844 736 5234 x: 0
 m: 07538 082156
 e: ph...@grantmidwinter.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] Re: Force close (exception) during rotation

2009-01-31 Thread Sean E. Russell

Thanks; it looks as if it might.

--- SER

On Jan 30, 7:11 am, Alistair. alistair.rutherf...@googlemail.com
wrote:
 This might help.

 http://groups.google.com/group/android-developers/browse_thread/threa...

 Al.

 On Jan 29, 3:16 am, Sean E.Russell seaneruss...@gmail.com wrote:

  I have a strange problem where, if the screen is rotated while a
  dialog is displayed, an exception gets thrown every time.  It happens
  _only_ during this single dialog, and the exception is thrown outside
  of the app (there's no trace information that touches any of my
  code).  It happens in both the emulator and the G1.

  I'm wondering if anybody has any suggestions about how I might analyze
  this problem, or what might be the cause.  The stack trace, for what
  it is worth, follows.  Is this something I can work around, or is it
  an Android bug?

  Thanks!

  E/AndroidRuntime(  353): Uncaught handler: thread main exiting due to
  uncaught exception
  E/AndroidRuntime(  353): java.lang.RuntimeException: Unable to start
  activity ComponentInfo{net.ser1.timetracker/
  net.ser1.timetracker.Tasks}: java.lang.NullPointerException
  E/AndroidRuntime(  353):        at
  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
  2140)
  E/AndroidRuntime(  353):        at
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
  2156)
  E/AndroidRuntime(  353):        at
  android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:
  3086)
  E/AndroidRuntime(  353):        at android.app.ActivityThread.access
  $1900(ActivityThread.java:112)
  E/AndroidRuntime(  353):        at android.app.ActivityThread
  $H.handleMessage(ActivityThread.java:1584)
  E/AndroidRuntime(  353):        at android.os.Handler.dispatchMessage
  (Handler.java:88)
  E/AndroidRuntime(  353):        at android.os.Looper.loop(Looper.java:
  123)
  E/AndroidRuntime(  353):        at android.app.ActivityThread.main
  (ActivityThread.java:3742)
  E/AndroidRuntime(  353):        at
  java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime(  353):        at java.lang.reflect.Method.invoke
  (Method.java:515)
  E/AndroidRuntime(  353):        at com.android.internal.os.ZygoteInit
  $MethodAndArgsCaller.run(ZygoteInit.java:739)
  E/AndroidRuntime(  353):        at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
  E/AndroidRuntime(  353):        at dalvik.system.NativeStart.main
  (Native Method)
  E/AndroidRuntime(  353): Caused by: java.lang.NullPointerException
  E/AndroidRuntime(  353):        at
  android.app.Activity.restoreManagedDialogs(Activity.java:850)
  E/AndroidRuntime(  353):        at
  android.app.Activity.performRestoreInstanceState(Activity.java:793)
  E/AndroidRuntime(  353):        at
  android.app.Instrumentation.callActivityOnRestoreInstanceState
  (Instrumentation.java:1171)
  E/AndroidRuntime(  353):        at
  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
  2117)
  E/AndroidRuntime(  353):        ... 12 more

  --- SER
--~--~-~--~~~---~--~~
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] android audio

2009-01-31 Thread solid

I am trying to discover the frequeny of recored audio.  I am kinda new
to multimedia programming (I am very new to android).  Is there a way
to get raw frequency information from the mic?
--~--~-~--~~~---~--~~
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: Howto remove thread from Dalvik VM????

2009-01-31 Thread sagar.indianic

Thanks for reply fadden..

Is there any replacement for threads..or else I will have to change my
logic as u described..



On Jan 31, 7:20 am, fadden fad...@android.com wrote:
 On Jan 30, 6:30 am, Sagar Parmar sagar.india...@gmail.com wrote:

  I am using Thread to display animation..I create a new thread whenever user
  preference is changed.Now I want to Remove the previous thread from Dalvik
  VM so that my application does not crash..How can I remove Thread from DVM??
  I use Thread.stop() but it is not working..Please help..

 Killing one thread from another is dangerous, because you don't know
 what resources are being held by the target thread.  The Thread
 methods for doing this are deprecated, and have not been implemented
 in Dalvik.

 The thread should check a variable periodically to see if it should
 continue running.  In many situations you'll want to declare the
 variable volatile.
--~--~-~--~~~---~--~~
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: MapView disable?

2009-01-31 Thread Keiji Ariyama

Dave,

Thank you for your reply.

 WiFi, 3G/EDGE (what carrier)? Is there anything useful in the log?
 Maybe a proxy failure?
I didn't change any settings my dev phone.

As you know, this trouble cause is Google server error. And it has 
recovered now.

Thank you,
Keiji

Dave Sparks wrote:
 I don't know anything about MapView. What service are you on e.g.
 WiFi, 3G/EDGE (what carrier)? Is there anything useful in the log?
 Maybe a proxy failure?
 
 On Jan 30, 5:46 pm, Keiji Ariyama ml_andr...@c-lis.co.jp wrote:
 Hi folks,

 Now, I'm developing an Android app called Echo.
 But 5 hours ago, My Dev phone haven't displayed MapView.

 First, I supposed that my API-key have been disabled.
 I tried to Maps API Key signup agian. But google server response error.

 Server Error
 The server encountered a temporary error and could not complete your 
 request.
 Please try again in 30 seconds.
 And not only Echo but also other all map apps cannot display map.

 Default map apps display error message that [Attention] There is a
 connection problem... we'll keep trying..

 If you can think of anything that may help me, I'll appreciate it.

 --
 Keiji,
 ml_andr...@c-lis.co.jp
  
 
 

-- 
Keiji,
ml_andr...@c-lis.co.jp

--~--~-~--~~~---~--~~
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: Sending Intent to specific Activity

2009-01-31 Thread Rishi

Hi Lutz,
When we talk of sending intents from Activity1 to Activity2 ,
Activity2 should have the intent filter
with the intent with which it wants to be invoked.
After getting invoked from activity1 , activity2 can further invoke
another activity with intent
data it wants.
You can also use broacastreceivers to get such kind of functonality.
Note: Receivers are invoked only by a broadcast call!

-Rishi Kaura

On Jan 9, 9:56 pm, Lutz Schönemann
lutz.schoenem...@sit.fraunhofer.de wrote:
 Hi,

 I want to create a activity that receivesintentsmodify these and  
 send them to an other activity that is also registerd to receive this  
 kind ofintents. These two activities are not in the same package. Is  
 there a way to specify a activity that should receive this intent?

 I am new to android and I know that it would be bad and ugly to do  
 something like this but it is only a proof of concept.

 Thanks
 Lutz
--~--~-~--~~~---~--~~
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: Leaked window in PreferenceActivity

2009-01-31 Thread Chander Pechetty

Search the forum before posting: :-)
http://groups.google.com/group/android-developers/browse_thread/thread/4ffea4cb05b51efe?hl=enq=#1d190c624e30eeaa
Mark Murphy's Blog - http://androidguys.com/?s=rotational+forces
android:configChanges=orientation


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

2009-01-31 Thread bwilliam...@gmail.com

I just figured out how to fix this, but it requires root access.

Pull /data/system/packages.xml
Find the entry for your package and comment it out.
shell back in and chmod packages.xml to be world-writeable
Push packages.xml back into the phone.
Restart the phone.

You can then install the app with the different signature.
--~--~-~--~~~---~--~~
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: android audio

2009-01-31 Thread Dave Sparks

In SDK 1.0, you can only record to a file using the AMR-NB codec,
which is bandwidth limited to 4KHz, and the encoding process itself is
pretty lossy. If you want to experiment with this on a G1, go to
Messaging, create a new message, click menu and select Attach, and
select Record Audio. This will take you to the Sound Recorder activity
where you can record and playback audio to get an idea of the audio
quality. A future release of the SDK will enable getting at the raw
audio samples.

On Jan 31, 8:34 pm, solid young...@gmail.com wrote:
 I am trying to discover the frequeny of recored audio.  I am kinda new
 to multimedia programming (I am very new to android).  Is there a way
 to get raw frequency information from the mic?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---