[android-developers] Re: Theme.Dialog for PreferenceScreen child does not work

2009-01-26 Thread Stoyan Damov

On Sun, Jan 25, 2009 at 10:20 PM, Dianne Hackborn hack...@android.com wrote:
 I can't help you off-hand with the problem, but for what it's worth
 preferences really aren't intended to be used with a dialog theme.  Actually
 I would stay away from the dialog theme for all but very simple things (like
 alerts), since the border takes so much space away from your UI.

 Of course in general I don't like dialogs. :)


The thing is that if I don't use the dialog theme, the preference
screen would cover my entire view and Android will eventually destroy
it (I've seen this already). So I'm pretty much forced to use the
dialog theme - I don't like it either :(

--~--~-~--~~~---~--~~
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: Theme.Dialog for PreferenceScreen child does not work

2009-01-26 Thread Stoyan Damov

On Mon, Jan 26, 2009 at 10:48 AM, Stoyan Damov stoyan.da...@gmail.com wrote:
 On Sun, Jan 25, 2009 at 10:20 PM, Dianne Hackborn hack...@android.com wrote:
 I can't help you off-hand with the problem, but for what it's worth
 preferences really aren't intended to be used with a dialog theme.  Actually
 I would stay away from the dialog theme for all but very simple things (like
 alerts), since the border takes so much space away from your UI.

 Of course in general I don't like dialogs. :)


 The thing is that if I don't use the dialog theme, the preference
 screen would cover my entire view and Android will eventually destroy
 it (I've seen this already). So I'm pretty much forced to use the
 dialog theme - I don't like it either :(


That is - Android will destroy the activity, which started the
preference activity because it's view is completely covered by the
child activity's view.

--~--~-~--~~~---~--~~
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 Streaming with Media Player

2009-01-26 Thread arnouf

Hello,

I tried to do the same thing. I had to implement a buffering file
system...but it was not easy, two files one reading the stream and
another readed by player...

But the problem was the first file streaming the content grew without
stopping...

So wait cupcake...

But how LastFm could provide this type of streaming?

On 12 jan, 15:04, Lukas lukasn...@googlemail.com wrote:
 I want to play a radio stream directly from a url, without downloading
 it first into a temporary file on the phone and having MediaPlayer
 read it from there.
 But if I provide the MediaPlayer with a url it returns this error:
 (-10, 0)
 Does anybody know what it means or what is the  problem with the code
 below?
 The stream I want to play is wma:
mp.setDataSource(http://asx.skypro.ch/radio/internet-64/
 drs3.asx);
 Thanks a lot,
 Lukas

 Here's the code:

 public class PlayRadio extends Activity implements OnClickListener,
 OnPreparedListener, OnErrorListener {

MediaPlayer mp;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button bt = (Button)findViewById(R.id.Play);
bt.setOnClickListener(this);
}

@Override
public void onClick(View v)
{
try
{
mp = new MediaPlayer();
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.setOnPreparedListener(this);
mp.setOnErrorListener(this);
mp.setDataSource(http://asx.skypro.ch/radio/internet-64/
 drs3.asx);
mp.prepareAsync();
}
catch(Exception e)
{
Log.e(radio, e.getMessage());
}
}

@Override
public void onPrepared(MediaPlayer mp) {
Log.i(radio, prepare finished);
mp.start();

}

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
mp.MEDIA_ERROR_UNKNOWN
Log.e(TAG, onError---   what: + what + extra: +
 extra);
return false;
}

 }
--~--~-~--~~~---~--~~
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: JMI and android

2009-01-26 Thread arnouf

The problem is that I have to compile kernel or do something in
Android source.

If I'm just a software editor, I don't want compile kernel...because I
sale only software no devices.

So now I don't think that It's possible to put a C library in assets
folder in my Android project and load it using JNI...Perhaps in a next
version?

Could you confirm it?

Regards

On 20 jan, 18:52, Dianne Hackborn hack...@android.com wrote:
 Note that native code is not supported in the SDK at this point, and any app
 using native code has a good chance of breaking in the future.

 This discussion does not belong on android-developers, because this is not a
 part of the SDK.



 On Tue, Jan 20, 2009 at 9:10 AM, FranckLefevre flas...@gmail.com wrote:

  Hi All,

  Note that it is already possible to create complete apps using JNI.

  This video (http://www.youtube.com/watch?v=PYkwHjc6wyo) shows a
  Kaleido based ODP (on device portal) running as a Android app without
  any specific change in the framework itself.  Exactly the same app
  runs fine on ADP, being installed as a regular APK.

  It's even possible to take advantage of almost all the Android
  services using BeanShell as a scripting engine from the native code.
  This is actually what we do on that application that accesses the
  Android's phonebook for instance.

  That also means that the same appliaction (excepted its thin porting
  layer) runs on both the G1 and an iPhone.

  Franck.

  On Jan 20, 12:40 am, David Turner di...@android.com wrote:
   Android's Dalvik VM uses JNI internally to access all the yummy native
   libraries on the system.
   A future native development kit (no ETA yet) will allow you to write your
   own native code accessible through JNI.
   Or you can start right now by rebuilding from the official open-source
  tree
   (though you won't be able to deploy these apps to other phones easily)

   On Mon, Jan 19, 2009 at 9:22 AM, arnouf arnaud.far...@gmail.com wrote:

It was JNI but JMI exists (Java Metadata Interface).

Arnaud

On Jan 9, 7:32 pm, Fred Grott(shareme) fred.gr...@gmail.com wrote:
 I think he meant JNI

 On Jan 9, 11:17 am, David Turner di...@android.com wrote:

  hello,

  JMI what ?

  On Fri, Jan 9, 2009 at 3:05 PM,arnoufarnaud.far...@gmail.com
  wrote:

   Hi guys!

   A simple question: Is JMI supported by Android?

   Regards- Hide quoted text -

   - Show quoted text -

 --
 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: Example: upload files to php from android

2009-01-26 Thread arnouf

It's done :)

On 19 jan, 13:56, arnouf arnaud.far...@gmail.com wrote:
 Hi all,

 I used this method until now. But I would like to light my application
 on device - without apache libraries - to use the code present in this
 pagehttp://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-p...

 It doesn't work...Could you help me?

 For information I would like to send an xml file (so text) and not a
 binary.

 Regards

 On Dec 19 2008, 8:20 pm, octagon micha.nis...@gmail.com wrote:

  Sorry, I didn't see your question! In case anyone has the same
  problem, the answer is yes. I am using eclipse. I first imported the
  jar files into my project so that the whole thing is all in one place.
  I put them in res/assets/dependencies.
  Then do:

  1. main menu Project -- Properties
  2. select Java Build Path from left pane
  3. go to Libraries tab
  4. click Add JARs

  hope it helps someone out.

  On Oct 23, 4:45 pm, De San Nicolas Jean Philippe jph...@gmail.com
  wrote:

   hello

   just a question (for the moment -:))

   you set the dependencies in your classpath in your Android project?

   thank's

   2008/10/21 octagon micha.nis...@gmail.com

This is a way for android to POST a file upload to a php script. I had
a bit of trouble figuring out the ins and outs of the http client
situation, but this is what works for me (hope someone finds it
helpful):

Notes:

Expect/continue handshaking needed to be disabled to avoid getting 417
errors from lighttpd. Doesn't work without an sdcard yet, as there is
no Content-Length header associated with uploading an OutputStream as
opposed to a File object, and writing to files is only allowed on the
sdcard (as far as I know, please correct me if there is a way to do
this).

Dependencies:

apache-mime4j-0.5.jar
log4j-zeroconf.jar
httpmime-4.0-beta1.jar

upload.php:

form enctype=multipart/form-data action=upload.php method=POST
input type=hidden name=MAX_FILE_SIZE value=10 /
Choose a file to upload: input name=uploadedfile type=file /br /

input type=submit value=Upload File /
/form
?php
 $to_file = tmp/ . basename($_FILES['uploadedfile']['name']);
 $from_file = $_FILES['uploadedfile']['tmp_name'];

 if (move_uploaded_file($from_file, $to_file)) {
   echo Successful upload;
?
 a href=?php echo $to_file;??php echo $to_file;?/a
?php
 } else {
   echo Unsuccessful upload;
 }
?

DemoActivity.java:

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

public class DemoActivity extends Activity {

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

   /*
* Make a simple view with a button and a bit of text. Click
the button to upload the file to the
* server. The file will be saved to tmp/test.txt (relative to
your php script) and it should contain
* the current time and date.
*/
   final TextView tmp = (TextView) findViewById(R.id.textView1);
   tmp.setText(Hi! Click the button!);

   Button b = (Button) findViewById(R.id.button1);
   b.setOnClickListener(new OnClickListener() {
   public void onClick(View v) {
   File f = new File(/sdcard/test.txt);
   try {
   f.createNewFile();
   Date d = new Date();
   PrintWriter writer = new
PrintWriter(f);
   writer.println(d.toString());
   writer.close();

   HttpClient client = new
DefaultHttpClient();
   httpPostFileUpload(client,
/sdcard/test.txt, http://
ubergibson.com/~micha/work/oculi/upload.phphttp://ubergibson.com/%7Emicha/work/oculi/upload.php,
 

[android-developers] Re: Theme.Dialog for PreferenceScreen child does not work

2009-01-26 Thread android_soft

Hi Damov,
Your activity will only be PAUSED  if you use Dialog Theme for a
PreferenceActivity. For other Themes, it is PAUSED and STOPPED, but
not
destroyed or killed. So if you want to restore the state you can do it
in onResume... so no need to use Theme.Dialog in your case unless it
looks good on your app.

-Chander

On Jan 26, 1:49 pm, Stoyan Damov stoyan.da...@gmail.com wrote:
 On Mon, Jan 26, 2009 at 10:48 AM, Stoyan Damov stoyan.da...@gmail.com wrote:
  On Sun, Jan 25, 2009 at 10:20 PM, Dianne Hackborn hack...@android.com 
  wrote:
  I can't help you off-hand with the problem, but for what it's worth
  preferences really aren't intended to be used with a dialog theme.  
  Actually
  I would stay away from the dialog theme for all but very simple things 
  (like
  alerts), since the border takes so much space away from your UI.

  Of course in general I don't like dialogs. :)

  The thing is that if I don't use the dialog theme, the preference
  screen would cover my entire view and Android will eventually destroy
  it (I've seen this already). So I'm pretty much forced to use the
  dialog theme - I don't like it either :(

 That is - Android will destroy the activity, which started the
 preference activity because it's view is completely covered by the
 child activity's view.
--~--~-~--~~~---~--~~
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: Sleep on END_CALL keycode, but terminate on HOME?

2009-01-26 Thread Guillaume Perrot

HOME calls onPause then onStop most of the time.
BACK do the same but also calls onDestroy after onStop.
The Acitivity.finish() function do the same as the BACK button.

You can try the following (I didn't test it):
You can have a boolean flag that your set when you press your button.
Then in onPause, test your flag:
If the flag is true (meaning you pressed the button), do nothing more.
if the flag is false it means BACK, HOME or another activity is over
yours: ensure the activity will finish by calling finish(); so that
the HOME button will do the same as the BACK one.
The side effect of this is that your activity will finish if you
launch another one over it (except if its transparent).

On Jan 26, 2:46 am, g1bb corymgibb...@gmail.com wrote:
 Hello,

 I have an activity that I would like the user to be able to put to
 sleep once the end call button is pressed, but terminate once the back
 or home buttons are pressed. Since it seems that end call and home
 both call OnPause(), is there a good way to do this?

 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: Updated app not showing up in Market's by date sorting?

2009-01-26 Thread arnouf

Unpublish current app, and post your new app...perhaps it's the bad
solution to be on the top always..

On Jan 26, 11:25 am, android_soft cspeche...@gmail.com wrote:
 may be you can post a small portion of your manifest where the version
 info goes, so others know what you got.(especially people who are not
 the market yet but who can help if they notice anything amiss)
--~--~-~--~~~---~--~~
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: Updated app not showing up in Market's by date sorting?

2009-01-26 Thread android_soft

may be you can post a small portion of your manifest where the version
info goes, so others know what you got.(especially people who are not
the market yet but who can help if they notice anything amiss)


--~--~-~--~~~---~--~~
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: Sleep on END_CALL keycode, but terminate on HOME?

2009-01-26 Thread Guillaume Perrot

HOME calls onPause then onStop most of the time.
BACK do the same but also calls onDestroy after onStop (if you didn't
override the BACK button behavior and no dialog or menu is being
displayed).
The Acitivity.finish() function do the same as the BACK button.

You can try the following (I didn't test it):
You can have a boolean flag that your set when you press your button.
Then in onPause, test your flag:
If the flag is true (meaning you pressed the button), do nothing more.
if the flag is false it means BACK, HOME or another activity is over
yours: ensure the activity will finish by calling finish(); so that
the HOME button will do the same as the BACK one.
The side effect of this is that your activity will finish if you
launch another one over it.

On Jan 26, 2:46 am, g1bb corymgibb...@gmail.com wrote:
 Hello,

 I have an activity that I would like the user to be able to put to
 sleep once the end call button is pressed, but terminate once the back
 or home buttons are pressed. Since it seems that end call and home
 both call OnPause(), is there a good way to do this?

 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: Updated app not showing up in Market's by date sorting?

2009-01-26 Thread A T
Yeah, I did that by accident once. Unpublished it, uploaded the update, and
it was on top again. All other updates before and after that stayed at the
same spot.

I hope this will be fixed now...

On Mon, Jan 26, 2009 at 5:40 AM, arnouf arnaud.far...@gmail.com wrote:


 Unpublish current app, and post your new app...perhaps it's the bad
 solution to be on the top always..

 On Jan 26, 11:25 am, android_soft cspeche...@gmail.com wrote:
  may be you can post a small portion of your manifest where the version
  info goes, so others know what you got.(especially people who are not
  the market yet but who can help if they notice anything amiss)
 


--~--~-~--~~~---~--~~
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: adb stopped working (Ubuntu 8.10)

2009-01-26 Thread Mark Murphy

Evan Charlton wrote:
 All,
 
 I shut down my PC (running Ubuntu 8.10, fully updated) overnight and
 when I booted the following day, `adb devices` failed to recognize my
 stock, OTA-updated, RC30 G1. I followed the instructions listed here:
 http://code.google.com/android/intro/develop-and-debug.html#developingondevicehardware
 
 e...@evan-desktop:~$ cat /etc/udev/rules.d/50-android.rules
 SUBSYSTEM==usb, SYSFS{idVendor}==0bb4, MODE=0666
 e...@evan-desktop:~$ adb kill-server  adb devices
 * daemon not running. starting it now *
 * daemon started successfully *
 List of devices attached
 emulator-5554 offline
 
 To answer some preliminary questions:
  - Yes, I have my phone on.
  - It's on a USB 2.0 port.
  - Yes, it sees the emulator(s), but not my device.
  - Yes, USB debugging is enabled on the phone (and I tried toggling it).
  - I've rebooted both the phone and the PC.
  - I'm using the latest the 1.0_r2 SDK from the site.
  - I'm on 64-bit Ubuntu, but it also fails to work in my 32-bit VM
 (that also previously worked).
 
 I spent a few hours in the #android-dev channel with a few very
 helpful people, but we got nowhere.
 Any help is enormously appreciated!

Do you have another PC you can try connecting the phone into, even if
just in USB mass storage mode? Do you have another mini-USB cable you
can try?

BTW, I am on the same environment as you (64-bit Ubuntu 8.10) and
haven't had a problem once I got it working a couple of months ago. So,
if you need to know any specific settings I have, just ask.

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

--~--~-~--~~~---~--~~
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: adb stopped working (Ubuntu 8.10)

2009-01-26 Thread Evan Charlton

I found a workaround last night (sorry, I should have replied to
myself): adb needs to be started as root in order for it to work
after.

Observe (all of this is with the phone connected):
e...@evan-desktop:~$ adb kill-server  adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached

e...@evan-desktop:~$ adb kill-server  sudo adb devices
[sudo] password for evan:
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
HT843GZ46005device

e...@evan-desktop:~$ adb devices
List of devices attached
HT843GZ46005device

I have no idea what changed overnight/between rebooting, but I'm glad
that it works now. If anyone has any ideas as to what broke it, I'm
all ears.

Evan Charlton

On Mon, Jan 26, 2009 at 8:17 AM, Mark Murphy mmur...@commonsware.com wrote:

 Evan Charlton wrote:
 All,

 I shut down my PC (running Ubuntu 8.10, fully updated) overnight and
 when I booted the following day, `adb devices` failed to recognize my
 stock, OTA-updated, RC30 G1. I followed the instructions listed here:
 http://code.google.com/android/intro/develop-and-debug.html#developingondevicehardware

 e...@evan-desktop:~$ cat /etc/udev/rules.d/50-android.rules
 SUBSYSTEM==usb, SYSFS{idVendor}==0bb4, MODE=0666
 e...@evan-desktop:~$ adb kill-server  adb devices
 * daemon not running. starting it now *
 * daemon started successfully *
 List of devices attached
 emulator-5554 offline

 To answer some preliminary questions:
  - Yes, I have my phone on.
  - It's on a USB 2.0 port.
  - Yes, it sees the emulator(s), but not my device.
  - Yes, USB debugging is enabled on the phone (and I tried toggling it).
  - I've rebooted both the phone and the PC.
  - I'm using the latest the 1.0_r2 SDK from the site.
  - I'm on 64-bit Ubuntu, but it also fails to work in my 32-bit VM
 (that also previously worked).

 I spent a few hours in the #android-dev channel with a few very
 helpful people, but we got nowhere.
 Any help is enormously appreciated!

 Do you have another PC you can try connecting the phone into, even if
 just in USB mass storage mode? Do you have another mini-USB cable you
 can try?

 BTW, I am on the same environment as you (64-bit Ubuntu 8.10) and
 haven't had a problem once I got it working a couple of months ago. So,
 if you need to know any specific settings I have, just ask.

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

 


--~--~-~--~~~---~--~~
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: Theme.Dialog for PreferenceScreen child does not work

2009-01-26 Thread android_soft

You should move the heavyweight lifting stuff to a Service if you
don't want it to be stopped.
Running background music is something that a background service should
take care of. Here's another thread response from Dianne-
http://groups.google.com/group/android-developers/browse_thread/thread/112189a9893a6462/f66bf1a5848c2c45?hl=enlnk=gstq=background+music#f66bf1a5848c2c45

Then again, I don't know  all your requirements, so I will stop at
that.

Chander

On Jan 26, 5:41 pm, Stoyan Damov stoyan.da...@gmail.com wrote:
 On Mon, Jan 26, 2009 at 11:39 AM, android_soft cspeche...@gmail.com wrote:

  Hi Damov,
  Your activity will only be PAUSED  if you use Dialog Theme for a
  PreferenceActivity. For other Themes, it is PAUSED and STOPPED, but
  not
  destroyed or killed. So if you want to restore the state you can do it
  in onResume... so no need to use Theme.Dialog in your case unless it
  looks good on your app.

  -Chander

 Yes, I understand that - the thing is that I don't want my activity to
 be stopped, because it's quite heavyweight, might be playing
 background music, etc. so I'm left with the dialog theme.

 Cheers,
 Stoyan
--~--~-~--~~~---~--~~
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: Root Acess on developer phone

2009-01-26 Thread Rafael Fernandes

well again, it is not possible to get access to /data via eclipse...
you have to go via adb...

adb shell
su

su command gives you the super user rights...

cheers,
rafael fernandes

On Jan 26, 3:10 pm, sudheer sudheer.mo...@gmail.com wrote:
 Dear All

 I just procured a developer phone recently. I am not able to access
 the /data directory. how do I get super access on this phone? What
 should I do to get super access?
 Please advice me.

 Best Regards,
 Sudheer
--~--~-~--~~~---~--~~
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: Anyone success to build emulator for Windows?

2009-01-26 Thread Breno


Hey,

   According with this link,
http://android.git.kernel.org/?p=platform/development.git;a=blob_plain;f=tools/eclipse/README_WINDOWS.txt;hb=HEAD,
some cygwin packets are necessarily. But it missed one: flex.

Regards

Breno

On Jan 5, 8:04 am, Tim tim.ka...@gmail.com wrote:
 Hi HISONA,

 It works, thx!

 Btw, step 2 Remark the -lpthread, should be not needed if you
 installed pthread for mingw as below :)
  install pthread for mingw 
 1. download pthreads-w32-2-8-0-release.tar.gz 
 fromftp://sourceware.org/pub/pthreads-win32
 2. tar -zxvf pthreads-w32-2-8-0-release.tar.gz
 3. cd pthreads-w32-2-8-0-release
 4. make clean GC-static
 5. cp libpthreadGC2.a /mingw/lib/libpthread.a
 6. cp pthread.h /mingw/include/pthread.h
  end 

 On Dec 26 2008, 1:11 pm, HISONA hison...@gmail.com wrote:

  Hi,

  android-emulator-1.0_r2.tar.bz2 has some bug ...

  1. Copy the qemu\android\config\windows\config-host.h to qemu
  \config-host.h
  2. Remark the -lpthread option in qemu\Makefile.android line 476.
  3. Execute sh build-emulator.sh in root directory.

  Good luck ...

 http://ohadev.tistory.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] I can't write a file in a subdirectory of data/data/packages/files/

2009-01-26 Thread Nico

hello,

I have some problems to write in a file from a subdirectory.

I can create subdirectories. I can create a file in  files/ directory
and write directly .

But i can't do the two operations in the same time.

It seems  that i don't have the writable right to do it.

Could you help me?

Thanks 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: Activity Issue on G1 phone

2009-01-26 Thread Brad Gies
Ah.. Thank you. That clears up a lot !!!

 

I was thinking that a static variable created in an activity would be
global only to that activity, and any spawned processes of that activity.
But now. knowing it is at the application level open up many possibilities.
When I was designing my current process I remember thinking that it would be
very handy to have an application level global variable, but never got
around to asking the question. And because I am coding on a Windows machine
with Eclipse, I'd rather go to the dentist than try to trace through the
Android source code :-)

 

Actually, I was thinking of moving some of my threads to a service just for
efficiency reasons (to save on multiple requests for the same information),
but now.. I think if I implement this the way you laid it out, the service
seems to be overkill. My threads only download small thumbnail bitmaps, or
send fairly fast REST queries to my server, so I don't think I'd need the
service at all. I think you just saved me several days coding ;)

 

Hmm.What happens in this sequence :   Activity A sets the static variable,
and then creates the thread to get some information. The user then clicks on
the first piece of information returned, and goes to Activity B. But
activity B then takes the user to another instance of activity A. Then the
two instances of activity A would be sharing the static variable that points
to the second instance of activity A ... correct?

 

I don't think this is a huge problem because my activity A can only be
called in two ways, and I can declare two static variables in activity A and
then assign the one that corresponds to how activity A was called, and use
it to pass to the threads, so that each instance of Activity A would have
their own static variable to use with the threads that they create.. Does
that sound correct?

 

 

 

Sincerely,

 

Brad Gies

 

 

-

Brad Gies

27415 Greenfield Rd, # 2,

Southfield, MI, USA

48076

www.bgies.com  www.truckerphone.com 

www.EDI-Easy.com  www.pricebunny.com

-

 

Moderation in everything, including abstinence

  _  

From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Dianne Hackborn
Sent: Sunday, January 25, 2009 8:23 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: Activity Issue on G1 phone

 

I meant that the static variable would -hold- the current activity.

Everything in your .apk runs in one process.  When you declare a static
variable, that is creating a global to all code in that process.  You can
make a static variable pointing to an Activity:

static Activity mCurActivity = null;

In your activity's onCreate() set it to 'this'.  In onDestroy() set it to
null.

Now someone else -- a thread or whatever -- can come in, and retrieve the
value of mCurActivity to find out the current activity that has been set.

On Sun, Jan 25, 2009 at 4:47 PM, Brad Gies rbg...@gmail.com wrote:


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



[android-developers] Re: There is a problem communicating with Google servers

2009-01-26 Thread Adrien Guichard

2009/1/24 qwerty enetconsult...@comcast.net:

 I just got the Dev. phone today and trying to get it up and
 running'.   I am trying to create a google account but I keep getting
 an error message

 There is a problem communicating with Google servers

 This could be a temporary problem or your SIM card may not be
 provisioned for data services.  if it continues, call Customer Care.


Try using Wifi:

If you have RC30 or further release:
Connect your phone to a computer with the SDK installed, then run:
$ ./adb shell
$ su
# am start -a android.intent.action.MAIN -n com.android.settings/.Settings

If you have a previous release, follow instructions listed there:
http://forum.xda-developers.com/showthread.php?p=3195022

Then you may need to set APN, but I do not really know what to put in
it, I do not have data enbled SIM card.

--~--~-~--~~~---~--~~
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] Query regarding OutOfMemoryException

2009-01-26 Thread parth

I am downloading a audio file from server on sd card. It is showing me
OutOfMemoryException.

This is my code..
---
package com.android;

import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

public class MainClass {

  public MainClass() throws Exception
  {

URL u = new URL(http://test.cfmdeveloper.com/android/music.mp3;);
URLConnection uc = u.openConnection();
String contentType = uc.getContentType();
int contentLength = uc.getContentLength();
if(contentLength  Integer.MAX_VALUE)
{

}
if (contentType.startsWith(text/) || contentLength == -1) {
  throw new IOException(This is not a binary file.);
}
InputStream raw = uc.getInputStream();
InputStream in = new BufferedInputStream(raw);
byte [] data=new byte[(int)contentLength];
//byte[] data1 = new byte[contentLength/2];
int bytesRead = 0;
int offset = 0;
while (offset  contentLength)
{

  bytesRead = in.read(data, offset, data.length - offset);
  if (bytesRead == -1)
break;
  offset += bytesRead;
}
in.close();

/*if (offset != contentLength) {
  throw new IOException(Only read  + offset +  bytes; Expected
 + contentLength +  bytes);
}*/


   // String filename = u.getFile().substring(filename.lastIndexOf
('/') + 1);
FileOutputStream out = new FileOutputStream(/sdcard/
music.mp3);
out.write(data);
out.flush();
out.close();
  }
}



The error is at this line:
byte [] data=new byte[(int)contentLength];
This is because the size of the contentLength 16987867



I am trying since long and stuck up here..
How to solve this exception? Pls 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: Search Dine (Restaurant search Android app by Mofirst)

2009-01-26 Thread Niti

ok i shall do that Andy :) thanks for the advice ..if u can
suggest me where i can promote my application best it would really be
great!! thanks!

On Jan 24, 6:56 am, Andrew Stadler stad...@gmail.com wrote:
 Nitichandra-

 Congratulations on releasing your application, but unless you're
 planning to release and discuss its source code, can you please make
 announcements like this in the android-discuss mailing list?

 Thanks,
 Andy

 On Thu, Jan 22, 2009 at 6:34 AM, nitichandra ingle

 nitichan...@gmail.com wrote:
  you can even watch the video of the application on youtube by searching for
  it the link is

 http://in.youtube.com/watch?v=a9b-i9qWuCg

  On Thu, Jan 22, 2009 at 7:51 PM, nitichandra ingle nitichan...@gmail.com
  wrote:

 SearchDine

  Intro:

 SearchDinealleviates Searching food anywhere across United States of
  America. Suppose you are travelling, amidst you get hungry and look for a
  place to eat thenSearchDinecan locate the nearest restaurant for you.
  It is a handy application when you are planning a trip or if you are at a
  new place or to just explore the restaurants nearby.

  More:

  You cansearchby either entering the zip code or restaurant name.
  Favorite Food items can be selected from a wide range of cuisines displayed
  on the screen. Instantly after thesearchclick, the address as well as the
  contact number is displayed and you can make a call to the desired
  restaurant.  The map enhances thesearchby displaying the options of
  Satellite, Map or Street view adding spice to the Foodsearch

  About:

   Mofirst designed the product for Google Android and launched it with the
  Rising Sun on 19th Jan all over the market. This is their first product for
  Google Android and it is just the beginning from the committed team of IIT
  graduates as they have a lot to offer in the coming future.

--~--~-~--~~~---~--~~
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] Installing Driver on Vista 32bit

2009-01-26 Thread Dan

I extract the zip found on
http://code.google.com/android/intro/develop-and-debug.html#developingondevicehardware

and attempt to install the device and get
System can not find file specified .

Now I point it to the INF file, but doesn't work

any suggestions?

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: Root Acess on developer phone

2009-01-26 Thread Andrea Fanfani

On Mon, Jan 26, 2009 at 06:10:37AM -0800, sudheer wrote:
 
 Dear All
 
 I just procured a developer phone recently. I am not able to access
 the /data directory. how do I get super access on this phone? What
 should I do to get super access?
 Please advice me.
 

sudo su ? from console in adb  ?

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: Marketplace Sponsorship

2009-01-26 Thread Cassius

You can put your application on your web site.
If it's useful people will download it even without the visibility
given by the Market.

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

2009-01-26 Thread Alistair.

I too am looking for a sample EULA. I found this.

http://www.developer-resource.com/sample-eula.htm

Al.

On Dec 5 2008, 6:14 am, lior liorza...@comcast.net wrote:
 Thanks, I actually meant an agreement example as most examples out
 them deal with companies (not single developers)

 On Dec 4, 9:54 pm, Xavier Mathews xavieruni...@gmail.com wrote:

  Text File Html File pdf File pdf is the best by html. But not all
  devices can have a pdf reader. So I would go with HTML For the end
  user license agreement!

  On 12/04/2008, lior liorza...@comcast.net wrote:

   Hi folks,
   My friend and I are about to launch are first app on the Market. We
   are don't have an incorporated company formed (yet) and we would like
   to protect us with anEULA. Can someone share anEULAformat that
   would work for us.

   Any other advice on the topic ofEULAwill be great.

   Thanks in advance,
   Lior

  --
  Xavier A. Mathews
  Student/Browser Specialist/Developer/Web-Master
  Google Group Client Based Tech Support Specialist
  Hazel Crest Illinois
  xavieruni...@gmail.com¥xavieruni...@hotmail.com¥truestar...@yahoo.com
  Fear of a name, only increases fear of the thing itself.
--~--~-~--~~~---~--~~
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: Root Acess on developer phone

2009-01-26 Thread martin d.

Hi,

On Jan 26, 3:46 pm, Rafael Fernandes luizraf...@gmail.com wrote:
 well again, it is not possible to get access to /data via eclipse...
 you have to go via adb...

there is a workaround for that. You can just chmod the path you want
to access from
Eclipse to 777 and it will work. This change does not survive a
reboot.

MartinD:
--~--~-~--~~~---~--~~
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] Change connection programmatically

2009-01-26 Thread alexdonnini

Hello,

I have been looking for a way to programmatically change the active
connection on a G1.

for example, I would like to be able to switch from g3 to wifi by
first disconnecting the g3 connection.

When it comes to WIFI, enabling/disabling WIFI, and connecting/re-
connecting to a WIFI access point is fairly straightforward.

However, when it comes to non-WIFI connections, I have not been able
to find the equivalent classes and methods.

Please note that, unless I am mistaken, the ConnectivityManager
class does not include any methods for managing connections. It's just
for accessing information about a connection, and manage some
configuration settings.

I would appreciate any ideas and feedback.

Thanks.

Alex Donnini
--~--~-~--~~~---~--~~
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: Marketplace Sponsorship

2009-01-26 Thread Cédric Berger
On Mon, Jan 26, 2009 at 09:57, Cassius cassius.um...@gmail.com wrote:


 You can put your application on your web site.
 If it's useful people will download it even without the visibility
 given by the Market.


There are also other repositories on the web. You can begin from there...

(example : http://andappstore.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] Adding padding between buttons in a LinearLayout

2009-01-26 Thread Inderjeet Singh

Hi,

I am probably missing something totally obvious, but can someone tell
me how to add padding between buttons of a LinearLayout?

Here is the code fragment from my layout xml file.
  LinearLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=horizontal
android:gravity=center
android:layout_width=fill_parent
android:layout_height=wrap_content

Button android:id=@+id/first_button
  style=@style/ButtonText
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:paddingLeft=10px
  android:paddingRight=10px
  android:text=First/

Button android:id=@+id/second_button
  style=@style/ButtonText
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:paddingLeft=10px
  android:paddingRight=10px
  android:text=Second/
  /LinearLayout

The buttons still appear closer together than what I would prefer. How
do I increase the spacing between the First and Second buttons?

Thanks
Inder

--~--~-~--~~~---~--~~
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: Adding padding between buttons in a LinearLayout

2009-01-26 Thread Christoph Studer

Hello Inder, nice to see you here. :-)

padding{Left,Top,Right,Bottom} is - like in CSS - within the
bounds/border of the widget you apply it to.

You can use layout_margin{Left,Top,Right,Bottom} attributes to
accomplish what you intend to do.

Cheers,

Christoph


On Mon, Jan 26, 2009 at 5:55 PM, Inderjeet Singh inder...@gmail.com wrote:

 Hi,

 I am probably missing something totally obvious, but can someone tell
 me how to add padding between buttons of a LinearLayout?

 Here is the code fragment from my layout xml file.
  LinearLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=horizontal
android:gravity=center
android:layout_width=fill_parent
android:layout_height=wrap_content

Button android:id=@+id/first_button
  style=@style/ButtonText
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:paddingLeft=10px
  android:paddingRight=10px
  android:text=First/

Button android:id=@+id/second_button
  style=@style/ButtonText
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:paddingLeft=10px
  android:paddingRight=10px
  android:text=Second/
  /LinearLayout

 The buttons still appear closer together than what I would prefer. How
 do I increase the spacing between the First and Second buttons?

 Thanks
 Inder

 


--~--~-~--~~~---~--~~
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] Measuring Views

2009-01-26 Thread Alexey

Hi all , i have a custom View with layout
LinearLayout
android:id=@+id/story_image_layout
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=horizontal
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_marginLeft=5px
android:layout_marginRight=5px
AbsoluteLayout
android:orientation=vertical
android:background=@drawable/image_back
android:layout_width=wrap_content
android:layout_height=wrap_content
android:padding=5px
ImageView
android:id=@+id/story_image
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_y=10px
android:layout_x=5px/
ImageView
android:id=@+id/story_zoom
android:layout_width=wrap_content
android:layout_height=wrap_content
android:src=@drawable/zoom_in/
/AbsoluteLayout
TextView
android:id=@+id/story_text_partial
android:layout_width=wrap_content
android:layout_height=wrap_content
android:lineSpacingExtra=5px
android:layout_marginLeft=10px
  /
/LinearLayout
And trying to calc
And a long string. I want part of this string to go to the TextView on
the right .
To do that i'm trying to measure the imageview on the left and
calculate the size of the string i need to put in my textview.

LinearLayout vParent = (LinearLayout) findViewById
(R.id.story_image_layout);
AbsoluteLayout vImage = (AbsoluteLayout) vParent.getChildAt(0);
int shortTextWidth = vParent.getMeasuredWidth() -
vImage.getMeasuredWidth();
TextView vText = (TextView) findViewById(R.id.story_text);
TextView vTextShort = (TextView) vParent.getChildAt(1);
int mesuredHeight = vParent.getMeasuredHeight();
int lineHeight = vTextShort.getLineHeight();
int nmbLines = mesuredHeight / lineHeight - 2;
Paint mPaint = new Paint();
int breakText = 
mPaint.breakText(mStoryText.toCharArray(), 0,
mStoryText.length(), shortTextWidth, null);
mStoryBreakIdx = nmbLines * breakText;

}
vTextShort.setText(mStoryText.substring(0, mStoryBreakIdx));

It all works fine, except i can't set the text into the textView. If
it's in constructor getMesured return 0; if it's in the onSizeChanged
- measurements are calculating but TextView after set text have
measurements too small to fit the text.
If i put set text in a thread for example everything works, but i
don't want a delay .
Question - where i need set text to my view to render this correctly ?

--~--~-~--~~~---~--~~
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: Measuring Views

2009-01-26 Thread Romain Guy

Hi,

You don't need to do this, you can simply use the ellipsize feature of
TextView. It will automatically truncate the text based on the
available space.

On Mon, Jan 26, 2009 at 9:05 AM, Alexey avolo...@gmail.com wrote:

 Hi all , i have a custom View with layout
 LinearLayout
android:id=@+id/story_image_layout
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=horizontal
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_marginLeft=5px
android:layout_marginRight=5px
AbsoluteLayout
android:orientation=vertical
android:background=@drawable/image_back
android:layout_width=wrap_content
android:layout_height=wrap_content
android:padding=5px
ImageView
android:id=@+id/story_image
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_y=10px
android:layout_x=5px/
ImageView
android:id=@+id/story_zoom
android:layout_width=wrap_content
android:layout_height=wrap_content
android:src=@drawable/zoom_in/
/AbsoluteLayout
TextView
android:id=@+id/story_text_partial
android:layout_width=wrap_content
android:layout_height=wrap_content
android:lineSpacingExtra=5px
android:layout_marginLeft=10px
  /
 /LinearLayout
 And trying to calc
 And a long string. I want part of this string to go to the TextView on
 the right .
 To do that i'm trying to measure the imageview on the left and
 calculate the size of the string i need to put in my textview.

 LinearLayout vParent = (LinearLayout) findViewById
 (R.id.story_image_layout);
AbsoluteLayout vImage = (AbsoluteLayout) vParent.getChildAt(0);
int shortTextWidth = vParent.getMeasuredWidth() -
 vImage.getMeasuredWidth();
TextView vText = (TextView) findViewById(R.id.story_text);
TextView vTextShort = (TextView) vParent.getChildAt(1);
int mesuredHeight = vParent.getMeasuredHeight();
int lineHeight = vTextShort.getLineHeight();
int nmbLines = mesuredHeight / lineHeight - 2;
Paint mPaint = new Paint();
int breakText = 
 mPaint.breakText(mStoryText.toCharArray(), 0,
 mStoryText.length(), shortTextWidth, null);
mStoryBreakIdx = nmbLines * breakText;

}
vTextShort.setText(mStoryText.substring(0, mStoryBreakIdx));

 It all works fine, except i can't set the text into the textView. If
 it's in constructor getMesured return 0; if it's in the onSizeChanged
 - measurements are calculating but TextView after set text have
 measurements too small to fit the text.
 If i put set text in a thread for example everything works, but i
 don't want a delay .
 Question - where i need set text to my view to render this correctly ?

 




-- 
Romain Guy
Android framework engineer
romain...@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: Query regarding OutOfMemoryException

2009-01-26 Thread Romain Guy

Hi,

The file you are downloading is simply to large to fit in the
available RAM. Instead of downloading the entire file and then write
it to disk, download the file in small batches (of 16 kB for instance)
and write each batch to the SD card right away.



On Mon, Jan 26, 2009 at 4:25 AM, parth parth.india...@gmail.com wrote:

 I am downloading a audio file from server on sd card. It is showing me
 OutOfMemoryException.

 This is my code..
 ---
 package com.android;

 import java.io.BufferedInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;

 public class MainClass {

  public MainClass() throws Exception
  {

URL u = new URL(http://test.cfmdeveloper.com/android/music.mp3;);
URLConnection uc = u.openConnection();
String contentType = uc.getContentType();
int contentLength = uc.getContentLength();
if(contentLength  Integer.MAX_VALUE)
{

}
if (contentType.startsWith(text/) || contentLength == -1) {
  throw new IOException(This is not a binary file.);
}
InputStream raw = uc.getInputStream();
InputStream in = new BufferedInputStream(raw);
byte [] data=new byte[(int)contentLength];
//byte[] data1 = new byte[contentLength/2];
int bytesRead = 0;
int offset = 0;
while (offset  contentLength)
{

  bytesRead = in.read(data, offset, data.length - offset);
  if (bytesRead == -1)
break;
  offset += bytesRead;
}
in.close();

/*if (offset != contentLength) {
  throw new IOException(Only read  + offset +  bytes; Expected
  + contentLength +  bytes);
}*/


   // String filename = u.getFile().substring(filename.lastIndexOf
 ('/') + 1);
FileOutputStream out = new FileOutputStream(/sdcard/
 music.mp3);
out.write(data);
out.flush();
out.close();
  }
 }



 The error is at this line:
 byte [] data=new byte[(int)contentLength];
 This is because the size of the contentLength 16987867
 


 I am trying since long and stuck up here..
 How to solve this exception? Pls help




 




-- 
Romain Guy
Android framework engineer
romain...@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: Measuring Views

2009-01-26 Thread Alexey

Thanks a lot for your reply but i guess i'm confused how ellipsize
will help me if i don't know the width and height of the TextView.
task is a break a long text into two TextView to create wrap around
the Image effect.
I have an imageView and textview( where i need to put a short portion
of the text which should be equal of the height of the image on the
left ) and big text view below which will receive rest of the text.


On Jan 26, 11:15 am, Romain Guy romain...@google.com wrote:
 Hi,

 You don't need to do this, you can simply use the ellipsize feature of
 TextView. It will automatically truncate the text based on the
 available space.

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

2009-01-26 Thread Tim Bray
The section Recording Media Resources of
http://code.google.com/android/toolbox/apis/media.html seems to be out of
date and wrong.  I got working code from
http://rehearsalassist.svn.sourceforge.net/viewvc/rehearsalassist/android/trunk/src/urbanstew/RehearsalAssistant/RehearsalRecord.java?view=markup
which
is quite different.
It would be a good idea to correct at least remove the misleading online
version. -Tim

--~--~-~--~~~---~--~~
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: Dynamically changing the language at runtime

2009-01-26 Thread Dianne Hackborn
You can't just modify the structure, you need to give a new Configuration of
new values to Resources.updateConfiguration().

On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com 
deepdr...@googlemail.com wrote:


 I tried :

Resources res = getResources();
res.getConfiguration().locale = Locale.GERMANY;
firstline= res.getString(R.string.firstline);

 in my onCreate() . But, although I do have res/values-de/strings.xml
 this still gives me the english string for firstline.
 So it seems to me that there's no easy way to test different languages
 without an actual device for that language (?)


 On Jan 24, 10:28 pm, Dianne Hackborn hack...@android.com wrote:
  This isn't really supported, though you can change the language of the
  Configuration used by your Resources object.  This will only impact your
 own
  app, though, not things displayed by others like your notifications
 (those
  will still use the system's locale).
 
  On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar 
 
 
 
  nagendra.r...@gmail.com wrote:
 
   Hi Romain,
 
   Thank You Romain, a follow up to this how do I change the default
   languge to choose in my application based on the menu we provide with
   in the andorid application..
   I may still want to keep my phone locale some thing deferent than the
   application locale.
 
   Regards,
   Nagendra
 
   On Jan 24, 11:16 am, Romain Guy romain...@google.com wrote:
Hi,
 
All you need to do is place your resources in locale specific
directories. For instance:
 
res\
  drawable-en\
  values-fr\
  layout-jp\
 
In your example to localize the app in English and German, you would
   have:
 
res\
  values\
strings.xml
  values-de\
strings.xml
 
And Android will automatically pick up the right strings.xml at
runtime, depending on the locale. If you want to know more about
resources and configurations, please readhttp://
   code.google.com/android/devel/resources-i18n.html
 
On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar
 
nagendra.r...@gmail.com wrote:
 
 Is there any good example to show how a single compiled application
 could support both english and say germany..
 
 The aapt approach and Resource R.java approach seems to me that, we
 may need to have one binary for english and one for germany
 etc..and
 so on..
 
 Like in J2ME, could we switch the language at runtime..
 
 Regards,
 Raja Nagendra Kumar,
 C.T.O
www.tejasoft.com
 
--
Romain Guy
Android framework engineer
romain...@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- Hide
 quoted
   text -
 
- Show quoted text -
 
  --
  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.
 



-- 
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: Dynamically changing the language at runtime

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

ya, great, thanks, this works for me ! :

Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = Locale.GERMANY;
res.updateConfiguration(conf, dm);
firstline= res.getString(R.string.firstline);


On Jan 26, 9:09 pm, Dianne Hackborn hack...@android.com wrote:
 You can't just modify the structure, you need to give a new Configuration of
 new values to Resources.updateConfiguration().

 On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com 



 deepdr...@googlemail.com wrote:

  I tried :

                 Resources res = getResources();
                 res.getConfiguration().locale = Locale.GERMANY;
                 firstline= res.getString(R.string.firstline);

  in my onCreate() . But, although I do have res/values-de/strings.xml
  this still gives me the english string for firstline.
  So it seems to me that there's no easy way to test different languages
  without an actual device for that language (?)

  On Jan 24, 10:28 pm, Dianne Hackborn hack...@android.com wrote:
   This isn't really supported, though you can change the language of the
   Configuration used by your Resources object.  This will only impact your
  own
   app, though, not things displayed by others like your notifications
  (those
   will still use the system's locale).

   On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar 

   nagendra.r...@gmail.com wrote:

Hi Romain,

Thank You Romain, a follow up to this how do I change the default
languge to choose in my application based on the menu we provide with
in the andorid application..
I may still want to keep my phone locale some thing deferent than the
application locale.

Regards,
Nagendra

On Jan 24, 11:16 am, Romain Guy romain...@google.com wrote:
 Hi,

 All you need to do is place your resources in locale specific
 directories. For instance:

 res\
   drawable-en\
   values-fr\
   layout-jp\

 In your example to localize the app in English and German, you would
have:

 res\
   values\
     strings.xml
   values-de\
     strings.xml

 And Android will automatically pick up the right strings.xml at
 runtime, depending on the locale. If you want to know more about
 resources and configurations, please readhttp://
code.google.com/android/devel/resources-i18n.html

 On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar

 nagendra.r...@gmail.com wrote:

  Is there any good example to show how a single compiled application
  could support both english and say germany..

  The aapt approach and Resource R.java approach seems to me that, we
  may need to have one binary for english and one for germany
  etc..and
  so on..

  Like in J2ME, could we switch the language at runtime..

  Regards,
  Raja Nagendra Kumar,
  C.T.O
 www.tejasoft.com

 --
 Romain Guy
 Android framework engineer
 romain...@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- Hide
  quoted
text -

 - Show quoted text -

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

 --
 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: Recording audio stream

2009-01-26 Thread benmccann

I'm happy to hear future releases will support the ability to stream
audio being recorded.  Any ETA on this?


On Dec 30 2008, 9:58 am, Dave Sparks davidspa...@android.com wrote:
 It's probably not really streaming audio. Some people are working
 around the issue by tailing the file as it is being written.

 On Dec 30, 5:03 am, FranckLefevre flas...@gmail.com wrote:

  The application Phone Recorder available in Market softwares already
  does this pretty well.
  I don't know if sources are available somewhere...

  Franck.

  On Dec 25, 1:27 am, vitalii.mi...@gmail.com

  vitalii.mi...@gmail.com wrote:
     Is there any way torecordaudiostreamand send streaming audio  to
   network ??  Instead of recording to file.

--~--~-~--~~~---~--~~
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 play youtube videos in an Android application?

2009-01-26 Thread RoelandP

Dear Michael Kolby, can you show us a working example of how to
exactly implement this youtube view? Would be great to see this!

thank you in advance!

On 21 jan, 13:44, kolby kolbys...@gmail.com wrote:
 The emulator doesn't provide you with the YouTube application (I don't
 know about the developer phone), so the above only works on the actual
 device.

 Michael

 On Jan 20, 11:40 pm, RTM r.thirumurth...@gmail.com wrote:

  Thanks Michael for the reply.  Can I also run the YouTube video with
  the SDK?.

  Regards

  On Jan 20, 11:06 pm, kolby kolbys...@gmail.com wrote:

   You can send a VIEW intent with the video uri. TheYouTubeappon the
   G1 should pick it up.

   Michael

   On Jan 20, 11:31 am, RTM r.thirumurth...@gmail.com wrote:

Hi,
  Are you able to run theYouTubevideo with an Android Application?.
I guess due to lack of Flash support in Android browser, we are not
able to playYouTubevideos. Is there any way we can overcome this?

Regards

On Dec 3 2008, 9:37 pm, Dipin dipinpoovat...@gmail.com wrote:

 Is there any way to play ayoutubevideo in an Android application?
 Using MediaPlayer or VideoView can we play ayoutubevideo?



--~--~-~--~~~---~--~~
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: automatic start using Alaram Manager problem

2009-01-26 Thread AlexeyMot

Move receiver android:name=.OneShotAlarm /  declaration under
application/application

On Jan 26, 9:20 am, Honest honestsucc...@gmail.com wrote:
 On Jan 24, 4:11 am, AlexeyB alex...@mail.ru wrote:

  Try to move your service declaration in the manifest under application
  tag. Regards.

  On Jan 23, 2:00 pm, Honest honestsucc...@gmail.com wrote:

   I hope some one will reply me as early as possible.

 Actually i did not declare any service there so can you tell me what
 i am missing there ? Sorry if am asking you basic question but i am
 just newbie in android.

--~--~-~--~~~---~--~~
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] creating Services for location bases application

2009-01-26 Thread Goldmember

Hi,

I am new to android Development.
I have created a location based application which runs in the
Background. I dont get any errors but when i try to check it out using
emulator. I get a message saying that the applicataion has stopped
unexpectedly, Pls try again.
Can some one help me out with this problem.

Service File:

package com.Location.LBS;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.util.Log;
import android.widget.Toast;
import android.os.Handler;

class BackgroundServiceTask implements Runnable{

private static final String  LOG_TAG=BackgroundService;
private Handler serviceHandler;
private int countDown = 0;
private long interval= 0L;

public BackgroundServiceTask(int countDown, long interval, Handler
serviceHandler)
{
this.countDown = countDown;
this.interval = interval;
this.serviceHandler = serviceHandler;
}

public void run()
{
Log.d(LOG_TAG,Counter:+ countDown);
if(--countDown  0)
serviceHandler.postDelayed(this, interval);
}



}

public class MyService extends Service {

private static final String LOG_TAG =Background Service;
private Handler serviceHandler = new Handler();
private static final int COUNTDOWN_LIMIT = 10;
private static final long COUNTDOWN_INTERVAL = 3*1000L;

protected void onStart(int startId,Bundle arguments)
{
super.onStart(null , startId);
Log.d(LOG_TAG,onstart);

GsmCellLocation location;
int cellID, lac;
final String latLongString;

 TelephonyManager tm = (TelephonyManager)getSystemService
(Context.TELEPHONY_SERVICE);
location = (GsmCellLocation) tm.getCellLocation();


if(location != null)
{
 cellID =location.getCid();
lac = location.getLac();


latLongString=CellID:+ 2675+\n Lac:+8894;

Log.i(getClass().getSimpleName(), Data From 
Location: +
latLongString);

Toast.makeText(this,Location:+latLongString ,
Toast.LENGTH_SHORT);
}
else
{
latLongString =No Location found;
}



BackgroundServiceTask bst = new BackgroundServiceTask
(COUNTDOWN_LIMIT, COUNTDOWN_INTERVAL, serviceHandler);
serviceHandler.postDelayed(bst,COUNTDOWN_INTERVAL);
stopSelf();

}

public void onDestroy()
{
super.onDestroy();
Log.d(LOG_TAG, onDestory);
}


@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}

}


Broadcast receiver file:

package com.Location.LBS;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
//import android.os.Bundle;
import android.content.ComponentName;
import android.util.Log;

public class BootCompletedIntentReceiver extends BroadcastReceiver {

private static final String LOG_TAG =BootCompletedIntentReceiver;

public BootCompletedIntentReceiver() {
// TODO Auto-generated constructor stub
}

@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub

String action = intent.getAction();
Log.d(LOG_TAG, action);
if(action== null)
Log.e(LOG_TAG,Action==null!);
else if(android.intent.action.BOOT_COMPLETED.equals(action))
{
Intent i = new Intent();

i.setClassName(com.Location.LBS,com.Location.LBS.MyService);

ComponentName cname = context.startService(i);
if(cname == null)
Log.e(LOG_TAG, Background Service was not 
Started!);
else
Log.d(LOG_TAG, Background Service Started);
}

}

}


Activity File:


package com.Location.LBS;

import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;

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

[android-developers] question about KEYCODE_NOTIFICATION

2009-01-26 Thread Jin

I tried to run Monkey on G1 to see how long Monkey can  run. Monkey
was always killed whenever the event KEYCODE_NOTIFICATION was sent.
Why is that?

:SendKey: 83// KEYCODE_NOTIFICATION
[1]   Killed  monkey -v -s 116...
--~--~-~--~~~---~--~~
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: Measuring Views

2009-01-26 Thread Alexey

I'm adding this listener in the constructor. I realize that i need to
remove it but i'm not sure at what point . onLayout ?
Is using a ViewTreeObserver a right direction in general  to implement
functionality described ?

On Jan 26, 3:32 pm, Romain Guy romain...@google.com wrote:
 Did you remove your OnPreDrawListener? If you did not, then you are
 creating an infinite loop :)



 On Mon, Jan 26, 2009 at 12:44 PM, Alexey avolo...@gmail.com wrote:

  i've tried to settext to my textView in the OnPreDrawListener() for
  the ViewTreeObserver - it works but now everything is painfully slow.

  On Jan 26, 11:44 am, Alexey avolo...@gmail.com wrote:
  Thanks a lot for your reply but i guess i'm confused how ellipsize
  will help me if i don't know the width and height of the TextView.
  task is a break a long text into two TextView to create wrap around
  the Image effect.
  I have an imageView and textview( where i need to put a short portion
  of the text which should be equal of the height of the image on the
  left ) and big text view below which will receive rest of the text.

  On Jan 26, 11:15 am, Romain Guy romain...@google.com wrote:

   Hi,

   You don't need to do this, you can simply use the ellipsize feature of
   TextView. It will automatically truncate the text based on the
   available space.

 --
 Romain Guy
 Android framework engineer
 romain...@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] ConnectivityService

2009-01-26 Thread alexdonnini

Hello,

Does anyone know if there is any way to access/use ConnectivityService
from an application?

ConnectivityService includes a number of methods related to handling a
change in network connection across different types of network (e.g.
from mobile to WIFI) which I would like to use in my application.

Here is a link to ConnectivityService:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=services/java/com/android/server/ConnectivityService.java;hb=179573d3618c45290a4506be10a7b7f8369422a5

A number of the classes used by ConnectivityService have been removed
from the SDK.

Thanks.

Alex Donnini
--~--~-~--~~~---~--~~
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: Orientation sensor: why does roll change with pitch?

2009-01-26 Thread Jean-Baptiste Queru

The issue is that the implementation of the orientation angles in 1.0
isn't actually pitch and roll, it's pitch around the x axis and pitch
around the y axis.

This was deeply improved for cupcake. Yes, we've maintained
compatibility with the old API too.

JBQ

On Mon, Jan 26, 2009 at 1:10 PM, blindfold seeingwithso...@gmail.com wrote:

 I'm similarly getting more and more confused with the orientation
 sensor readings. With my dev phone 1 running in landscape mode, and
 the phone standing on its left side, values[1] = 0 and values[2] =
 -90. So far so good. Then when I lift the right side of the phone such
 that the screen rotates counterclockwise (leaning just a few degrees
 forward to stay away from any +/-180 jumps etc), values[1] - values[2]
 remains constant at 90, while I am only rotating around the axis
 perpendicular to the screen. Apparently Android sees the rotation
 around the (Z) axis perpendicular to the screen as a rotation around
 *both* X and Y axis. Or if I assume that the axes form an external
 coordinate system with the Z axis pointing upward out of my table top,
 then I would expect a values[1] azimuth dependency, but when azimuth
 is kept at 0 (or any other heading for that matter) I still see the
 same values[1] - values[2] = 90 effect. I do not understand this
 coupling between values[1] and values[2]. How are the X and Y axis
 defined to cause this strange dependency between roll and pitch? I
 expected independent axes but it looks like X, Y and Z are not
 orthogonal?

 As a further experiment, I first carefully put my phone in orientation
 values[] = {45,45,-45} by first putting the phone standing on its left
 side and then tilting the right side to rotate the screen 45 degrees
 counterclockwise as described before, now also adjusting the compass
 heading by rotating around the axis pointing up from my table top to
 make values[0] = 45 as well. Then I found that if I very carefully
 rotated the phone around its long screen axis backward, I can add a
 significant tilt without changing the {45,45,-45} orientation vector
 reading much.

 Anyone here who really understands the G1 orientation sensor's
 coordinate system?

 Thanks

 On Dec 24 2008, 1:20 am, Nick nicholasdo...@gmail.com wrote:
 Hello,

 If I have a pitch of 0 or 180 I can roll between -90 and 90 as
 expected. However as the pitch approaches 90 and -90 the roll range
 decreases proportionally. Should roll be independent of pitch? Also, I
 expected roll to have a range of -180 to 180.

 Any help is appreciated.
 Nick
 




-- 
Jean-Baptiste M. JBQ Queru
Android Engineer, Google.

--~--~-~--~~~---~--~~
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: After the ADT 0.9 update, Eclipse can not create R.java automatically

2009-01-26 Thread Penguin of Death

I ran into the same problem after building SDK/ADT on Mac OS X
Leopard; no R-file is being generated.
At least it doesn't seem like an isolated issue...

On Jan 25, 10:49 pm, MayFirst zhu.sh...@gmail.com wrote:
 I am facing the same issue

 On Jan 24, 6:55 am, Oxygen oxygen.jian.w...@gmail.com wrote:

  I build the SDK and ADT under linux.
  And I met this issue too.

  On 1月23日, 下午10时08分, moontain chen.worksp...@gmail.com wrote:

   Does anybody have any clues on how to fix this issue?

   2009/1/21 moontain chen.worksp...@gmail.com

Hi,

  I checked out cupcake branch yesterday and made the full build and sdk
successfully, and I also built the ADT 0.9 with the command
cupcake/development/tools/eclipse/scripts/build_server.sh on another 
Linux
box. Then I updated the ADT 0.9 and set new SDK on Eclipse.
   Then I created a simple Android project Test with Android Project
Wizard, the Eclipse created project files except the R.java and then
reported following errors.
Seems the resources are  not correctly parsed.

Errors:

[2009-01-21 15:07:32 - Test] W/ResourceType(  267): Unable to get 
buffer of
resource asset file
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
resource identifier found for attribute 'orientation' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
resource identifier found for attribute 'layout_width' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
resource identifier found for attribute 'layout_height' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
resource identifier found for attribute 'layout_width' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
resource identifier found for attribute 'layout_height' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
resource identifier found for attribute 'text' in package 'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:2: ERROR No
resource identifier found for attribute 'versionCode' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:2: ERROR No
resource identifier found for attribute 'versionName' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:6: ERROR No
resource identifier found for attribute 'icon' in package 'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:6: ERROR No
resource identifier found for attribute 'label' in package 'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:7: ERROR No
resource identifier found for attribute 'name' in package 'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:7: ERROR No
resource identifier found for attribute 'label' in package 'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:10: ERROR No
resource identifier found for attribute 'name' in package 'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:11: ERROR No
resource identifier found for attribute 'name' in package 'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:15: ERROR No
resource identifier found for attribute 'minSdkVersion' in package 
'android'
[2009-01-21 15:07:32 - Test] W/ResourceType(  268): Unable to get 
buffer of
resource asset file
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
resource identifier found for attribute 'orientation' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
resource identifier found for attribute 'layout_width' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
resource identifier found for attribute 'layout_height' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
resource identifier found for attribute 'layout_width' in package 
'android'
[2009-01-21 15:07:32 - Test]
/Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
resource identifier found for attribute 

[android-developers] Re: Orientation sensor: why does roll change with pitch?

2009-01-26 Thread blindfold

OK, thank you JBQ. I was working on a coordinate conversion as needed
to make the relevant angles more intuitive to users when using my app
in a see-through display orientation (similar to Wikitude), and it is
good to know that things will improve with cupcake.

On Jan 26, 11:12 pm, Jean-Baptiste Queru j...@google.com wrote:
 The issue is that the implementation of the orientation angles in 1.0
 isn't actually pitch and roll, it's pitch around the x axis and pitch
 around the y axis.

 This was deeply improved for cupcake. Yes, we've maintained
 compatibility with the old API too.

 JBQ

--~--~-~--~~~---~--~~
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: Orientation sensor: why does roll change with pitch?

2009-01-26 Thread Jean-Baptiste Queru

Yes, the see-through case is one that is hard to implement with the
current APIs (because yaw/orientation is even more broken than
roll), and I know the new cupcake APIs are expected to make this
specific case much easier.

JBQ

On Mon, Jan 26, 2009 at 2:35 PM, blindfold seeingwithso...@gmail.com wrote:

 OK, thank you JBQ. I was working on a coordinate conversion as needed
 to make the relevant angles more intuitive to users when using my app
 in a see-through display orientation (similar to Wikitude), and it is
 good to know that things will improve with cupcake.

 On Jan 26, 11:12 pm, Jean-Baptiste Queru j...@google.com wrote:
 The issue is that the implementation of the orientation angles in 1.0
 isn't actually pitch and roll, it's pitch around the x axis and pitch
 around the y axis.

 This was deeply improved for cupcake. Yes, we've maintained
 compatibility with the old API too.

 JBQ

 




-- 
Jean-Baptiste M. JBQ Queru
Android Engineer, Google.

--~--~-~--~~~---~--~~
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: After the ADT 0.9 update, Eclipse can not create R.java automatically

2009-01-26 Thread Breno

Same issue in Windows SDK...

On 26 jan, 19:15, Penguin of Death penguin.of.de...@gmail.com wrote:
 I ran into the same problem after building SDK/ADT on Mac OS X
 Leopard; no R-file is being generated.
 At least it doesn't seem like an isolated issue...

 On Jan 25, 10:49 pm, MayFirst zhu.sh...@gmail.com wrote:

  I am facing the same issue

  On Jan 24, 6:55 am, Oxygen oxygen.jian.w...@gmail.com wrote:

   I build the SDK and ADT under linux.
   And I met this issue too.

   On 1月23日, 下午10时08分, moontain chen.worksp...@gmail.com wrote:

Does anybody have any clues on how to fix this issue?

2009/1/21 moontain chen.worksp...@gmail.com

 Hi,

   I checked out cupcake branch yesterday and made the full build and 
 sdk
 successfully, and I also built the ADT 0.9 with the command
 cupcake/development/tools/eclipse/scripts/build_server.sh on another 
 Linux
 box. Then I updated the ADT 0.9 and set new SDK on Eclipse.
Then I created a simple Android project Test with Android Project
 Wizard, the Eclipse created project files except the R.java and then
 reported following errors.
 Seems the resources are  not correctly parsed.

 Errors:

 [2009-01-21 15:07:32 - Test] W/ResourceType(  267): Unable to get 
 buffer of
 resource asset file
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
 resource identifier found for attribute 'orientation' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
 resource identifier found for attribute 'layout_width' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
 resource identifier found for attribute 'layout_height' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
 resource identifier found for attribute 'layout_width' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
 resource identifier found for attribute 'layout_height' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
 resource identifier found for attribute 'text' in package 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:2: ERROR No
 resource identifier found for attribute 'versionCode' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:2: ERROR No
 resource identifier found for attribute 'versionName' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:6: ERROR No
 resource identifier found for attribute 'icon' in package 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:6: ERROR No
 resource identifier found for attribute 'label' in package 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:7: ERROR No
 resource identifier found for attribute 'name' in package 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:7: ERROR No
 resource identifier found for attribute 'label' in package 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:10: ERROR No
 resource identifier found for attribute 'name' in package 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:11: ERROR No
 resource identifier found for attribute 'name' in package 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/AndroidManifest.xml:15: ERROR No
 resource identifier found for attribute 'minSdkVersion' in package 
 'android'
 [2009-01-21 15:07:32 - Test] W/ResourceType(  268): Unable to get 
 buffer of
 resource asset file
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
 resource identifier found for attribute 'orientation' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
 resource identifier found for attribute 'layout_width' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:2: ERROR No
 resource identifier found for attribute 'layout_height' in package 
 'android'
 [2009-01-21 15:07:32 - Test]
 /Volumes/DATA/workspace/myspace/Test/res/layout/main.xml:7: ERROR No
 resource identifier found for 

[android-developers] Re: OutOfMemoryError BitmapFactory.nativeDecodeByteArray inside Threads

2009-01-26 Thread blindfold

 Check first, and think a bit.

I stand by what I said.

Regards

On Jan 25, 8:30 pm, ad avra...@gmail.com wrote:
 Check first, and think a bit.

 On Jan 25, 2:49 pm, blindfold seeingwithso...@gmail.com wrote:

  How can this possibly help you? You are trying to allocate 61 MB
  (3200*4800*4 bytes), which lies well above the 16 MB heap limit. I
  tried once to allocate, say, 12 MB at program startup to keep Android
  from all the time bumping into the heap limit and possibly crashing as
  a result in case its memory management is not 100% reliable, but
  trying to allocate 61 MB should not offer any benefit?

  Regards

  On Jan 25, 2:23 pm, ad avra...@gmail.com wrote:

   YES YES YES!!!
   I've found solution for that bug.
   It's tricky but it works.
   Place that on the begining of your code.

                   try{
                                  BitmaptmpBitmap =Bitmap.createBitmap
   (3200, 4800,
   Config.ARGB_);
                   }catch(Throwable e){
                           e.printStackTrace();
                           System.out.println(CATCHED );

                   }

   I was fighting with that about 4 days.
   Hope anyone is happy now, that was hell.

   Regards,
   avram.


--~--~-~--~~~---~--~~
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: question about KEYCODE_NOTIFICATION

2009-01-26 Thread Jin

I simply tried to send KEYCODE_NOTIFICATTION to G1 via ADB Shell
input. The input got killed immediately. I did not see this on the
emualtor. So, it seems that we can't send event KEYCODE_NOTIFICATON
directly to G1. Does anyone know the reason?

D: adb shell input keyevent 83
[1]   Killed  input keyevent 83


--~--~-~--~~~---~--~~
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: Screen on/off Intents Can't Be Declared in AndroidManifest?

2009-01-26 Thread Blikkies Botha

Dianne, I have noticed you dispatch useful information on several
occasions that is either not obvious or not included in the
documentation. Is it not possible for you to update the online docs as
you post messages? Screen_on/off not working via the manifest also
caused me much aggravation.
--~--~-~--~~~---~--~~
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: Map Server

2009-01-26 Thread Charlie Collins

Sorry, I thought maybe you hadn't tried the -dns-server route yet, and
were trying to use the localhost etc/hosts.  I don't know of an easier
way.

On Jan 26, 1:46 am, nknize nkn...@gmail.com wrote:
 Thanks for the reply, I appreciate any help on this.  I do understand
 that the emulator doesn't use the machine's host file and that Android
 has its own read-only /etc/hosts file.  I'm looking for an easier way
 to redirect google.com to my own fusion server that doesn't involve
 setting up a private DNS and using the -dns-server flag.  Host files
 obviously make this simple.  In pre r1r2 you could adb push your own
 hosts file.  This was obviously patched.  So is the only solution to
 set up my own DNS?  Has to be an easier way.

 Thanks,

 Nick

 On Jan 25, 5:54 pm, Charlie Collins charlie.coll...@gmail.com wrote:

  The emulator doesn't use the hosts file on the host computer, it has
  it's own networking. You should be able to tweak it for what you need
  there:

 http://code.google.com/android/reference/emulator.html#emulatornetwor

  On Jan 25, 3:04 pm, nknize nkn...@gmail.com wrote:

   All,

   Anyone know of a way to change the server that a MapActivity looks at
   for maps and images?  By default the MapActivity it is pointed 
   tohttp://www.google.com:80.   If you are operating on a self contained
   network (disconnected from the open internet) google cannot be
   resolved.  But if you are running your own google fusion server you
   should be able to point to it as the map server.  I've already tried
   pointingwww.google.comtotheip of the fusion server in my /etc/
   hosts file.  Appears the emulator doesn't use the hosts file.

   Any thoughts?

   Thanks,

   Nick
--~--~-~--~~~---~--~~
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: Sensors don't work on partial wake lock

2009-01-26 Thread Blikkies Botha

In case anyone encounters this issue:

Based on the acceleration values one gets during a screen flip I think
the accelerometer is mounted on the screen assembly so they probably
can't be powered independently. If this is the case it's obviously a
hardware implementation decision that Android should hide. Don't be
surprised if future phones exhibit different behavior because the
accelerometer is housed in a different location.

On Jan 20, 8:42 am, Blikkies Botha james.pretor...@gmail.com wrote:
 The accelerometer turns off when the screen is off. I'm guessing this
 is a bug but I haven't seen it logged. Am I missing something?

 Perhaps the power management features need some improvement - the
 ability to specify what components are needed during a
 partial_wake_lock so that power can be conserved as efficiently as
 possible.

 BTW, there is a bug logged noting that onSensorChanged() continues to
 be called for the orientation sensor (during sleep) but the values are
 not being updated.
--~--~-~--~~~---~--~~
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: 3G network response different from Wifi

2009-01-26 Thread Rich

Somebody on anddev mentioned that this may be an issue related to
NAT.. anything I can do about that?
--~--~-~--~~~---~--~~
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] ellipsize not working with TextView

2009-01-26 Thread Mark Nuetzmann

I am using the following to create a layout that is inflated and used
in a ListView.  The text in the first TextView gets truncated but I do
not get the ... added as I expected.  What do I not have set
correctly?  Or is this a known problem...

?xml version=1.0 encoding=utf-8?
LinearLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=horizontal
android:layout_width=fill_parent
android:layout_height=wrap_content

TextView
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_marginLeft=20px
android:layout_weight=1
android:layout_gravity=center_vertical
android:text=This text will not fit in the space allowed
android:textSize=20.0sp
android:maxLines=1
android:ellipsize=end
/
TextView
android:layout_width=40px
android:layout_height=30px
android:layout_gravity=center_vertical
android:gravity=right|center_vertical
android:text=5
android:textSize=20.0sp
android:layout_marginRight=5sp
android:paddingRight=5sp
/
/LinearLayout
--~--~-~--~~~---~--~~
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: ellipsize not working with TextView

2009-01-26 Thread Romain Guy

Try changing the TextView's width from wrap_content to 0dip.

On Mon, Jan 26, 2009 at 4:13 PM, Mark Nuetzmann
mark.nuetzm...@gmail.com wrote:

 I am using the following to create a layout that is inflated and used
 in a ListView.  The text in the first TextView gets truncated but I do
 not get the ... added as I expected.  What do I not have set
 correctly?  Or is this a known problem...

 ?xml version=1.0 encoding=utf-8?
 LinearLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=horizontal
android:layout_width=fill_parent
android:layout_height=wrap_content

TextView
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_marginLeft=20px
android:layout_weight=1
android:layout_gravity=center_vertical
android:text=This text will not fit in the space allowed
android:textSize=20.0sp
android:maxLines=1
android:ellipsize=end
/
TextView
android:layout_width=40px
android:layout_height=30px
android:layout_gravity=center_vertical
android:gravity=right|center_vertical
android:text=5
android:textSize=20.0sp
android:layout_marginRight=5sp
android:paddingRight=5sp
/
 /LinearLayout
 




-- 
Romain Guy
Android framework engineer
romain...@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: Marketplace Sponsorship

2009-01-26 Thread Peter Fisher

Okay thanks guys, ill look into the online repositories. Do you get
any benefits other than being able to provide application on the
marketplace when you sign up?

On Mon, Jan 26, 2009 at 11:01 AM, Michael MacDonald
googlec...@antlersoft.com wrote:

 Perhaps some registered developer will offer to put it on the market for
 you...

 Peter wrote:
 I have been working on an Application that displays in-game time
 information for a popular MMO Final Fantasy XI. Its finally complete
 and I wanted to release it to the market but I noticed you have to
 spend 25$ to activate your account. I don't really want to spend any
 money right now on it and was wondering if there was any kind of
 sponsorship program to help out with the fee. I don't mind providing
 all my contact information just don't want to spend all the money on
 it.

 Cheers.
 


 


--~--~-~--~~~---~--~~
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: Provider.Settings.Secure database is lacking some entries

2009-01-26 Thread Dianne Hackborn
That seems okay.  What do you think is wrong?  Not all of the possible
entries are initialized, like on 1.0.

On Mon, Jan 26, 2009 at 1:57 PM, laubea...@googlemail.com 
laubea...@googlemail.com wrote:


 Hello,
 When running Cupcake release in my SDK I noticed that the secure table
 in settings db does not contain what is defined in [platform/
 frameworks/base.git] / core / java / android / provider /
 Settings.java.

 Here is the ADB output:

 sqlite3 /data/data/com.android.providers.settings/databases/
 settings.db
 sqlite3 /data/data/com.android.providers.settings/databases/
 settings.db
 SQLite version 3.5.9
 Enter .help for instructions
 sqlite .tables
 .tables
 android_metadata   bookmarks  secure
 bluetooth_devices  gservices  system
 sqlite .dump secure
 .dump secure
 BEGIN TRANSACTION;
 CREATE TABLE secure (_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT
 UNIQUE ON CONFLICT REPLACE,valu
 e TEXT);
 INSERT INTO secure VALUES(1,'bluetooth_on','0');
 INSERT INTO secure VALUES(2,'data_roaming','0');
 INSERT INTO secure VALUES(3,'install_non_market_apps','0');
 INSERT INTO secure VALUES(4,'location_providers_allowed','network');
 INSERT INTO secure VALUES(5,'network_preference','1');
 INSERT INTO secure VALUES(6,'usb_mass_storage_enabled','1');
 INSERT INTO secure VALUES(7,'wifi_on','0');
 INSERT INTO secure VALUES
 (8,'wifi_networks_available_notification_on','1');
 INSERT INTO secure VALUES
 (9,'enabled_input_methods','com.example.android.softkeyboard/.SoftKeyboar
 d');
 INSERT INTO secure VALUES
 (19,'default_input_method','com.example.android.softkeyboard/.SoftKeyboar
 d');
 INSERT INTO secure VALUES(20,'adb_enabled','1');
 CREATE INDEX secureIndex1 ON secure (name);
 COMMIT;

 Would anyone know what could be wrong?

 Thanks,
 Laurent

 



-- 
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] Identifying pictures taken on 'this' device

2009-01-26 Thread GiladH

Hey,

Is there a way to identify which of the MediaStore images has been
taken
on 'this' device, as opposed to pictures exported/downloaded from an
external source ?


I have started my search by creating a Camera.PictureCallback and
registering it
by  camera.takePicture() only to realize that it only gets called upon
images taken from _my own_ application -  and idea goes to basket.

I have also looked within MediaStore.Images.Media for fields that
might carry relevant information, with no luck.

TIA,
GiladH



--~--~-~--~~~---~--~~
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] Search engine app for Android? It's in Perst 4.0 embedded database

2009-01-26 Thread Ted

Looking for a way to integrate full-text search and fast, lightweight
data management with your Android applications?

The new Perst 4.0 open source, object-oriented embedded database
system brings native full-text search capability to Android and builds
on this feature to provide a sample search engine application for
contact data residing on mobile phones.

To provide search, the database stores an inverse index of keywords,
with parsing and stemming of indexed text performed either by user-
defined code or by Perst's default simple parser and stemmer. The
feature supports logical operators and calculates relevance of search
results to a query. The new sample application, ContactsIndex, stores
and indexes contact information, and could be extended to provide
search capabilities for PDF, word processing, HTML and other stored
files. The example applications are included with complete source code
in the Perst 4.0 for Java distribution.

Also new in Perst 4.0 for Android: support for non-native objects,
which expands the scope of the embedded database to benefit a larger
variety of application types.

The Perst embedded database system helps developers create small-
footprint embedded Java applications for Android that are fast,
reliable, and cost-effective to develop and maintain.

You can find out more about what's new in Perst 4.0 at:

http://www.mcobject.com/perst_v4_for_mobile_phones

and download the open source Perst and Perst Lite software at:

http://www.mcobject.com/perst_eval

Details about Perst and Android are at http://www.mcobject.com/android.


--~--~-~--~~~---~--~~
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: Sleep on END_CALL keycode, but terminate on HOME?

2009-01-26 Thread g1bb

That looks like it's going to work great.

Thanks, Guillaume!

On Jan 26, 3:55 am, Guillaume Perrot guillaume.p...@gmail.com wrote:
 HOME calls onPause then onStop most of the time.
 BACK do the same but also calls onDestroy after onStop (if you didn't
 override the BACK button behavior and no dialog or menu is being
 displayed).
 The Acitivity.finish() function do the same as the BACK button.

 You can try the following (I didn't test it):
 You can have a boolean flag that your set when you press your button.
 Then in onPause, test your flag:
 If the flag is true (meaning you pressed the button), do nothing more.
 if the flag is false it means BACK, HOME or another activity is over
 yours: ensure the activity will finish by calling finish(); so that
 the HOME button will do the same as the BACK one.
 The side effect of this is that your activity will finish if you
 launch another one over it.

 On Jan 26, 2:46 am, g1bb corymgibb...@gmail.com wrote:

  Hello,

  I have an activity that I would like the user to be able to put to
  sleep once the end call button is pressed, but terminate once the back
  or home buttons are pressed. Since it seems that end call and home
  both call OnPause(), is there a good way to do this?

  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] Is there any way to know application updates?

2009-01-26 Thread Nock

I easily missed application updates I use.
Is there any way to get update notification for each applications I
installed?

of should I check My downloads list occasionally?

--~--~-~--~~~---~--~~
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: Sporadic SharedPreferences reset

2009-01-26 Thread radiolistener

I've been struggling with these shared preferences.  I want to save a
resolution setting, so that people with different degrees of vision
can see the screen.  With a Diabetes application, this is a very
important feature.

What I've found thus far, however I cut the cake, I lose my settings
with either a cold boot or a re-install.  This isn't readily tenable.
So, I'm thinking of either writing them to the database or writing
them to the sdcard.  I'm weighing those two options now.

Any insights would be appreciated.

Thanks,

John aka Radiolistener

On Jan 25, 5:03 pm, Christoph Studer chstu...@gmail.com wrote:
 Yeah, Base64 encoding would certainly help until the platform bug is fixed.

 I guess a lot of people with strong passwords (i.e. passwords
 containing special characters) are in trouble with a lot of apps right
 now.

 It's funny you mention two apps I share parts of the codebase with. I
 stripped down ImapStore for my app and included it as a jar in my
 package. But it's very very unlikely that this would have an impact.

 Christoph

 On Sun, Jan 25, 2009 at 5:53 PM, Daniel android-...@danapple.com wrote:

  This has been a recurring problem with K-9:
 http://code.google.com/p/k9mail/issues/detail?id=143
  and apparently the core Email as well:
 http://www.androidforums.com/showthread.php?p=16842
  and possibly other apps, too:
 http://groups.google.com/group/android-developers/browse_thread/threa...
 http://www.mail-archive.com/android-developers@googlegroups.com/msg13...

  Your observation about the  and  makes sense to me, as one reason
  the preferences can fail to save or load is due to XML generation or
  parsing problems.  I've thought that perhaps Base64 encoding all of
  the preference values might be a smart move.

  Dan.

  On Jan 24, 11:56 am, Christoph Studer chstu...@gmail.com wrote:
  Hello,

  I'm making use of SharedPreferences in my application. One part is a
  PreferenceActivity and the other part is a backend that accesses the
  preferences using PreferenceManager.getDefaultSharedPreferences(...).
  Both parts are running in the same process, but potentially in
  different threads.

  Now, from time to time, I encounter a reset of all the preferences. It
  looks to me like this happens when my process is killed (e.g. when
  installing a new version or starting the activity or service the first
  time after a long time). However, it is not reproducible by killing
  the process manually and it does not happen consistently.

  Are there other people who have the same problem? Is there a race
  condition that could lead to something like this?

  The source code of my app can be found 
  here:http://code.google.com/p/android-sms/source/browse/

  The relevant files 
  are:http://code.google.com/p/android-sms/source/browse/trunk/android-clie...
  andhttp://code.google.com/p/android-sms/source/browse/trunk/android-clie...

  Thank you,

  Christoph
--~--~-~--~~~---~--~~
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: Sporadic SharedPreferences reset

2009-01-26 Thread Christoph Studer

If you do not store values with special characters in your settings,
it might be interesting to see some of your code in order to analyze
why you're losing them.

If we're only talking about the problem with special characters, you
should be fine with Base64 encoding values that potentially lead to
problems. I think this puts the least overhead on the device and on
you as the developer. A simple wrapper class around these values that
encodes and decodes them in front of the SharedPreferences would be
enough.

Especially putting it onto the SD card adds a lot of special cases
that you'd have to handle yourself, e.g. SD card not mounted or being
unmounted (which will kill your process if you don't handle it
correctly).

Christoph


On Tue, Jan 27, 2009 at 2:54 AM, radiolistener
radioliste...@optonline.net wrote:

 I've been struggling with these shared preferences.  I want to save a
 resolution setting, so that people with different degrees of vision
 can see the screen.  With a Diabetes application, this is a very
 important feature.

 What I've found thus far, however I cut the cake, I lose my settings
 with either a cold boot or a re-install.  This isn't readily tenable.
 So, I'm thinking of either writing them to the database or writing
 them to the sdcard.  I'm weighing those two options now.

 Any insights would be appreciated.

 Thanks,

 John aka Radiolistener

 On Jan 25, 5:03 pm, Christoph Studer chstu...@gmail.com wrote:
 Yeah, Base64 encoding would certainly help until the platform bug is fixed.

 I guess a lot of people with strong passwords (i.e. passwords
 containing special characters) are in trouble with a lot of apps right
 now.

 It's funny you mention two apps I share parts of the codebase with. I
 stripped down ImapStore for my app and included it as a jar in my
 package. But it's very very unlikely that this would have an impact.

 Christoph

 On Sun, Jan 25, 2009 at 5:53 PM, Daniel android-...@danapple.com wrote:

  This has been a recurring problem with K-9:
 http://code.google.com/p/k9mail/issues/detail?id=143
  and apparently the core Email as well:
 http://www.androidforums.com/showthread.php?p=16842
  and possibly other apps, too:
 http://groups.google.com/group/android-developers/browse_thread/threa...
 http://www.mail-archive.com/android-developers@googlegroups.com/msg13...

  Your observation about the  and  makes sense to me, as one reason
  the preferences can fail to save or load is due to XML generation or
  parsing problems.  I've thought that perhaps Base64 encoding all of
  the preference values might be a smart move.

  Dan.

  On Jan 24, 11:56 am, Christoph Studer chstu...@gmail.com wrote:
  Hello,

  I'm making use of SharedPreferences in my application. One part is a
  PreferenceActivity and the other part is a backend that accesses the
  preferences using PreferenceManager.getDefaultSharedPreferences(...).
  Both parts are running in the same process, but potentially in
  different threads.

  Now, from time to time, I encounter a reset of all the preferences. It
  looks to me like this happens when my process is killed (e.g. when
  installing a new version or starting the activity or service the first
  time after a long time). However, it is not reproducible by killing
  the process manually and it does not happen consistently.

  Are there other people who have the same problem? Is there a race
  condition that could lead to something like this?

  The source code of my app can be found 
  here:http://code.google.com/p/android-sms/source/browse/

  The relevant files 
  are:http://code.google.com/p/android-sms/source/browse/trunk/android-clie...
  andhttp://code.google.com/p/android-sms/source/browse/trunk/android-clie...

  Thank you,

  Christoph
 


--~--~-~--~~~---~--~~
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] discover intents that an app supports

2009-01-26 Thread Peter Jeffe

Is there any way to discover which intents a given app supports?  An
old post indicated that PackageManager.GET_INTENT_FILTERS isn't
supported, might there be some other 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: onProviderEnabled() not being called dynamically enabling GPS

2009-01-26 Thread Ken Adair

As anyone else encountered 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: Sporadic SharedPreferences reset

2009-01-26 Thread radiolistener

My issue was simpler than that.  I was trying to get any setting to
read, write, save, then recall under any condition.  What I was doing
wrong was I didn't have the xml file set up right.  It appears to work
fine now.

Thanks, it was from studying your code that I figured out what was
wrong.  So far, it works with power down, and a re-install, does it
also work with upgrades?

Here's the source code:

package ree.sharedpreferences.share;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class actor extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main );
Button setter = (Button) findViewById(R.id.setter );
Button readinger = (Button) findViewById(R.id.readinger );

setter.setOnClickListener(new View.OnClickListener() {

public void onClick(View view) {

SharedPreferences preferences = 
getSharedPreferences
(first_preferencescreen , MODE_PRIVATE);

SharedPreferences.Editor editor = 
preferences.edit();

editor.putString(eyesight, Radar); // value 
to store

editor.commit();


}

});

readinger.setOnClickListener(new View.OnClickListener() {

public void onClick(View view) {

SharedPreferences preferences = 
getSharedPreferences
(first_preferencescreen , MODE_PRIVATE);
String j = preferences.getString(eyesight, 
radio);

 TextView k = (TextView) 
findViewById(R.id.lets_read  );
 k.setText(j);

}

});



}
}

/*Button android:id=@+id/setter
android:text=SetSetting
android:layout_width=wrap_content
android:layout_height=wrap_content
android:textSize=22px
/
Button android:id=@+id/readinger
android:text=ReadSetting
android:layout_width=wrap_content
android:layout_height=wrap_content
android:textSize=22px
 /
*/

And here's the xml, which is almost verbatim yours:


PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/
android android:key=first_preferencescreen

PreferenceCategory android:title=PrefCategory android:order=1
EditTextPreference android:key=eyesight
android:title=eyes
android:summary=degree of resolution
android:singleLine=true
android:dialogMessage=Resolution
android:persistent=true/

/PreferenceCategory
/PreferenceScreen



On Jan 26, 9:09 pm, Christoph Studer chstu...@gmail.com wrote:
 If you do not store values with special characters in your settings,
 it might be interesting to see some of your code in order to analyze
 why you're losing them.

 If we're only talking about the problem with special characters, you
 should be fine with Base64 encoding values that potentially lead to
 problems. I think this puts the least overhead on the device and on
 you as the developer. A simple wrapper class around these values that
 encodes and decodes them in front of the SharedPreferences would be
 enough.

 Especially putting it onto the SD card adds a lot of special cases
 that you'd have to handle yourself, e.g. SD card not mounted or being
 unmounted (which will kill your process if you don't handle it
 correctly).

 Christoph

 On Tue, Jan 27, 2009 at 2:54 AM, radiolistener

 radioliste...@optonline.net wrote:

  I've been struggling with these shared preferences.  I want to save a
  resolution setting, so that people with different degrees of vision
  can see the screen.  With a Diabetes application, this is a very
  important feature.

  What I've found thus far, however I cut the cake, I lose my settings
  with either a cold boot or a re-install.  This isn't readily tenable.
  So, I'm thinking of either writing them to the database or writing
  them to the sdcard.  I'm weighing those two options now.

  Any insights would be appreciated.

  Thanks,

  John aka Radiolistener

  On Jan 25, 5:03 pm, Christoph Studer chstu...@gmail.com wrote:
  Yeah, Base64 encoding would certainly help until the platform bug is fixed.

  I guess a lot of people with strong passwords (i.e. passwords
  containing special characters) are in trouble with a lot of apps right
  now.

  It's funny you mention two apps I share parts of the codebase with. I
  stripped down ImapStore for my app and included it as a jar in my
  package. But it's very very unlikely that this would have an impact.

  Christoph

  On Sun, Jan 25, 2009 at 5:53 PM, Daniel 

[android-developers] Re: Age of GPS data

2009-01-26 Thread gjs

Hi,

Subtract the Location.getTime() value from the current time to get the
age of the last fix.

See http://code.google.com/android/reference/android/location/Location.html

Regards

On Jan 23, 10:07 am, Anna PS annapowellsm...@googlemail.com wrote:
 Hi

 When you get GPS location using getLastKnownLocation, is there a way
 to check how old the data is, i.e. when the location was last
 updated?

 I'm noticing that sometimes my app is giving me an out-of-date
 location (usually because the sky is not visible when the app starts)
 - it'd be good to warn the user about this.

 It's possible to check the age of the data on the iPhone I believe, is
 it possible in Android?

 thanks!
 Anna
--~--~-~--~~~---~--~~
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: ellipsize not working with TextView

2009-01-26 Thread Mark Nuetzmann

just tried that.  no change. Still does not display the ..., just
truncates the text.

On Jan 26, 6:15 pm, Romain Guy romain...@google.com wrote:
 Try changing the TextView's width from wrap_content to 0dip.

 On Mon, Jan 26, 2009 at 4:13 PM, Mark Nuetzmann



 mark.nuetzm...@gmail.com wrote:

  I am using the following to create a layout that is inflated and used
  in a ListView.  The text in the first TextView gets truncated but I do
  not get the ... added as I expected.  What do I not have set
  correctly?  Or is this a known problem...

  ?xml version=1.0 encoding=utf-8?
  LinearLayout
         xmlns:android=http://schemas.android.com/apk/res/android;
         android:orientation=horizontal
         android:layout_width=fill_parent
         android:layout_height=wrap_content

         TextView
                 android:layout_height=wrap_content
                 android:layout_width=wrap_content
                 android:layout_marginLeft=20px
                 android:layout_weight=1
                 android:layout_gravity=center_vertical
                 android:text=This text will not fit in the space allowed
                 android:textSize=20.0sp
                 android:maxLines=1
                 android:ellipsize=end
                 /
         TextView
                 android:layout_width=40px
                 android:layout_height=30px
                 android:layout_gravity=center_vertical
                 android:gravity=right|center_vertical
                 android:text=5
                 android:textSize=20.0sp
                 android:layout_marginRight=5sp
                 android:paddingRight=5sp
                 /
  /LinearLayout

 --
 Romain Guy
 Android framework engineer
 romain...@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: Measuring Views

2009-01-26 Thread Alexey

Now i'm thinking it'll be easier to make calc in the constructor based
on image size and screen. not very elegant though

On Jan 26, 3:45 pm, Alexey avolo...@gmail.com wrote:
 I'm adding this listener in the constructor. I realize that i need to
 remove it but i'm not sure at what point . onLayout ?
 Is using a ViewTreeObserver a right direction in general  to implement
 functionality described ?

 On Jan 26, 3:32 pm, Romain Guy romain...@google.com wrote:

  Did you remove your OnPreDrawListener? If you did not, then you are
  creating an infinite loop :)

  On Mon, Jan 26, 2009 at 12:44 PM, Alexey avolo...@gmail.com wrote:

   i've tried to settext to my textView in the OnPreDrawListener() for
   the ViewTreeObserver - it works but now everything is painfully slow.

   On Jan 26, 11:44 am, Alexey avolo...@gmail.com wrote:
   Thanks a lot for your reply but i guess i'm confused how ellipsize
   will help me if i don't know the width and height of the TextView.
   task is a break a long text into two TextView to create wrap around
   the Image effect.
   I have an imageView and textview( where i need to put a short portion
   of the text which should be equal of the height of the image on the
   left ) and big text view below which will receive rest of the text.

   On Jan 26, 11:15 am, Romain Guy romain...@google.com wrote:

Hi,

You don't need to do this, you can simply use the ellipsize feature of
TextView. It will automatically truncate the text based on the
available space.

  --
  Romain Guy
  Android framework engineer
  romain...@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: MediaRecorder docs fix

2009-01-26 Thread Dave Sparks

Would you please post a bug with specifics? Thanks!

On Jan 26, 12:03 pm, Tim Bray timb...@gmail.com wrote:
 The section Recording Media Resources 
 ofhttp://code.google.com/android/toolbox/apis/media.htmlseems to be out of
 date and wrong.  I got working code 
 fromhttp://rehearsalassist.svn.sourceforge.net/viewvc/rehearsalassist/and...
 which
 is quite different.
 It would be a good idea to correct at least remove the misleading online
 version. -Tim
--~--~-~--~~~---~--~~
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] JavaScript XMLHTTPRequest

2009-01-26 Thread kevin

I am trying to use javascript XMLHTTPRequest inside a webview.
Wondering if anyone has experience doing this and what is the
limitation Android webview has?

Anyway to get around loading a local page with javascript
XMLHTTPRequest having security issue for other domain?

Thanks,
Kevin
--~--~-~--~~~---~--~~
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: Recording audio stream

2009-01-26 Thread Dave Sparks

I can't give you specifics about deployment because:

(a) I don't know, it's up to the carrier and manufacturer to decide
when they deploy new releases

(b) Even I did know, there's a fairly good chance I couldn't tell you
due to NDA's we have with our partners

You can see the code in development on the Cupcake branch at
android.git.kernel.org.

On Jan 26, 11:31 am, benmccann benjamin.j.mcc...@gmail.com wrote:
 I'm happy to hear future releases will support the ability to stream
 audio being recorded.  Any ETA on this?

 On Dec 30 2008, 9:58 am, Dave Sparks davidspa...@android.com wrote:

  It's probably not really streaming audio. Some people are working
  around the issue by tailing the file as it is being written.

  On Dec 30, 5:03 am, FranckLefevre flas...@gmail.com wrote:

   The application Phone Recorder available in Market softwares already
   does this pretty well.
   I don't know if sources are available somewhere...

   Franck.

   On Dec 25, 1:27 am, vitalii.mi...@gmail.com

   vitalii.mi...@gmail.com wrote:
  Is there any way torecordaudiostreamand send streaming audio  to
network ??  Instead of recording to file.
--~--~-~--~~~---~--~~
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: Identifying pictures taken on 'this' device

2009-01-26 Thread Dave Sparks

The camera application in the Cupcake branch does it somehow. You
could try looking at the code in packages/apps/Camera.

On Jan 26, 4:38 pm, GiladH gila...@gmail.com wrote:
 Hey,

 Is there a way to identify which of the MediaStore images has been
 taken
 on 'this' device, as opposed to pictures exported/downloaded from an
 external source ?

 I have started my search by creating a Camera.PictureCallback and
 registering it
 by  camera.takePicture() only to realize that it only gets called upon
 images taken from _my own_ application -  and idea goes to basket.

 I have also looked within MediaStore.Images.Media for fields that
 might carry relevant information, with no luck.

 TIA,
 GiladH
--~--~-~--~~~---~--~~
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] Rotating SurfaceView

2009-01-26 Thread ivan

Is it possilble to rotate a SurfaceView that displays the contents of
a buffer of type SURFACE_TYPE_PUSH_BUFFERS coming from the camera?

I have tried many different ways, but to no avail ...

If it is possible, does anyone happen to have any code snippets?

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: Dynamically changing the language at runtime

2009-01-26 Thread Raja Nagendra Kumar

Diannel thank you, Deep thank you for the complete source spippet..

On Jan 27, 1:23 am, deepdr...@googlemail.com
deepdr...@googlemail.com wrote:
 ya, great, thanks, this works for me ! :

                 Resources res = getResources();
                 DisplayMetrics dm = res.getDisplayMetrics();
                 Configuration conf = res.getConfiguration();
                 conf.locale = Locale.GERMANY;
                 res.updateConfiguration(conf, dm);
                 firstline= res.getString(R.string.firstline);

 On Jan 26, 9:09 pm, Dianne Hackborn hack...@android.com wrote:



  You can't just modify the structure, you need to give a new Configuration of
  new values to Resources.updateConfiguration().

  On Mon, Jan 26, 2009 at 11:21 AM, deepdr...@googlemail.com 

  deepdr...@googlemail.com wrote:

   I tried :

                  Resources res = getResources();
                  res.getConfiguration().locale = Locale.GERMANY;
                  firstline= res.getString(R.string.firstline);

   in my onCreate() . But, although I do have res/values-de/strings.xml
   this still gives me the english string for firstline.
   So it seems to me that there's no easy way to test different languages
   without an actual device for that language (?)

   On Jan 24, 10:28 pm, Dianne Hackborn hack...@android.com wrote:
This isn't really supported, though you can change the language of the
Configuration used by your Resources object.  This will only impact your
   own
app, though, not things displayed by others like your notifications
   (those
will still use the system's locale).

On Fri, Jan 23, 2009 at 10:39 PM, Raja Nagendra Kumar 

nagendra.r...@gmail.com wrote:

 Hi Romain,

 Thank You Romain, a follow up to this how do I change the default
 languge to choose in my application based on the menu we provide with
 in the andorid application..
 I may still want to keep my phone locale some thing deferent than the
 application locale.

 Regards,
 Nagendra

 On Jan 24, 11:16 am, Romain Guy romain...@google.com wrote:
  Hi,

  All you need to do is place your resources in locale specific
  directories. For instance:

  res\
    drawable-en\
    values-fr\
    layout-jp\

  In your example to localize the app in English and German, you would
 have:

  res\
    values\
      strings.xml
    values-de\
      strings.xml

  And Android will automatically pick up the right strings.xml at
  runtime, depending on the locale. If you want to know more about
  resources and configurations, please readhttp://
 code.google.com/android/devel/resources-i18n.html

  On Fri, Jan 23, 2009 at 10:10 PM, Raja Nagendra Kumar

  nagendra.r...@gmail.com wrote:

   Is there any good example to show how a single compiled 
   application
   could support both english and say germany..

   The aapt approach and Resource R.java approach seems to me that, 
   we
   may need to have one binary for english and one for germany
   etc..and
   so on..

   Like in J2ME, could we switch the language at runtime..

   Regards,
   Raja Nagendra Kumar,
   C.T.O
  www.tejasoft.com

  --
  Romain Guy
  Android framework engineer
  romain...@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- Hide
   quoted
 text -

  - Show quoted text -

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

  --
  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.- Hide quoted text -

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



[android-developers] Specific Design significance of Attribute Name Spaces in AndroidManifest Files.

2009-01-26 Thread Raja Nagendra Kumar

We see in most of the Android examples attributes are given namespace
as android:

like in..

activity android:name=.dial.activities.DialRelationActivity
  android:label=@string/dial_relation_title
/activity

With most of the java server technlogies like jsp etc.. only tag name
spaces are very usual.. Android has just reverse.. any reason why tag
name spaces are assumed and attribute name spaces are specified in the
xmls..

Any design or any special focus for andorid to use like this..

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.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] Can the manfifest name be different than AndroidManifest.xml

2009-01-26 Thread Raja Nagendra Kumar

Is it possible to name manfifest file different than
AndroidManifest.xml.. like in jar -m to build jar files.. Would this
have any impact on all other tools of andorid using manfiest files..

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.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: Specific Design significance of Attribute Name Spaces in AndroidManifest Files.

2009-01-26 Thread Raja Nagendra Kumar

When we remove android: in the activity defination

aapt reports error

 [aapt] F:\tejasoft\work\products\dialer\mobile\android\build\temp
\manifest\
AndroidManifest.xml:44: Tag activity missing required attribute
name.


The default name space should have been assumed to be same as tag name
space in this case we already defined for the root

manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=com.tejasoft.dialer.android

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] Interesting problem

2009-01-26 Thread ipeg . student

Hi developers.


Thanks for the replies.   I have a problem from last
few days. I want to delete sms from my inbox. I have used this code
for deletion.

Uri uri = Uri.parse(content://sms/inbox);
Cursor c1= getContentResolver().query(uri, null, null,null,null);
  int thread_id = c1.getInt(1);

getContentResolver().delete(Uri.parse(content://sms/
conversations/ + thread_id),null,null);

//

But it dose not work . Please help me if any thing wrong and give me
the right code. Thanks in advance .

 
Suman.
--~--~-~--~~~---~--~~
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] Getting 'OutOfMemoryException' while trying to download a 14mb mp3 file from webserver

2009-01-26 Thread Mahesh Vaghela
Hi Friends,

I want to play an mp3 file as soon as my application starts. The mp3 file is
really large in size(approx 14 mb).

So I am trying to download it from a webserver and than I want to store it
on sdcard.

While doing so I am getting OutOfMemoryException. Can anybody please help
me?

My code is as follows:



public MainClass() throws Exception
{

URL u = new URL(http://--;);
URLConnection uc = u.openConnection();
String contentType = uc.getContentType();
int contentLength = uc.getContentLength();

if(contentLength  Integer.MAX_VALUE)
{

}

if (contentType.startsWith(text/) || contentLength == -1)
{
 throw new IOException(This is not a binary file.);
}

InputStream raw = uc.getInputStream();

InputStream in = new BufferedInputStream(raw);


*// Getting OutOfMemoryException here

**byte [] data=new byte[(int)contentLength];*


int bytesRead = 0;

int offset = 0;

while (offset  contentLength)
{

bytesRead = in.read(data, offset, data.length - offset);
if (bytesRead == -1)
break;
offset += bytesRead;
}

in.close();

/*

if (offset != contentLength)
{
  throw new IOException(Only read  + offset +  bytes; Expected  +
contentLength +bytes);
}

*/


// String filename = u.getFile().substring(filename.lastIndexOf('/') + 1);

FileOutputStream out = new FileOutputStream(/sdcard/music.mp3);

out.write(data);

out.flush();

out.close();

}


Mahesh

--~--~-~--~~~---~--~~
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: Getting 'OutOfMemoryException' while trying to download a 14mb mp3 file from webserver

2009-01-26 Thread Romain Guy

You cannot allocate a 14MB byte array in memory. Your application has
only access to 16MB maximum. To download a large file from the Web,
simply read it little bit by little bit. For instance, instead of
reading 16MB at once, download 16 or 32kB, write them to the
outputstream, and keep looping until the end of the stream.

On Mon, Jan 26, 2009 at 9:00 PM, Mahesh Vaghela mah...@indianic.com wrote:
 Hi Friends,

 I want to play an mp3 file as soon as my application starts. The mp3 file is
 really large in size(approx 14 mb).

 So I am trying to download it from a webserver and than I want to store it
 on sdcard.

 While doing so I am getting OutOfMemoryException. Can anybody please help
 me?

 My code is as follows:



 public MainClass() throws Exception
 {

 URL u = new URL(http://--;);
 URLConnection uc = u.openConnection();
 String contentType = uc.getContentType();
 int contentLength = uc.getContentLength();

 if(contentLength  Integer.MAX_VALUE)
 {

 }

 if (contentType.startsWith(text/) || contentLength == -1)
 {
  throw new IOException(This is not a binary file.);
 }

 InputStream raw = uc.getInputStream();

 InputStream in = new BufferedInputStream(raw);


 // Getting OutOfMemoryException here

 byte [] data=new byte[(int)contentLength];


 int bytesRead = 0;

 int offset = 0;

 while (offset  contentLength)
 {

 bytesRead = in.read(data, offset, data.length - offset);
 if (bytesRead == -1)
 break;
 offset += bytesRead;
 }

 in.close();

 /*

 if (offset != contentLength)
 {
   throw new IOException(Only read  + offset +  bytes; Expected  +
 contentLength +bytes);
 }

 */


 // String filename = u.getFile().substring(filename.lastIndexOf('/') + 1);

 FileOutputStream out = new FileOutputStream(/sdcard/music.mp3);

 out.write(data);

 out.flush();

 out.close();

 }


 Mahesh





 




-- 
Romain Guy
Android framework engineer
romain...@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] Query regarding OutOfMemoryException

2009-01-26 Thread parth Chothani
I am downloading a audio file from server on sd card. It is showing me
OutOfMemoryException.

This is my code..
---
package com.android;

import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

public class MainClass {

  public MainClass() throws Exception
  {

URL u = new URL(http://--;);
URLConnection uc = u.openConnection();
String contentType = uc.getContentType();
int contentLength = uc.getContentLength();
if(contentLength  Integer.MAX_VALUE)
{

}
if (contentType.startsWith(text/) || contentLength == -1) {
  throw new IOException(This is not a binary file.);
}
InputStream raw = uc.getInputStream();
InputStream in = new BufferedInputStream(raw);
byte [] data=new byte[(int)contentLength];
//byte[] data1 = new byte[contentLength/2];
int bytesRead = 0;
int offset = 0;
while (offset  contentLength)
{

  bytesRead = in.read(data, offset, data.length - offset);
  if (bytesRead == -1)
break;
  offset += bytesRead;
}
in.close();

/*if (offset != contentLength) {
  throw new IOException(Only read  + offset +  bytes; Expected  +
contentLength +  bytes);
}*/


   // String filename = u.getFile().substring(filename.lastIndexOf('/') +
1);
FileOutputStream out = new FileOutputStream(/sdcard/music.mp3);
out.write(data);
out.flush();
out.close();
  }
}



The error is at this line:
byte [] data=new byte[(int)contentLength];
This is because the size of the contentLength 16987867



I am trying since long and stuck up here..
How to solve this exception? Pls 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: Query regarding OutOfMemoryException

2009-01-26 Thread Romain Guy

I already answered this question twice today.

On Mon, Jan 26, 2009 at 9:18 PM, parth Chothani
parth.india...@gmail.com wrote:
 I am downloading a audio file from server on sd card. It is showing me
 OutOfMemoryException.

 This is my code..
 ---
 package com.android;

 import java.io.BufferedInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;

 public class MainClass {

   public MainClass() throws Exception
   {

 URL u = new URL(http://--;);
 URLConnection uc = u.openConnection();
 String contentType = uc.getContentType();
 int contentLength = uc.getContentLength();
 if(contentLength  Integer.MAX_VALUE)
 {

 }
 if (contentType.startsWith(text/) || contentLength == -1) {
   throw new IOException(This is not a binary file.);
 }
 InputStream raw = uc.getInputStream();
 InputStream in = new BufferedInputStream(raw);
 byte [] data=new byte[(int)contentLength];
 //byte[] data1 = new byte[contentLength/2];
 int bytesRead = 0;
 int offset = 0;
 while (offset  contentLength)
 {

   bytesRead = in.read(data, offset, data.length - offset);
   if (bytesRead == -1)
 break;
   offset += bytesRead;
 }
 in.close();

 /*if (offset != contentLength) {
   throw new IOException(Only read  + offset +  bytes; Expected  +
 contentLength +  bytes);
 }*/


// String filename = u.getFile().substring(filename.lastIndexOf('/') +
 1);
 FileOutputStream out = new FileOutputStream(/sdcard/music.mp3);
 out.write(data);
 out.flush();
 out.close();
   }
 }



 The error is at this line:
 byte [] data=new byte[(int)contentLength];
 This is because the size of the contentLength 16987867
 


 I am trying since long and stuck up here..
 How to solve this exception? Pls help





 




-- 
Romain Guy
Android framework engineer
romain...@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: Getting 'OutOfMemoryException' while trying to download a 14mb mp3 file from webserver

2009-01-26 Thread Mahesh Vaghela
Romain,

Thank you very much for replying very soon.
I am trying your suggestion and do post my detail code as soon as it get
done.

Once again, Thanks a lot!






On Tue, Jan 27, 2009 at 10:37 AM, Romain Guy romain...@google.com wrote:


 You cannot allocate a 14MB byte array in memory. Your application has
 only access to 16MB maximum. To download a large file from the Web,
 simply read it little bit by little bit. For instance, instead of
 reading 16MB at once, download 16 or 32kB, write them to the
 outputstream, and keep looping until the end of the stream.

 On Mon, Jan 26, 2009 at 9:00 PM, Mahesh Vaghela mah...@indianic.com
 wrote:
  Hi Friends,
 
  I want to play an mp3 file as soon as my application starts. The mp3 file
 is
  really large in size(approx 14 mb).
 
  So I am trying to download it from a webserver and than I want to store
 it
  on sdcard.
 
  While doing so I am getting OutOfMemoryException. Can anybody please help
  me?
 
  My code is as follows:
 
 
 
  public MainClass() throws Exception
  {
 
  URL u = new URL(http://--;);
  URLConnection uc = u.openConnection();
  String contentType = uc.getContentType();
  int contentLength = uc.getContentLength();
 
  if(contentLength  Integer.MAX_VALUE)
  {
 
  }
 
  if (contentType.startsWith(text/) || contentLength == -1)
  {
   throw new IOException(This is not a binary file.);
  }
 
  InputStream raw = uc.getInputStream();
 
  InputStream in = new BufferedInputStream(raw);
 
 
  // Getting OutOfMemoryException here
 
  byte [] data=new byte[(int)contentLength];
 
 
  int bytesRead = 0;
 
  int offset = 0;
 
  while (offset  contentLength)
  {
 
  bytesRead = in.read(data, offset, data.length - offset);
  if (bytesRead == -1)
  break;
  offset += bytesRead;
  }
 
  in.close();
 
  /*
 
  if (offset != contentLength)
  {
throw new IOException(Only read  + offset +  bytes; Expected  +
  contentLength +bytes);
  }
 
  */
 
 
  // String filename = u.getFile().substring(filename.lastIndexOf('/') +
 1);
 
  FileOutputStream out = new FileOutputStream(/sdcard/music.mp3);
 
  out.write(data);
 
  out.flush();
 
  out.close();
 
  }
 
 
  Mahesh
 
 
 
 
 
  
 



 --
 Romain Guy
 Android framework engineer
 romain...@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

 



Mahesh Vaghela

--~--~-~--~~~---~--~~
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] i18n - Extracting String-Resources to a Jar - Referencing problem

2009-01-26 Thread plusminus

Hi all,

I'm just about to start externalizing all my String-resources to a new
project and then bring them back by including the exported jar-file of
this 'i18n'-project.
Doing so i18n for different languages becomes easier (I could simply
export just a handful of languages to the jar).


I can successfully change the java-references to the outsourced
foo.bar.i18n.R.java

BUT, all references of the xml-layouts fail :(

Sample:

... android:label=@string/app_name

where: @string/app_name is now unknown =/

I'm asking myself whether this is possible and how to resolve my
issue / properly reference the externalized string-resources.

Any help appreciated. =)

Best Regards,
Nicolas
--~--~-~--~~~---~--~~
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: When does my thread die?

2009-01-26 Thread mnj

Hi,

I did a simple test where I start a service from an activity after
acquiring PARTIAL_WAKE_LOCK. Then a 100% charged phone will drain
completely in 10 hours when CPU is always on.

Regards,
Manoj

On Jan 24, 3:13 am, Dianne Hackborn hack...@android.com wrote:
 The alarm manager would probably be overkill for that.  It might make more
 sense to do this in a Service, which holds a partial wake lock to keep
 itself running.  Note that this will have a noticeably impact on battery
 life because you are preventing the CPU from going to sleep, though I can't
 tell you exactly how much.





 On Fri, Jan 23, 2009 at 2:01 PM, John Bohumil jbohu...@gmail.com wrote:
   Finally, for something like a countdown timer, you really might want to
  consider using the alarm manager so you don't need to keep your app running
  at all while it is in the background.  That is the kind of thing a well
  behaving Android app will do.  To be able to show the remaining time if the
  user returns to your activity, you can store on SharedPreferences the time
  the countdown was started.

  Using the alarm manager is also the only way you can make sure you execute
  when the time expires, even if the user has turned off the phone.

  As it happens I am writting a countdown timer that implements a repeating
  notification at quite short interface.  For example the application might
  chirp every 10 seconds.  This is used for certain breathing excercises where
  you hold the breath for 10 seconds, breathe out for 10 seconds, in for 10
  seconds etc.

  For such short intervals would I still be better off using the alarm
  manager?  The handler technique seems to work great for my purposes but I
  want to make sure I write a well behaved app.

  John

 --
 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.- Hide quoted text -

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



[android-developers] Just one line program that will make you crazy.

2009-01-26 Thread ipeg . student

Hi,

  I am stuck with a small problem for several days, I am unable to
delete any SMS.
 The error is in just 1 line.

 Look at the code below and the associated XML .

 If I run the code, it shows the list of all SMS in my inbox.
There is an SMS whose _ID is equal to 7 .

 If I enable the line
getContentResolver().delete(..

which I have commented, my program crashes in the emulator.

What is going wrong? Please help me out.

#
#
#
package org.anddev.android.hello;

import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class HelloAndroid extends ListActivity {

 private ListAdapter mAdapter;

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

  Uri uri = Uri.parse(content://sms/inbox/);
  String[] columns = new String[]{_ID};
  int[] names = new int[]{R.id.row_entry};
  Cursor c1= getContentResolver().query(uri, null,
null,null,null);

 // getContentResolver().delete( uri  ,  _ID = 7 , null);

  mAdapter = new SimpleCursorAdapter(this, R.layout.main, c1,
columns, names);
  this.setListAdapter(mAdapter);
}

}
#
#
#

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=org.anddev.android.hello
uses-permission android:name=android.permission.READ_SMS /
uses-permission android:name=android.permission.WRITE_SMS /
uses-permission android:name=android.permission.RECEIVE_SMS /

application android:icon=@drawable/icon
activity android:name=.HelloAndroid android:label=@string/
app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity android:name=.Hello android:label=@string/
app_name

/activity
   activity android:name=.Hello1 android:label=@string/
app_name

/activity
/application
/manifest


#
#
#


--~--~-~--~~~---~--~~
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] 1 line to correct! Only for the best Programmers

2009-01-26 Thread ipeg . student

Hi Developers,

  I am stuck with a small problem for several days, I am unable to
delete any SMS.


 Look at the code below and the associated XML .

 If I run the code, it shows the list of all SMS in my inbox.
There is an SMS whose _ID is equal to 7 .

 If I enable the line
getContentResolver().delete(..

which I have commented, my program crashes in the emulator.

What is going wrong? Please help me out.

#
#
#
package org.anddev.android.hello;

import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class HelloAndroid extends ListActivity {

 private ListAdapter mAdapter;

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

  Uri uri = Uri.parse(content://sms/inbox/);
  String[] columns = new String[]{_ID};
  int[] names = new int[]{R.id.row_entry};
  Cursor c1= getContentResolver().query(uri, null,
null,null,null);

 // getContentResolver().delete( uri  ,  _ID = 7 , null);

  mAdapter = new SimpleCursorAdapter(this, R.layout.main, c1,
columns, names);
  this.setListAdapter(mAdapter);
}

}
#
#
#

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=org.anddev.android.hello
uses-permission android:name=android.permission.READ_SMS /
uses-permission android:name=android.permission.WRITE_SMS /
uses-permission android:name=android.permission.RECEIVE_SMS /

application android:icon=@drawable/icon
activity android:name=.HelloAndroid android:label=@string/
app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity android:name=.Hello android:label=@string/
app_name

/activity
   activity android:name=.Hello1 android:label=@string/
app_name

/activity
/application
/manifest


#
#
#


--~--~-~--~~~---~--~~
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 Challenge!! Can you correct this 1 line ?????

2009-01-26 Thread ipeg . student

Please help Me!!!

  I am stuck with a small problem for several days, I am unable to
delete any SMS.
 The error is in just 1 line.

 Look at the code below and the associated XML .

 If I run the code, it shows the list of all SMS in my inbox.
There is an SMS whose _ID is equal to 7 .

 If I enable the line
getContentResolver().delete(..

which I have commented, my program crashes in the emulator.

What is going wrong? Please help me out.

#
#
#
package org.anddev.android.hello;

import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class HelloAndroid extends ListActivity {

 private ListAdapter mAdapter;

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

  Uri uri = Uri.parse(content://sms/inbox/);
  String[] columns = new String[]{_ID};
  int[] names = new int[]{R.id.row_entry};
  Cursor c1= getContentResolver().query(uri, null,
null,null,null);

 // getContentResolver().delete( uri  ,  _ID = 7 , null);

  mAdapter = new SimpleCursorAdapter(this, R.layout.main, c1,
columns, names);
  this.setListAdapter(mAdapter);
}

}
#
#
#

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=org.anddev.android.hello
uses-permission android:name=android.permission.READ_SMS /
uses-permission android:name=android.permission.WRITE_SMS /
uses-permission android:name=android.permission.RECEIVE_SMS /

application android:icon=@drawable/icon
activity android:name=.HelloAndroid android:label=@string/
app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity android:name=.Hello android:label=@string/
app_name

/activity
   activity android:name=.Hello1 android:label=@string/
app_name

/activity
/application
/manifest


#
#
#


--~--~-~--~~~---~--~~
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 Challenge!! Can you correct this 1 line ?????

2009-01-26 Thread hmmm

And what does it print in the DDMS logcat after the crash? Usually this 
output is helpful.


- Original Message - 
From: ipeg.stud...@gmail.com
To: Android Developers android-developers@googlegroups.com
Sent: Tuesday, January 27, 2009 9:30 AM
Subject: [android-developers] Android Challenge!! Can you correct this 1 
line ?



 Please help Me!!!

  I am stuck with a small problem for several days, I am unable to
 delete any SMS.
 The error is in just 1 line.

 Look at the code below and the associated XML .

 If I run the code, it shows the list of all SMS in my inbox.
 There is an SMS whose _ID is equal to 7 .

 If I enable the line
 getContentResolver().delete(..

 which I have commented, my program crashes in the emulator.

 What is going wrong? Please help me out.

 #
 #
 #
 package org.anddev.android.hello;

 import android.app.ListActivity;
 import android.content.Intent;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.ListAdapter;
 import android.widget.ListView;
 import android.widget.SimpleCursorAdapter;

 public class HelloAndroid extends ListActivity {

 private ListAdapter mAdapter;

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

  Uri uri = Uri.parse(content://sms/inbox/);
  String[] columns = new String[]{_ID};
  int[] names = new int[]{R.id.row_entry};
  Cursor c1= getContentResolver().query(uri, null,
 null,null,null);

 // getContentResolver().delete( uri  ,  _ID = 7 , null);

  mAdapter = new SimpleCursorAdapter(this, R.layout.main, c1,
 columns, names);
  this.setListAdapter(mAdapter);
}

 }
 #
 #
 #

 ?xml version=1.0 encoding=utf-8?
 manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=org.anddev.android.hello
uses-permission android:name=android.permission.READ_SMS /
uses-permission android:name=android.permission.WRITE_SMS /
uses-permission android:name=android.permission.RECEIVE_SMS /

application android:icon=@drawable/icon
activity android:name=.HelloAndroid android:label=@string/
 app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
 android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity android:name=.Hello android:label=@string/
 app_name

/activity
   activity android:name=.Hello1 android:label=@string/
 app_name

/activity
/application
 /manifest


 #
 #
 #


  


--~--~-~--~~~---~--~~
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 FPS using Opengl es on G1

2009-01-26 Thread suhas

Hi Guys,
I am working on developing a 3d game.
I have loaded ms3d model in my project and all texture and everything
is working fine.
I m not loading any joints.
But I am facing two major problems which indeed are related to one
thing.
1: I have got FPS problem in my game Its too low even on G1.
2: When I have touch event to control the game it affects the FPSmore.

So plz let me know how to optimize it more because the same game with
same code of opengl es is wokring at 45 FPS on Iphone
So why its running slow on G1.

What is opengl es benchmark for G1 ?
Wat can be comparison btwn Iphone and G1 related to hardware
acceleration ?

Regards,
Suhas Gavas





--~--~-~--~~~---~--~~
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] using google maps api for renderings maps on ui

2009-01-26 Thread sankalp

hi group
 i am looking for a location based service application.
just for example sake can anyone provide me with a startup sample so
that i can look up into rendering maps on UI .a navigation sort of
sample or anything close to rendering maps 
kindly provide me ASAP
thnx

--~--~-~--~~~---~--~~
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 create Page turn effect

2009-01-26 Thread tahera rabadi
How can we give a Page turn animation?

--~--~-~--~~~---~--~~
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 FPS using Opengl es on G1

2009-01-26 Thread suhas

Hi Guys,
I am working on developing a 3d game.
I have loaded ms3d model in my project and all texture and everything
is working fine.
I m not loading any joints.
But I am facing two major problems which indeed are related to one
thing.
1: I have got FPS problem in my game Its too low even on G1.
2: When I have touch event to control the game it affects the FPSmore.

So plz let me know how to optimize it more because the same game with
same code of opengl es is wokring at 45 FPS on Iphone
So why its running slow on G1.

What is opengl es benchmark for G1 ?
Wat can be comparison btwn Iphone and G1 related to hardware
acceleration ?

Regards,
Suhas Gavas





--~--~-~--~~~---~--~~
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] Unable to install Google Notepad application

2009-01-26 Thread Ish

I got the code of Google Notepad Application from google example code,
Everything is working fine to me on emulator.

But I can't able to install it on my real android device

I am following these steps
* compile the code (with eclipse)
* export unsigned apk (manifesto.xml)
* create a key
* sign the application

# SDK: android-sdk-windows-1.0_r2
# Commands: I used to sign this demo application

keytool -genkey -v -keystore notepad.keystore -alias Notepadv3 -keyalg
RSA -validity 2
jarsigner -verbose -keystore notepad.keystore Notepadv3.apk Notepadv3
jarsigner -verify Notepadv3.apk

After above steps i simply put the apk (signed) file on my android
device but installation ends up with installation unsuccessful

do anyone has a clue, what am i doing wrong? 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] Messaging back button bug

2009-01-26 Thread Chris King

It seems hitting the back button while in the Messaging app walks
through the history of every app I've ever used...?  At least, right
now it opens up the Browser... running on 1.0 TC4-RC30

--~--~-~--~~~---~--~~
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] regarding OutOfMemoryException

2009-01-26 Thread sagar.indianic

Hello everyone,

I am trying to downlaod a file from the  net. It is an mp3 file and
big in size. I  m able to get connection but when trying to create a
bufffer for file, I get out of memory exception
please help
its urgent...
Code is:
URL u = new URL(http://--;);
URLConnection uc = u.openConnection();
 int contentLength = uc.getContentLength();
InputStream raw = uc.getInputStream();
InputStream in = new BufferedInputStream(raw);
byte [] data=new byte[contentLength];//getting outofmemory
exception here..

--~--~-~--~~~---~--~~
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] Start an activity and return back to original activity

2009-01-26 Thread james

I have an application with contains multiple activities. The main
activity will start the others ( use startActivity() ) depends on user
event, when an activity close, it calls finish() and return back to
main activity. It appears to behavior like that.

However, the problem I see is main activity's onCreate function is
called every time. I think the the main activity should be placed in
the activity stack and simply push to front when others exit,
therefore only onResume,  onStart are called. Is there some flag I
need to set or I misunderstand the activity behaviro?

In child activity, besides calling finish() or startActivity for main
activity, what is other way to move main activity to front?

Thanks,
James,

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



  1   2   >