[android-developers] Re: J2ME to Android

2010-09-11 Thread kypriakos

I did contact the J2ME Polish forum but no response. The J2ME list did
have
older archives on why the Connection class would be throwing a
ConnectionNotFound
exception and primarily was because of a non-supported protocol. So
that's why
I was wondering if there is anything else that I needed to configure
with the emulator
here or if the only option would be to rewrite all those parts of this
code.

In any case - thanks very much Miguel. If I do find a soln I would be
happy to
share it just in case anyone needs it - even though I have a feeling
few ppl
would be willing to follow this rough path ;)

Cheers

On Sep 10, 10:38 pm, Miguel Morales therevolti...@gmail.com wrote:
 Ah.  Perhaps you might have better luck contacting the J2ME polish or
 J2ME mailing lists?



 On Fri, Sep 10, 2010 at 7:04 PM, kypriakos demet...@ece.neu.edu wrote:

  Thanks for the good information Miguel, I appreciate it even though
  I am aware of most of the code you are displaying below.

  My original question was a more general one, regarding the porting of
  J2ME code into Android, something that has been an issue for many
  developers who have large chunks of code in J2ME that are not easy
  to rewrite. I didn't give much information about the overall goal so
  you
  are right, the small code segment I showed looked like a very small
  update that would have taken seconds actually to port and in fact
  modified to be done correctly (to avoid casting etc.). That
  particular
  piece of code is trying to open tcp sockets and use low lever streams
  to communicate.

  I have been porting a large peer-to-peer software baseline that has
  been
  running successfully under J2ME. In fact most of the code I imported
  in Android so far from J2ME has been working correctly and with very
  good performance results. The J2ME Polish project actually has ported
  the libs that I need in this case (including the javax.microedition)
  for the
  Android platform and that's what I have been using.
  So no, I am not lazily importing old code, I am importing current
  code
  that we need to run on Android. Logically if the places where this
  Connection
  class is used is in the hundreds, it made sense to be more efficient
  and try
  to use libs of J2ME ported in Android rather than changing all those
  places.
  Yes - not optimal but it is what it is.

  In summary, yes you and others have answered my original question,
  unless
  the trafeoffs are against it, it makes sense to always try to
  'translate' everything
  that you run on Android using Android's API.

  Again thanks for the good pointers below

  On Sep 10, 7:26 pm, Miguel Morales therevolti...@gmail.com wrote:
  Sounds like you're doing it wrong.  One, try not to include any
  foreign APIs/Jars unless you need it.  Two, instead of trying to
  lazily port old code, redo the functionality using the classes android
  provides.
  Casting is prone to bugs, if don't incorrectly, it can hide warnings
  and errors.  I don't know what it is you're trying to do there.

  You haven't explained what it is you're trying to do.  Are you trying
  to open a socket and communicate via low level streams or just http?

  I suspect what you're trying to do is really easy, and shouldn't have
  taken more than a few minutes to update.

  You'll want to create an http url using the Url class:

  String mUrl = http://whatever.com;;
  URL url = new URL(mUrl);

  Then open a connection using URLConnection:

  URLConnection connection = url.openConnection();

  You can then work with the stream directly using
  connection.getInputStream(), or work with BufferedReader like:
  BufferedReader in = new BufferedReader(new
  InputStreamReader(connection.getInputStream()), 8);

  Grab the response to a string, not recommended, but if it's not a lot of 
  data:
  String line;
  while ((line = in.readLine()) != null)
  {
      response = response + line;}

  in.close();

  On Fri, Sep 10, 2010 at 2:56 PM, kypriakos demet...@ece.neu.edu wrote:

   Will do - thanks

   On Aug 27, 7:05 am, michal.g...@gmail.com michal.g...@gmail.com
   wrote:
   How about using a semi-automated service to convert J2ME to Android ?
   Give it a try - free for eval purposes. Take a look atwww.upontek.com,
   or send me your jar to michal.g...@upontek.com

   Thanks 

   On 27 אוגוסט, 11:28, Indicator Veritatis mej1...@yahoo.com wrote:

Since Android does not include the javax.microedition package, one
should not expect an exact equivalent. But we do have the
org.apache.conn and org.apache.http.* packages; some of us think these
are much better than anything in javax.microedition!

One should still expect to use a very little bit from java.net, e.g.
the Url and Uri classes.

On Aug 26, 1:40 pm, kypriakos demet...@ece.neu.edu wrote:

 Does anyone know the equivalent of these imports from J2ME to
 Android?

 import javax.microedition.io.Connector;
 import javax.microedition.io.HttpConnection;

Re: [android-developers] Layout being displayed too late

2010-09-11 Thread TreKing
On Thu, Sep 9, 2010 at 3:36 PM, lloyd lloydmcfarl...@comcast.net wrote:

 The compiler keeps complaining that my  *onProgressUpdate* method must
 “Override or implement a supertype method”.


Weird - I just added the @Override notation to one of my tasks and it
compiled fine. I usually don't have it though.


 However when I run the app, I do not get the progress updates.


Is the function itself not being called (break point doesn't get hit) or is
it just your view not updating?
What is mProgressText? A TextView? Is it visible at the start of the task?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

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

Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread TreKing
On Fri, Sep 10, 2010 at 12:41 AM, DG gujar.dwark...@gmail.com wrote:

 I have searched the documentation and did not got any way to get the screen
 shot and add it as the attachment.


Try searching this group - this question is asked all the time.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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: Monkey problems -- **URGENT HELP** --

2010-09-11 Thread Tez
and okay...I will not use URGENT in my posts (This is actually the
first time i've ever used it, and i've been on the android forums for
a looong time). Everyone makes mistakes and I have no problem in
learning to change.

-E

On Sep 10, 5:19 pm, Serzhant serzh...@gmail.com wrote:
 Tez - Your steps are correct.

 Check whether coordinates of your button is correct.
 You can do by touching your button in your application and checking
 logcat output. There should be message like:
 V/WindowManager( 2219): Dsptch 1 x150.0 y450.0  Window{48021278
 com.google.android.gm/com.google.an
 droid.gm.ConversationListActivity paused=false}

 where you can find touched coordinates and package name of your
 application.

 Additional information about monkey commands you can find 
 at:http://android.git.kernel.org/?p=platform/development.git;a=blob_plai...

 On 10 сен, 10:53, Tez earlencefe...@gmail.com wrote:

  FYI I am a scientific programmer for a european university. We are
  doing work on Android security.
  We have a research hypothesis that can be proved valid if we solve the
  above stated problem.
  This work is on a deadline. And one entire chain of work will be
  regarded as discarded/valid based on this.
  I hope this clears things.

  -E

  On Sep 10, 11:45 am, TreKing treking...@gmail.com wrote:

   On Thu, Sep 9, 2010 at 2:36 PM, DanH danhi...@ieee.org wrote:
In the case of something like Monkey, the need to meet an internal demo
date would be valid cause for urgent, in my opinion.

   Yes - to person with the deadline, sure this would seem urgent. To the 
   rest
   of us on this volunteer list? Not so much. I think it makes the poster 
   seem
   impatient, especially when the OP does not explain what makes it so
   important. He could be trying to cram in some last minute homework
   assignment that he slacked off on, for all we know.

   On Thu, Sep 9, 2010 at 11:37 PM, Tez earlencefe...@gmail.com wrote:
@TrekIng - thanks for your professional opinion.

   This is most definitely NOT professional opinion. I'm just telling you 
   how
   posts with urgent in the title are usually perceived on forums like this
   where people ask for technical help. Most of the people on this group are
   working individually on projects as a hobby - the level of urgency of
   solving any given problem presented here, in the grand scheme of things, 
   is
   incredibly low.

   However important this problem is for you to solve, it frankly means 
   nothing
   to the rest of us and adding urgent is not going to make us drop
   everything to try to help. At best it adds nothing to the discussion about
   the problem you're having and at worst it makes you seem impatient and
   actually discourages people from helping you.

   Believe it or not, I'm actually trying to help you. I really think you 
   would
   be best served, now and in the future, with not adding urgent to your
   post. It usually hurts more than it helps - that's what I'm trying to get
   at.

You have admitted that you have not used monkey yet you make the claim 
that
having trouble with it is not urgent.

   Correct. I don't need to use the tool to determine this. Even if you never
   solve your problem, the world will keep spinning and life will go on. You
   claim this is urgent but you've still not explained what the severe
   consequences of this not being solved will be, besides there being
   important work depending on it - which is completely subjective to you.

Did you base this on your previous monkey experience?

   Where did I claim to have monkey experience? I'm pretty sure I clearly
   stated I had not used Monkey. Or was that sarcasm?

   ---
--
   TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
   transit tracking app for Android-powered devices

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


Re: [android-developers] Google Maps API and Android app.

2010-09-11 Thread TreKing
On Thu, Sep 9, 2010 at 3:32 PM, jonny27 me.jonn...@gmail.com wrote:

 09-09 21:23:51.247: ERROR/AndroidRuntime(722): *Caused by:
 java.lang.NullPointerException*
 09-09 21:23:51.247: ERROR/AndroidRuntime(722): *at com.hello.map.view.**
 HelloMapView.onCreate(**HelloMapView.java:20)*


-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

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

RE: [android-developers] Google Maps API and Android app.

2010-09-11 Thread Tommy
un comment
//setContentView(R.layout.main); 

in your on create and see what happens


-Original Message-
From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of jonny27
Sent: Thursday, September 09, 2010 4:33 PM
To: Android Developers
Subject: [android-developers] Google Maps API and Android app.

Hi everyone,

I am following a tutorial on adding google maps into and android app
and it keeps quitting unexpectantly. I have added the correct
permissions and uses and created a new AVD using the google api build
target but i guess i am missing something else, hope someone can help
and thanks in advance

Main.xml

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

TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=@string/hello
/
com.google.android.maps.MapView
android:id=@+id/mapview
android:layout_width=fill_parent
android:layout_height=fill_parent
android:apiKey=***
/
/LinearLayout

AndroidManifest.xml

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=com.hello.map.view
  android:versionCode=1
  android:versionName=1.0
application android:icon=@drawable/icon android:label=@string/
app_name

activity android:name=.HelloMapView android:label=@string/
app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
uses-library android:name=com.google.android.maps /
/application
uses-permission android:name=android.permission.INTERNET/uses-
permission
uses-permission
android:name=android.permission.ACCESS_COARSE_LOCATION/uses-
permission
uses-permission
android:name=android.permission.ACCESS_FINE_LOCATION/uses-
permission
/manifest

HelloMapView.java

ackage com.hello.map.view;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.os.Bundle;
import android.widget.LinearLayout;

public class HelloMapView extends MapActivity {
/** Called when the activity is first created. */
LinearLayout linearLayout;
MapView mapView;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);

mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
}

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}

Error Log

09-09 21:23:11.817: INFO/Process(695): Sending signal. PID: 695 SIG: 9
09-09 21:23:13.318: INFO/Process(672): Sending signal. PID: 672 SIG: 9
09-09 21:23:13.417: WARN/InputManagerService(67): Window already
focused, ignoring focus gain of:
com.android.internal.view.iinputmethodclient$stub$pr...@440d6168
09-09 21:23:14.016: INFO/ActivityManager(67): Process
com.zermatt.travel.guide (pid 672) has died.
09-09 21:23:14.067: INFO/ActivityManager(67): Process
com.hello.map.view (pid 695) has died.
09-09 21:23:16.990: WARN/ActivityManager(67): Activity destroy timeout
for HistoryRecord{440c13a0 com.hello.map.view/.HelloMapView}
09-09 21:23:44.257: INFO/AndroidRuntime(706): NOTE: attach of thread
'Binder Thread #4' failed
09-09 21:23:47.887: INFO/ActivityManager(67): Starting activity:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x1000
cmp=com.hello.map.view/.HelloMapView }
09-09 21:23:48.097: INFO/AndroidRuntime(715): NOTE: attach of thread
'Binder Thread #3' failed
09-09 21:23:48.528: INFO/ActivityManager(67): Start proc
com.hello.map.view for activity com.hello.map.view/.HelloMapView:
pid=722 uid=10037 gids={3003, 1015}
09-09 21:23:51.217: WARN/dalvikvm(722): threadid=1: thread exiting
with uncaught exception (group=0x4001d800)
09-09 21:23:51.247: ERROR/AndroidRuntime(722): FATAL EXCEPTION: main
09-09 21:23:51.247: ERROR/AndroidRuntime(722):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.hello.map.view/com.hello.map.view.HelloMapView}:
java.lang.NullPointerException
09-09 21:23:51.247: ERROR/AndroidRuntime(722): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2663)
09-09 21:23:51.247: ERROR/AndroidRuntime(722): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
09-09 21:23:51.247: ERROR/AndroidRuntime(722): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-09 21:23:51.247: ERROR/AndroidRuntime(722): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

[android-developers] Re: need help with softkeyboard development

2010-09-11 Thread Tez
Hi,

You don't really need to hire someone.
The SoftKeyboard example available in the SDK is self explanatory.
Lots of comments.
Experiment a little, you will  automatically understand how things
work.

Cheers,
Earlence

On Sep 11, 10:55 am, Saied saie...@gmail.com wrote:
 Hello,

 I have two android related needs:

 1. I am trying to create a soft keyboard for android. I need someone
 to help me create the template for it: the service, the touch event
 capturing and sending of characters and sensing of the text buffer.
 Based on google's published document this seems to be standard stuff,
 for someone familiar with the platform. I will fill in the logic for
 the keyboard myself. So this is not a huge job, but a few hours of
 consulting dollars.

 2. We are two programmers, trying to learn android. We are looking for
 a tutor of sort, whom we can pay hourly and talk to or skype with 2-3
 hours a week. again, not a huge job, but a little money on the side.

 If you feel up to it, please contact me.
 sa...@exideas.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: Behaviour of launchMode=“ singleTask” not as described?

2010-09-11 Thread Olly
singleTop behaves as documented for m (i.e. creating a new Activity at
the top of the stack, or reusing one if there is already an Activity
of that type at the top of the stack). I'm pretty sure singleTask is
documented incorrectly though. I'm just wondering whether I've got it
wrong, since this is completely fundamental (its in the Android
fundamentals document, so how has no-one else picked up on it?


On 11 Sep, 04:30, joebowbeer joe.bowb...@gmail.com wrote:
 I agree that the documentation is confusing and possibly wrong.

 For the second behavior, that of discarding the intent and bringing
 the task with the specified activity to the foreground, you should use
 singleTop instead (despite what the documentation says).

 On Sep 10, 4:00 pm, Olly ollywood...@gmail.com wrote:



  I've been learning Android and have come across an issue with
  launchMode=singleTask. The documentation states that when this
  attribute is used, the Activity is always launched into a new task as
  the root Activity. Secondly, the documentation states that if an
  Intent is targeted at such an Activity when there are Activities
  sitting above it in its task stack, such Intents are discarded
  (although the task is still brought to the foreground).

  I've been playing around with this, and the behaviour I observe is
  completely different. In particular: - Activities with
  launchMode=singleTask are not always the root Activity in a task
  stack. They are just plonked ontop of the existing stack with the same
  affinity. - When an Intent is targeted at such an Activity and there
  are other Activities above it in the stack, the Intent is not
  discarded. Instead the Activities above it in the stack are discarded.
  The Intent is then delivered via onNewIntent to the Activity as
  normal.

  Can someone confirm that this is the actual behaviour? If so, why are
  the documents incorrect? If not what have I done wrong. . . Here is a
  simple way to observe the behaviour:

  1. Create a simple main.xml containing two buttons b1 and b2.
  2. Create the following Activity:

  public class ActivityA extends Activity {

      @Override
      public void onCreate(final Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);

          Button lButton = (Button) findViewById(R.id.b1);
          lButton.setOnClickListener(new OnClickListener() {
                          @Override
                          public void onClick(View arg0) {
                                  Intent lNextIntent = new 
  Intent(ActivityA.this,ActivityA.class);
                                  startActivity(lNextIntent);
                          }
          });

          Button lButton2 = (Button) findViewById(R.id.b2);
          lButton2.setOnClickListener(new OnClickListener() {
                          @Override
                          public void onClick(View arg0) {
                                  Intent lNextIntent = new 
  Intent(ActivityA.this,ActivityB.class);
                                  startActivity(lNextIntent);
                          }
          });
      }

  }

  3. Create the second Activity:

  public class ActivityB extends ActivityA {

  }

  4. The manifest:

  ?xml version=1.0 encoding=utf-8?
  manifest xmlns:android=http://schemas.android.com/apk/res/android;
        package=ojw28.activitytest
        android:versionCode=1
        android:versionName=1.0
      application android:icon=@drawable/icon android:label=@string/
  app_name
          activity android:name=ActivityA
                    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=.ActivityB
  android:launchMode=singleTask
          /activity
      /application
  /manifest

  5. Launch the application. Press button b1 a couple of times, see what
  happens to the task stack using adb shell dumpsys activity. Multiple
  instances of ActivityA are now in the task stack as expected.

  Now press button b2. According to the documentation this should launch
  an ActivityB instance is a NEW task, as the root Activity of that
  task. Use adb to look at the stack. What actually happens is ActivityB
  gets put ontop of the current stack, which isn't the documented
  behaviour.

  Now press button b1 a couple more times. Then press b2 again. Since
  the single instance of ActivityB isn't at the top of the stack, the
  documentation states that this intent should be ignored. The observed
  behaviour is that all ActivityA instances above the ActivityB instance
  are discarded from the stack, after which the intent is delivered to
  the instance of ActivityB as normal (via onNewIntent - you can
  override this method and add a break point to observe this).

-- 
You received this 

[android-developers] Re: AsyncTask doesn't run sometimes despite state returning RUNNING?

2010-09-11 Thread Federico Paolinelli
You need to use aidl if you want to call another process. But if you
want to interact with the service from activities of the same
application,
you can call the methods directly from the activity.

Check for example this sample code from Mark's tutorial:
http://github.com/commonsguy/cw-andtutorials/tree/master/18-LocalService/



On 10 Set, 19:32, Donal Rafferty draf...@gmail.com wrote:
 As in the following piece of code...? :

 bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE);

 I do that but I think I do require the aidl to be able to call methods from
 the service?

 On Fri, Sep 10, 2010 at 6:17 PM, Federico Paolinelli 
 fedep...@gmail.comwrote:

  In any case, I meant binding the activity to the service using
  bindService method without passing from the aidl.
  In this way you will get direct access to the methods of the service
  directly from the activity. In this way, I suppose you can pass the
  service an interface to get called when your asynctask finished its
  job.

  Try to google for service binding examples.

  Hope this helps (and I hope I am not saying bullshit as well :-) )

     Federico

  On Fri, Sep 10, 2010 at 7:03 PM, Donal Rafferty draf...@gmail.com wrote:
   No luck :(

   ---

   package com.xxx.phone.ui;

   import android.media.Ringtone;

   interface ICallDialogActivity{
       void sendRingTone(in RingTone aRingTone);
   }

   ---

   I get the red x beside the import and coundn't find import for class
   android.media.Ringtone;

   On Fri, Sep 10, 2010 at 5:45 PM, Mark Murphy mmur...@commonsware.com
   wrote:

   On Fri, Sep 10, 2010 at 12:28 PM, Donal Rafferty draf...@gmail.com
   wrote:
Is that possible?

I have a bind between my Service and the Activity at the minute but
  when
I
try to change to aidl file to allow me pass the RingTone object it
  wont
compile for me, saying RingTone and com.android.RingTone cannot be
resolved/found

   Try android.media.Ringtone.

   --
   Mark Murphy (a Commons Guy)
  http://commonsware.com|http://github.com/commonsguy
  http://commonsware.com/blog|http://twitter.com/commonsguy

   Android Training in London:http://skillsmatter.com/go/os-mobile-server

   --
   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.comandroid-developers%2bunsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

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

  --
  
  Federico

  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Behaviour of launchMode=“ singleTask” not as described?

2010-09-11 Thread Olly
I have submitted a bug report with more information here:

http://code.google.com/p/android/issues/detail?id=11160sort=-idcolspec=ID%20Type%20Status%20Owner%20Summary%20Stars

I think this is a fairly important issue. There needs to be
clarification as to whether the observed behaviour is correct and it
is a documentation error (that would be my guess), or the other way
around.


On 11 Sep, 07:56, Olly ollywood...@gmail.com wrote:
 singleTop behaves as documented for m (i.e. creating a new Activity at
 the top of the stack, or reusing one if there is already an Activity
 of that type at the top of the stack). I'm pretty sure singleTask is
 documented incorrectly though. I'm just wondering whether I've got it
 wrong, since this is completely fundamental (its in the Android
 fundamentals document, so how has no-one else picked up on it?

 On 11 Sep, 04:30, joebowbeer joe.bowb...@gmail.com wrote:



  I agree that the documentation is confusing and possibly wrong.

  For the second behavior, that of discarding the intent and bringing
  the task with the specified activity to the foreground, you should use
  singleTop instead (despite what the documentation says).

  On Sep 10, 4:00 pm, Olly ollywood...@gmail.com wrote:

   I've been learning Android and have come across an issue with
   launchMode=singleTask. The documentation states that when this
   attribute is used, the Activity is always launched into a new task as
   the root Activity. Secondly, the documentation states that if an
   Intent is targeted at such an Activity when there are Activities
   sitting above it in its task stack, such Intents are discarded
   (although the task is still brought to the foreground).

   I've been playing around with this, and the behaviour I observe is
   completely different. In particular: - Activities with
   launchMode=singleTask are not always the root Activity in a task
   stack. They are just plonked ontop of the existing stack with the same
   affinity. - When an Intent is targeted at such an Activity and there
   are other Activities above it in the stack, the Intent is not
   discarded. Instead the Activities above it in the stack are discarded.
   The Intent is then delivered via onNewIntent to the Activity as
   normal.

   Can someone confirm that this is the actual behaviour? If so, why are
   the documents incorrect? If not what have I done wrong. . . Here is a
   simple way to observe the behaviour:

   1. Create a simple main.xml containing two buttons b1 and b2.
   2. Create the following Activity:

   public class ActivityA extends Activity {

       @Override
       public void onCreate(final Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);

           Button lButton = (Button) findViewById(R.id.b1);
           lButton.setOnClickListener(new OnClickListener() {
                           @Override
                           public void onClick(View arg0) {
                                   Intent lNextIntent = new 
   Intent(ActivityA.this,ActivityA.class);
                                   startActivity(lNextIntent);
                           }
           });

           Button lButton2 = (Button) findViewById(R.id.b2);
           lButton2.setOnClickListener(new OnClickListener() {
                           @Override
                           public void onClick(View arg0) {
                                   Intent lNextIntent = new 
   Intent(ActivityA.this,ActivityB.class);
                                   startActivity(lNextIntent);
                           }
           });
       }

   }

   3. Create the second Activity:

   public class ActivityB extends ActivityA {

   }

   4. The manifest:

   ?xml version=1.0 encoding=utf-8?
   manifest xmlns:android=http://schemas.android.com/apk/res/android;
         package=ojw28.activitytest
         android:versionCode=1
         android:versionName=1.0
       application android:icon=@drawable/icon android:label=@string/
   app_name
           activity android:name=ActivityA
                     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=.ActivityB
   android:launchMode=singleTask
           /activity
       /application
   /manifest

   5. Launch the application. Press button b1 a couple of times, see what
   happens to the task stack using adb shell dumpsys activity. Multiple
   instances of ActivityA are now in the task stack as expected.

   Now press button b2. According to the documentation this should launch
   an ActivityB instance is a NEW task, as the root Activity of that
   task. Use adb to look at the stack. What actually happens is ActivityB
   gets put ontop of the current stack, which isn't the documented
   

[android-developers] Re: Can android support more than one sdcard?

2010-09-11 Thread Ed
 U...  I'll only support one touch screen!  Okay.  I'll only support one
 DPAD!  Okay.  I'll only support one CPU!  Okay.  I'll only support one
 graphics accelerator!  Okay.  I'll only support one SIM!  Okay.  I'll only
 support one headphone output!  Okay.  I'll only support one camera!  Okay.

you forgot I'll only support one carrier in the US. oh no - that's
that other phone OS...

I think it would be wonderful to have an OS that supports multiple
everything but as Dianne said it would never get shipped. Worse than
that it would be slow and painful to develop for and use. Let's just
be thankful we have multitasking (not forgetting all the other
awesomeness that is Android).

One way around it would have classes of files e.g. Media, Cache,
Applications, Settings The user could setup a shared set of
settings to say Media goes on this SD card, Settings go on this SD
card Then apps could say this file is of class Media.

Even with this approach you'll always find things that don't fall
neatly into one category or things that don't fall into any.

It's a huge challenge to come up with a solution that is good for
users and developers alike. A challenge that is probably in capable
hands with Google.

Ed

On Sep 11, 11:04 am, Dianne Hackborn hack...@android.com wrote:
 On Fri, Sep 10, 2010 at 2:33 PM, Doug Gordon gordo...@gmail.com wrote:
  I am really surprised that the Android design would only account for
  one of anything. In my experience, any time you say we're only going
  to support one of feature X, the marketing or engineering departments
  decide to add another X. In any case, having support for more than
  one is the same as having support for any quantity.

 U...  I'll only support one touch screen!  Okay.  I'll only support one
 DPAD!  Okay.  I'll only support one CPU!  Okay.  I'll only support one
 graphics accelerator!  Okay.  I'll only support one SIM!  Okay.  I'll only
 support one headphone output!  Okay.  I'll only support one camera!  Okay.

 A marketing or engineering department that can't accept limitations is an
 organization that will never ship a product.

 (And you don't note all of the complexity that comes from going from 1 to 2
 -- how is this reflecting in the UI?  How does the user decide where they
 want their stuff to go?  How about telling them how much space is where?
  And now you've got to let them move stuff around.  I can make a good
 argument that multiple SD cards is just intrinsically a crummy user
 experience and should be avoided.  Heck even one SD card significantly
 complicates the UX.)

 --
 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, and so won't reply to such e-mails.  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


Re: [android-developers] Re: Can android support more than one sdcard?

2010-09-11 Thread Kostya Vasilyev

 11.09.2010 7:46, joebowbeer пишет:

On Sep 10, 2:01 pm, Kostya Vasilyevkmans...@gmail.com  wrote:

  That's the Samsung Galaxy S (GT-I9000) I mentioned earlier in this thread.
  There are also several carrier-branded versions.


Nice handset.  1 million were sold in the US in the first 45 days.
Probably 2 million by now.

If you avoid the explicit path and use the getExternalStorageDirectory
method, are there any problems on Galaxy S handsets?
Pretty much same scenario as with phones that only have one - external - 
memory card:


Someone buys a Samsung Galaxy S or one of its variations. Fills it up 
with files (although 16 GB of internal memory card is harder to fill up 
than regular phone memory, video and music files can make it easier). 
Goes and buys a memory card, installs it.


This person now expects that applications can take advantage of this new 
memory card, right?


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


Re: [android-developers] Re: open wifi connection

2010-09-11 Thread Kostya Vasilyev

 Wulfgang,

More specifically (if I may):

Android maintains an internal list of known networks - security 
information is kept there. Before connecting to a network, it has to be 
entered into this list (and correct security information provided and 
stored). Networks on this list are identified by integer ids.


- Get the current Wifi connection: WifiInfo wifiInfo = 
wifiManager.getConnectionInfo()


- Get the numeric id of the currently connected network: int networkId = 
wifiInfo.getNetworkId()


- Get the list of configured known networks: 
wifiManager.getConfiguredNetworks()


- Find the currently connected one in this list, matching by networkId.

- This gets you a WifiConfiguration object. Use its fields to determine 
its security mode:


http://kmansoft.wordpress.com/2010/04/08/how-to-determine-wifi-networks-security-mode/

Remember that this security setting is not the actual mode being used 
with this network at this time, but rather the security setting that 
Android expects when connecting to it.


It's probably a good idea to do some tests: e.g. set up a WEP or WPA 
protected network, configure it in Android, then switch the router to 
lower security mode and see if Android is still able to connect.


-- Kostya

10.09.2010 18:44, Timo пишет:

On Sep 6, 10:35 pm, wulfgangwulfgang@gmail.com  wrote:

   I am writing an application which checks the security protocol of
the phone's wifi connection.
   Between the phone and AP, they may use 'wpa', 'wpa2', 'wep' or
unprotected 'open' connections.
   Does anyone know how to get such information?

Check out the WifiManager service:

http://developer.android.com/reference/android/net/wifi/WifiManager.html


Cheers,

Timo




--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] Re: Can android support more than one sdcard?

2010-09-11 Thread Indicator Veritatis
Что Вы? Видно, это не то, что имела ввиду.

But the truth of the matter is as Dianne so laconically stated: since
there is no platform API for it, trying to support two SD cards is
going to be ugly. Or in the case of the Samsung phone, already is
ugly.

That said, I really wish Google had thought of this possibility ahead
of time. It really should not have been that difficult. Having 2 SD
cards is only a little odd, no more odd than having two SIMS, which is
also fairly common (at least for European phones).

Part of marketing's job IS to anticipate such future requirements,
communicate them to engineering so that engineering can design with an
eye for the future. In this case, that would have meant leaving 'room'
in the API for supporting multiple (especially two) SD cards.

Just think, for example, how much easier it is to backup your phone if
you have two SD cards in two separate slots: one for backup, the other
for data and programs.

Finally, it is unfair to compare this to having two of everything and
anything, since two SD cards is so much more handy and so much less
expensive than having two touch screens, two CPUs etc.

On Sep 10, 10:59 am, Kostya Vasilyev kmans...@gmail.com wrote:
   10.09.2010 21:51, Dianne Hackborn пишет: There is no platform API for 
 developers to find the second SD card, so
  I would strongly discourage having one since it will result in a
  poorer user experience with their apps.

 How do you discourage phone owners from buying and installing an sdcard?

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

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


[android-developers] Re: Can android support more than one sdcard?

2010-09-11 Thread Indicator Veritatis
The problem is that getExternalStorageDirectory cannot do what you
want: which card should it return? I believe the Samsung solution was
to have it return the parent directory for both cards -- which is just
plain wrong.

The getExternalStorageDirectory API is supposed to return ONE path to
ONE card. It was never designed for two.

On Sep 10, 8:46 pm, joebowbeer joe.bowb...@gmail.com wrote:
 On Sep 10, 2:01 pm, Kostya Vasilyev kmans...@gmail.com wrote:

  That's the Samsung Galaxy S (GT-I9000) I mentioned earlier in this thread.
  There are also several carrier-branded versions.

 Nice handset.  1 million were sold in the US in the first 45 days.
 Probably 2 million by now.

 If you avoid the explicit path and use the getExternalStorageDirectory
 method, are there any problems on Galaxy S handsets?

-- 
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: SQLite DB: insert VERY slow

2010-09-11 Thread Albert
SQLite DBs are very fast, it takes less than half a second to insert a
record/records. 1000 records is a lot! I haven't seen your code but
what you should do is:

openDatabase once
insert all records
close DB

Avoid open/close database 1000 times. Also the GC is probably very
busy during the operation so look for optimizations(avoid unnecessary
object creation, StringBuilder instead of String when appropiate,
etc...)

 Hope this helps!

Alberto



On Sep 11, 4:41 am, ls02 agal...@audible.com wrote:
 I need to insert 1000 rows into SQLite DB. Each row has 12 columns,
 text and numbers, none is big. It takes literraly minutes to insert
 all 1000 items. I use SQLiteDatabase.insert to insert each row.

 What can I do to improve this performance?

-- 
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: Can android support more than one sdcard?

2010-09-11 Thread blindfold
 A marketing or engineering department that can't accept limitations is an
 organization that will never ship a product.

When you are a research department you aim to develop new products
rather than shorten time to market. When even the basic building
blocks are already highly restrictive it becomes much harder to
innovate.

Although this thread is mostly about having a second SD card, your
comments seem to indicate a general attitude towards and lack of
interest in generalized API support for enumerating peripherals:

 I'll only support one camera!  Okay.

Not OK! If one wants to compete on the market one has to look at
competitors that already sport two cameras, such as a front-facing
camera. Think many Nokia phones, and Apple's iPhone 4G. (I added
second camera support to my own Nokia Java MIDlet app back in 2006.)
Do you want every Android phone manufacturer to invent and develop
their own proprietary Android API extensions even to just keep up with
existing functionality elsewhere? You encourage fragmentation!

Also, please look across platform boundaries as well as look at
broadening the scope towards gaming devices. What Microsoft is doing
with Kinect (formerly Natal) involves either a stereo camera or a time-
of-flight camera. Do you want individual Android device manufacturers
to create proprietary API extensions here too? Why make it impossible
to develop an Android counterpart of the Nintendo 3DS by sticking to a
conventional single camera API, forcing proprietary extensions?

Thanks!


The vOICe for Android
http://www.seeingwithsound.com/android.htm


On Sep 11, 3:04 am, Dianne Hackborn hack...@android.com wrote:
 On Fri, Sep 10, 2010 at 2:33 PM, Doug Gordon gordo...@gmail.com wrote:
  I am really surprised that the Android design would only account for
  one of anything. In my experience, any time you say we're only going
  to support one of feature X, the marketing or engineering departments
  decide to add another X. In any case, having support for more than
  one is the same as having support for any quantity.

 U...  I'll only support one touch screen!  Okay.  I'll only support one
 DPAD!  Okay.  I'll only support one CPU!  Okay.  I'll only support one
 graphics accelerator!  Okay.  I'll only support one SIM!  Okay.  I'll only
 support one headphone output!  Okay.  I'll only support one camera!  Okay.

 A marketing or engineering department that can't accept limitations is an
 organization that will never ship a product.

 (And you don't note all of the complexity that comes from going from 1 to 2
 -- how is this reflecting in the UI?  How does the user decide where they
 want their stuff to go?  How about telling them how much space is where?
  And now you've got to let them move stuff around.  I can make a good
 argument that multiple SD cards is just intrinsically a crummy user
 experience and should be avoided.  Heck even one SD card significantly
 complicates the UX.)

 --
 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, and so won't reply to such e-mails.  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: AsyncTask and screen rotation

2010-09-11 Thread Indicator Veritatis
Option 4 certainly sounds like it will work, but it suggests some
peculiar problems in the way the classes are designed. Service by
definition is already in the background, it HAS no UI thread, so why
do I need an AsyncTask there at all? The whole point of the latter is
to communicate between UI thread and worker thread.

As for documenting what works, I hope Google takes your hint and
documents what the right way to do this really is. After all, these
are the same people who keep warning us that if it's not documented,
then it is subject to change w/o notice.

On Sep 10, 10:04 am, Mark Murphy mmur...@commonsware.com wrote:
 On Fri, Sep 10, 2010 at 12:46 PM, Romain Guy romain...@android.com wrote:
  Option #1 is a lot more intrusive. You lose the ability to
  automatically switch layouts, drawables, etc.

 Worst-case scenario:

 Step #1: Take your UI setup that is in onCreate() and move it to a
 separate method (e.g., setupViews())

 Step #2: Call setupViews() from onCreate()

 Step #3: Call setupViews() from onConfigurationChanged()

 Done. ~4 lines of code. And it's the exact same code path that a
 destroy/recreate will go down, so it's not like this adds unusual
 performance overhead. There are certain circumstances where this may
 not work (e.g., GLSurfaceView and a game), but you needed to do extra
 work for those cases, anyway, to handle the destroy/recreate cycle.

  Saving and restoring an AsyncTask is not difficult.

 No, it's not. The question is: is it reliable?

 None of the AsyncTask documentation (class, article, etc.) covers this
 case. It *appears* that you can write an AsyncTask such that
 onPostExecute() or onProgressUpdate() will not be called in the middle
 of the activity transition. However, that's not documented and hence
 not guaranteed, and so while I'll describe a pattern that seems to
 work, I personally don't trust it any further than I can throw your
 large Froyo lawn ornament. If somebody could give us the recipe that
 is guaranteed to work (i.e., works today, and is going to work in
 Android 2.3/3.0/Turbo System 5000), that'd be *wonderful*.

 Actually, I lied earlier. I'd choose Option #4:

 Option #4: Don't do the AsyncTask in an activity. Use a Service and
 have it do the AsyncTask, or use an IntentService if the sole purpose
 of the service is to do stuff in a background thread. In particular,
 an IntentService would be good for a download that you want to happen
 regardless of what may go on with an activity (e.g., Android Market
 downloading an APK), and so you don't need to worry about canceling
 it.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training in London:http://skillsmatter.com/go/os-mobile-server

-- 
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 handle Home Key in our Activity

2010-09-11 Thread Indicator Veritatis
The FAQ itself is easy to find. But as you say, it is not
comprehensive. Like so many FAQs in so many other forums, it seems
nobody is keeping it up to date.

On Sep 10, 10:15 am, Pent tas...@dinglisch.net wrote:
  How many times will you be asking that question again and again?

 Speaking of which: there are about 30 questions that come up again and
 again*, a comprehensive FAQ would
 really unclutter this board. If there is one already it should be
 highlighted.

 Pent

 * possibly including 'where's the FAQ'

-- 
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: SQLite DB: insert VERY slow

2010-09-11 Thread Zsolt Vasvari
Make sure you use transactions.  In my situation, minutes became
seconds when I did that.

On Sep 11, 4:51 am, Albert albert8...@googlemail.com wrote:
 SQLite DBs are very fast, it takes less than half a second to insert a
 record/records. 1000 records is a lot! I haven't seen your code but
 what you should do is:

 openDatabase once
 insert all records
 close DB

 Avoid open/close database 1000 times. Also the GC is probably very
 busy during the operation so look for optimizations(avoid unnecessary
 object creation, StringBuilder instead of String when appropiate,
 etc...)

  Hope this helps!

 Alberto

 On Sep 11, 4:41 am, ls02 agal...@audible.com wrote:



  I need to insert 1000 rows into SQLite DB. Each row has 12 columns,
  text and numbers, none is big. It takes literraly minutes to insert
  all 1000 items. I use SQLiteDatabase.insert to insert each row.

  What can I do to improve this performance?- 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] Re: SQLiteDatabase.update() super slow

2010-09-11 Thread Zsolt Vasvari
Yes, use transaction bracketing for batch updating it makes a HUGE
difference.

Invididual updates are very slow, but that's what they, just
individual updates.  If you do more than 2 updates, using transaction
bracketing will help immensily.

On Sep 10, 10:11 pm, Sheado chad...@gmail.com wrote:
 Hi All,

 There are other posts on this subject, but no real answer anywhere.

 The issue:
 SQLiteDatabase.update(...) takes anywhere from 30ms to 700ms on a
 simple update (on a Motorola Droid). I'm not sure why there's such a
 huge range in the timing, but despite that it still means that in the
 best case updating one column in 30 rows will take at least one second
 - in the best case! On average updating 30-40 rows is taking me 3-4
 seconds - this is crazy slow - like 1985 computer slow!

 I've tried:
 * update(...) with ContentValues
 * update with execSql()
 * add/removing indices on the columns in question

 Is there anything else I can try to improve performance? For example,
 is there any way to update multiple rows with one statement?

 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: SQLiteDatabase.update() super slow

2010-09-11 Thread Alessandro Pellizzari
On Fri, 10 Sep 2010 19:11:06 -0700, Sheado wrote:

 SQLiteDatabase.update(...) takes anywhere from 30ms to 700ms on a simple
 update (on a Motorola Droid). I'm not sure why there's such a huge range
 in the timing, but despite that it still means that in the best case
 updating one column in 30 rows will take at least one second - in the
 best case! On average updating 30-40 rows is taking me 3-4 seconds -
 this is crazy slow - like 1985 computer slow!
 ...
 Any suggestions? Thanks!

Use transactions.

Bye.


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


Re: [android-developers] ant build file for android

2010-09-11 Thread nikhilesh singh tak
hey Leigh thanks for the help.

I found a very good reference document for the same at

http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html


On Fri, Sep 10, 2010 at 12:49 AM, Leigh McRae
leigh.mc...@lonedwarfgames.com wrote:
  Look under other IDEs in the tools docs.  You can have android generate a
 build.xml and then you can override whatever you need.


 On 9/8/2010 4:04 AM, nikki wrote:

 hi group

 I need to write ant build file for my project.

 Do anyone have an idea about how to write ant build file for android.


 regards


 --
 Leigh McRae
 www.lonedwarfgames.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



-- 
Nikhilesh

-- 
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: AsyncTask and screen rotation

2010-09-11 Thread Lance Nanek
 peculiar problems in the way the classes are designed. Service by
 definition is already in the background, it HAS no UI thread, so why

Services, by default, run in the same on process and on the main/UI
thread.

 http://developer.android.com/reference/android/app/Service.html
 Note that services, like other application objects, run in the main thread of 
 their hosting process. This means that, if your service is going to do any 
 CPU intensive (such as MP3 playback) or blocking (such as networking) 
 operations, it should spawn its own thread in which to do that work.

On Sep 11, 4:55 am, Indicator Veritatis mej1...@yahoo.com wrote:
 Option 4 certainly sounds like it will work, but it suggests some
 peculiar problems in the way the classes are designed. Service by
 definition is already in the background, it HAS no UI thread, so why
 do I need an AsyncTask there at all? The whole point of the latter is
 to communicate between UI thread and worker thread.

 As for documenting what works, I hope Google takes your hint and
 documents what the right way to do this really is. After all, these
 are the same people who keep warning us that if it's not documented,
 then it is subject to change w/o notice.

 On Sep 10, 10:04 am, Mark Murphy mmur...@commonsware.com wrote:

  On Fri, Sep 10, 2010 at 12:46 PM, Romain Guy romain...@android.com wrote:
   Option #1 is a lot more intrusive. You lose the ability to
   automatically switch layouts, drawables, etc.

  Worst-case scenario:

  Step #1: Take your UI setup that is in onCreate() and move it to a
  separate method (e.g., setupViews())

  Step #2: Call setupViews() from onCreate()

  Step #3: Call setupViews() from onConfigurationChanged()

  Done. ~4 lines of code. And it's the exact same code path that a
  destroy/recreate will go down, so it's not like this adds unusual
  performance overhead. There are certain circumstances where this may
  not work (e.g., GLSurfaceView and a game), but you needed to do extra
  work for those cases, anyway, to handle the destroy/recreate cycle.

   Saving and restoring an AsyncTask is not difficult.

  No, it's not. The question is: is it reliable?

  None of the AsyncTask documentation (class, article, etc.) covers this
  case. It *appears* that you can write an AsyncTask such that
  onPostExecute() or onProgressUpdate() will not be called in the middle
  of the activity transition. However, that's not documented and hence
  not guaranteed, and so while I'll describe a pattern that seems to
  work, I personally don't trust it any further than I can throw your
  large Froyo lawn ornament. If somebody could give us the recipe that
  is guaranteed to work (i.e., works today, and is going to work in
  Android 2.3/3.0/Turbo System 5000), that'd be *wonderful*.

  Actually, I lied earlier. I'd choose Option #4:

  Option #4: Don't do the AsyncTask in an activity. Use a Service and
  have it do the AsyncTask, or use an IntentService if the sole purpose
  of the service is to do stuff in a background thread. In particular,
  an IntentService would be good for a download that you want to happen
  regardless of what may go on with an activity (e.g., Android Market
  downloading an APK), and so you don't need to worry about canceling
  it.

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

  Android Training in London:http://skillsmatter.com/go/os-mobile-server

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


Re: [android-developers] Re: AsyncTask and screen rotation

2010-09-11 Thread Kostya Vasilyev

 11.09.2010 12:55, Indicator Veritatis пишет:

Option 4 certainly sounds like it will work, but it suggests some
peculiar problems in the way the classes are designed. Service by
definition is already in the background, it HAS no UI thread, so why
do I need an AsyncTask there at all? The whole point of the latter is
to communicate between UI thread and worker thread.


A Service runs on the UI thread by default, so some kind of mechanism to 
push work to a background thread is still required. It can be a 
WakefulIntentService, or, just as easily, an AsyncTask (I imagine it 
takes care of acquiring a wake lock).


It seems to me (and that's just my opinion) that 
onRetainNonConfigurationInstance / getLastNonConfigurationInstance is 
probably the easiest way for small, one-at-a-time async tasks, where UI 
feedback is supposed to be immediate.


These two methods use plain Java objects, don't require serialization or 
parceling, so they are a good fit. The only issue is - switching UI 
references. OnRetail... can null them out before storing the task in a 
configuration object, and onStart / getLast... can store new UI 
references in the task.


The task would also need to keep most recent progress state values, to 
be displayed in the newly created activity.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] Re: Can android support more than one sdcard?

2010-09-11 Thread blindfold
Right, device enumeration should not have been an afterthought - and
in Android it is not even an afterthought yet!

Microsoft thought of device enumeration ages ago, with functions like
GetLogicalDrives(), waveInGetNumDevs(), waveOutGetNumDevs(),
mixerGetNumDevs(),
CreateClassEnumerator(CLSID_VideoInputDeviceCategory,,), etc, etc.
Things tend to become much less messy when designing APIs for
accommodating multiple devices of a given type from the outset. It
looks like the broadening scope of Android was (and is)
underestimated.

Regards

On Sep 11, 10:42 am, Indicator Veritatis mej1...@yahoo.com wrote:
 Что Вы? Видно, это не то, что имела ввиду.

 But the truth of the matter is as Dianne so laconically stated: since
 there is no platform API for it, trying to support two SD cards is
 going to be ugly. Or in the case of the Samsung phone, already is
 ugly.

 That said, I really wish Google had thought of this possibility ahead
 of time. It really should not have been that difficult. Having 2 SD
 cards is only a little odd, no more odd than having two SIMS, which is
 also fairly common (at least for European phones).

 Part of marketing's job IS to anticipate such future requirements,
 communicate them to engineering so that engineering can design with an
 eye for the future. In this case, that would have meant leaving 'room'
 in the API for supporting multiple (especially two) SD cards.

 Just think, for example, how much easier it is to backup your phone if
 you have two SD cards in two separate slots: one for backup, the other
 for data and programs.

 Finally, it is unfair to compare this to having two of everything and
 anything, since two SD cards is so much more handy and so much less
 expensive than having two touch screens, two CPUs etc.

 On Sep 10, 10:59 am, Kostya Vasilyev kmans...@gmail.com wrote:

    10.09.2010 21:51, Dianne Hackborn пишет: There is no platform API for 
  developers to find the second SD card, so
   I would strongly discourage having one since it will result in a
   poorer user experience with their apps.

  How do you discourage phone owners from buying and installing an sdcard?

  --
  Kostya Vasilyev -- WiFi Manager + pretty widget 
  --http://kmansoft.wordpress.com

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


Re: [android-developers] Re: Can android support more than one sdcard?

2010-09-11 Thread Kostya Vasilyev

 11.09.2010 12:51, blindfold пишет:

A marketing or engineering department that can't accept limitations is an
organization that will never ship a product.
Samsung somehow managed to ship the Galaxy S. And this phone has 
Google's logo on the back, so it's certified.

I'll only support one camera!  Okay.

Not OK! If one wants to compete on the market one has to look at
competitors that already sport two cameras, such as a front-facing
camera. Think many Nokia phones, and Apple's iPhone 4G. (I added
second camera support to my own Nokia Java MIDlet app back in 2006.)
Do you want every Android phone manufacturer to invent and develop
their own proprietary Android API extensions even to just keep up with
existing functionality elsewhere? You encourage fragmentation!
3G networks (at least GSM/UMTS ones) support video calls. Without a 
front-facing camera, those are impossible. I'm not sure whether Android 
supports video calls, though.


I can imagine interesting niche applications if there was an API for the 
front-facing camera.

(And you don't note all of the complexity that comes from going from 1 to 2
-- how is this reflecting in the UI?  How does the user decide where they
want their stuff to go?  How about telling them how much space is where?
  And now you've got to let them move stuff around.  I can make a good
argument that multiple SD cards is just intrinsically a crummy user
experience and should be avoided.  Heck even one SD card significantly
complicates the UX.)
There are two locaitons already: internal phone memory and the (usually 
external) memory card. This is reflected in the UI, starting at least 
with 1.5 (Settings - Memory).


It already creates UI complexity (the move to sd card option), and 
usability complexity (where did my home screen widgets go?).


What about desktop computers supporting multiple physical disk drives 
and logical partitions?


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] Testing OS customizations in emulator

2010-09-11 Thread mathijs
Hi,

We recently launched an update to our app in which we skinned the
button background colors lighter than the default theme. Only through
bad user comments we found out that the Droid X  Droid 2 have a
default theme with dark buttons and white text, so the white text
became unreadable on our lighter buttons.
As we're in Europe, we don't have access to either a Droid X or Droid
2 to test, and we haven't found out how we can set the emulator to
emulate how our app would look on those phones.

The UI of android apps becomes more and more important because users
don't like an app to be the default black theme anymore. Are there any
tools planned to help developers make sure their apps are usable on
all customized versions of Android that are out there?

Best regards,

Mathijs / AppBrain team

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


Re: [android-developers] Re: AsyncTask and screen rotation

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 6:10 AM, Kostya Vasilyev kmans...@gmail.com wrote:
 It seems to me (and that's just my opinion) that
 onRetainNonConfigurationInstance / getLastNonConfigurationInstance is
 probably the easiest way for small, one-at-a-time async tasks, where UI
 feedback is supposed to be immediate.

 These two methods use plain Java objects, don't require serialization or
 parceling, so they are a good fit. The only issue is - switching UI
 references. OnRetail... can null them out before storing the task in a
 configuration object, and onStart / getLast... can store new UI references
 in the task.

Given Ms. Hackborn's explanation of the message flow, I would agree
with your assessment. Without that guarantee, though, I couldn't trust
this model.

 The task would also need to keep most recent progress state values, to be
 displayed in the newly created activity.

Actually, that shouldn't be needed. doInBackground() should be able to
just call publishProgress(). Those messages will just get queued up
until the new activity is ready.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

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


Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Mark Murphy
On Fri, Sep 10, 2010 at 1:41 AM, DG gujar.dwark...@gmail.com wrote:
 Is there any way in Android SDK to get the screen shot.

No. That would be a security hole. There are apparently ways to get
this on rooted phones, though.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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


Re: [android-developers] Re: SQLite DB: insert VERY slow

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 5:15 AM, Zsolt Vasvari zvasv...@gmail.com wrote:
 Make sure you use transactions.  In my situation, minutes became
 seconds when I did that.

Agreed. By default, each insert is its own transaction, involving
individual flash writes, which gets slow. Batch the inserts (e.g., 100
to a transaction), and things will go more smoothly.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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


Re: [android-developers] SQLiteDatabase.update() super slow

2010-09-11 Thread Mark Murphy
On Fri, Sep 10, 2010 at 10:11 PM, Sheado chad...@gmail.com wrote:
 The issue:
 SQLiteDatabase.update(...) takes anywhere from 30ms to 700ms on a
 simple update (on a Motorola Droid). I'm not sure why there's such a
 huge range in the timing, but despite that it still means that in the
 best case updating one column in 30 rows will take at least one second
 - in the best case! On average updating 30-40 rows is taking me 3-4
 seconds - this is crazy slow - like 1985 computer slow!

No, it's like flash slow. Please watch Brad Fitzpatrick's Writing
Zippy Android Apps presentation from the 2010 Google I|O conference.
He covers this very point.

 I've tried:
 * update(...) with ContentValues
 * update with execSql()
 * add/removing indices on the columns in question

None of those should have any effect. You're assuming the problem is
with the CPU. It's not. It is with the flash writes. You need to cut
down on the number of flash writes.

 Is there anything else I can try to improve performance? For example,
 is there any way to update multiple rows with one statement?

As the others on this thread pointed out, use transactions. That will
turn ~30 individual transactions (each with its own set of flash
write) into one.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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: Can android support more than one sdcard?

2010-09-11 Thread Doug Gordon
I get your point, and unfortunately I once worked for such an
organization! :-)

I was just thinking back to the evolution of the PC, which also
started out supporting just one of everything (e.g., the C: drive) and
ended up with multiple disks, multiple partitions on a disk, multiple
pointing devices, multiple screens, etc., etc.

But in this case, even though you're understandably trying to keep
things simple, I tend to think of my Android phone as a replacement
for my Palm PDA, which did have OS support for the resource in
question: multiple removable storage cards (however, I don't think
that any such device was ever produced).


 On Fri, Sep 10, 2010 at 2:33 PM, Doug Gordon gordo...@gmail.com wrote:
 A marketing or engineering department that can't accept limitations is an
 organization that will never ship a product.

 --
 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, and so won't reply to such e-mails.  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] How to get value from ListView onListItemClick?

2010-09-11 Thread Mystique
Hi, i can add to a db and list as a listview.
When I click a list item using onListItemClick, what statement do I
need to get the value?

Thanks in advance.

---code---
public class Main extends ListActivity {
private static String[] FROM = { _ID, DESCRIPTION, UN };
private static String ORDER_BY = DESCRIPTION +  ASC;
private static int[] TO = {R.id.itemrowid, R.id.itemdescription,
R.id.itemun };
private EventsData events;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
events = new EventsData(this);
try {
Cursor cursor = getEvents();
showEvents(cursor);
 } finally {
events.close();
 }

public void onListItemClick(ListView parent, View v, int position,
long id) {

// What statement to put here to get the value of _ID,
DESCRIPTION, UN
// selected?
}

private Cursor getEvents() {
// Perform a managed query. The Activity will handle closing
// and re-querying the cursor when needed.
SQLiteDatabase db = events.getReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, FROM, null, null, null,
null, ORDER_BY);
startManagingCursor(cursor);
return cursor;
}

private void showEvents(Cursor cursor) {
// Set up data binding
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.item, cursor, FROM, TO);
setListAdapter(adapter);
}

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


Re: [android-developers] How to get value from ListView onListItemClick?

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 7:54 AM, Mystique joven.ch...@gmail.com wrote:
 Hi, i can add to a db and list as a listview.
 When I click a list item using onListItemClick, what statement do I
 need to get the value?

:: snip ::

    public void onListItemClick(ListView parent, View v, int position,
 long id) {

        // What statement to put here to get the value of _ID,
 DESCRIPTION, UN
        // selected?
    }

The fourth parameter (id) is _ID. The third parameter (position) can
be used with moveToPosition() on your Cursor to access anything else
you may need.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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: How to get value from ListView onListItemClick?

2010-09-11 Thread Mystique
So if I want to get value of UN, I do this - String temp =
moveToPosition(UN)?

On Sep 11, 7:55 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Sep 11, 2010 at 7:54 AM, Mystique joven.ch...@gmail.com wrote:
  Hi, i can add to a db and list as a listview.
  When I click a list item using onListItemClick, what statement do I
  need to get the value?

 :: snip ::

     public void onListItemClick(ListView parent, View v, int position,
  long id) {

         // What statement to put here to get the value of _ID,
  DESCRIPTION, UN
         // selected?
     }

 The fourth parameter (id) is _ID. The third parameter (position) can
 be used with moveToPosition() on your Cursor to access anything else
 you may need.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
 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


Re: [android-developers] Re: How to get value from ListView onListItemClick?

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 8:04 AM, Mystique joven.ch...@gmail.com wrote:
 So if I want to get value of UN, I do this - String temp =
 moveToPosition(UN)?

No.

c.moveToPosition(position); // where c is your Cursor
String temp=c.getString(...); // where ... is whatever column number
you are seeking

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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: How to get value from ListView onListItemClick?

2010-09-11 Thread Mystique
Dear Mr. Murphy,

Thanks, I understood this part ok
c.moveToPosition(position); // where c is your Cursor
String temp=c.getString(...); // where ... is whatever column number

My cursor was created in onCreate, how do I initial it in public void
onListItemClick?
This part I do not understand.


On Sep 11, 8:19 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Sep 11, 2010 at 8:04 AM, Mystique joven.ch...@gmail.com wrote:
  So if I want to get value of UN, I do this - String temp =
  moveToPosition(UN)?

 No.

 c.moveToPosition(position); // where c is your Cursor
 String temp=c.getString(...); // where ... is whatever column number
 you are seeking

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
 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


Re: [android-developers] Re: How to get value from ListView onListItemClick?

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 8:32 AM, Mystique joven.ch...@gmail.com wrote:
 Thanks, I understood this part ok
 c.moveToPosition(position); // where c is your Cursor
 String temp=c.getString(...); // where ... is whatever column number

 My cursor was created in onCreate, how do I initial it in public void
 onListItemClick?
 This part I do not understand.

Hold onto the Cursor in a private data member. Or, call:

((CursorAdapter)getListAdapter()).getCursor()

to retrieve it.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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: How to get value from ListView onListItemClick?

2010-09-11 Thread Mystique
Cancel my last qns, I understood and get it work already :)

On Sep 11, 8:32 pm, Mystique joven.ch...@gmail.com wrote:
 Dear Mr. Murphy,

 Thanks, I understood this part ok
 c.moveToPosition(position); // where c is your Cursor
 String temp=c.getString(...); // where ... is whatever column number

 My cursor was created in onCreate, how do I initial it in public void
 onListItemClick?
 This part I do not understand.

 On Sep 11, 8:19 pm, Mark Murphy mmur...@commonsware.com wrote:



  On Sat, Sep 11, 2010 at 8:04 AM, Mystique joven.ch...@gmail.com wrote:
   So if I want to get value of UN, I do this - String temp =
   moveToPosition(UN)?

  No.

  c.moveToPosition(position); // where c is your Cursor
  String temp=c.getString(...); // where ... is whatever column number
  you are seeking

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

  _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
  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


Re: [android-developers] Database writing with Android App

2010-09-11 Thread paulb
G'day mate,

How about using a content provider? That may give you the flexibility
to query it as though it were a local database, but design it so it
accesses a remote database on another server.

If you don't want the data to 'immediately' flow into a data
warehouse, you could simply use the SQL Lite database and also write a
Server that, using a background thread, sends the data back to your
data warehouse. Then the device does not require a network all the
time, and you could set it up to sync when needed/possible.

On Fri, Sep 10, 2010 at 12:18 PM, Puneet gaganr...@gmail.com wrote:
 Hello to all,
 This is what I am trying to do. I have developed an Android game app.
 This game generates scores each time the user plays it. I am trying to
 accomplish the following things:

 1) I want the scores to be captured in a database.

 2) I wan the data from this database to ultimately flow into a data
 warehouse so we can create Business Intelligence Analytics on top of
 the data warehouse. The analytics need to be visible on the Android
 device.

 Are both these things possible. I have research the SQL Lite database
 but unfortunately it resides on the mobile device. Is there a more
 scaleable way to achieve this idea.

 Would really appreciate the help of all the database gurus.

 Thanks in advance and I will wait eagerly for the responses.

 Regards
 Puneet.

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

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


[android-developers] Re: Behaviour of launchMode=“ singleTask” not as described?

2010-09-11 Thread niko20
I've never had any problems using singleTask - works as described, but
I may not be using Intents to the extent that you do.

-niko

On Sep 11, 2:31 am, Olly ollywood...@gmail.com wrote:
 I have submitted a bug report with more information here:

 http://code.google.com/p/android/issues/detail?id=11160sort=-idcols...

 I think this is a fairly important issue. There needs to be
 clarification as to whether the observed behaviour is correct and it
 is a documentation error (that would be my guess), or the other way
 around.

 On 11 Sep, 07:56, Olly ollywood...@gmail.com wrote:

  singleTop behaves as documented for m (i.e. creating a new Activity at
  the top of the stack, or reusing one if there is already an Activity
  of that type at the top of the stack). I'm pretty sure singleTask is
  documented incorrectly though. I'm just wondering whether I've got it
  wrong, since this is completely fundamental (its in the Android
  fundamentals document, so how has no-one else picked up on it?

  On 11 Sep, 04:30, joebowbeer joe.bowb...@gmail.com wrote:

   I agree that the documentation is confusing and possibly wrong.

   For the second behavior, that of discarding the intent and bringing
   the task with the specified activity to the foreground, you should use
   singleTop instead (despite what the documentation says).

   On Sep 10, 4:00 pm, Olly ollywood...@gmail.com wrote:

I've been learning Android and have come across an issue with
launchMode=singleTask. The documentation states that when this
attribute is used, the Activity is always launched into a new task as
the root Activity. Secondly, the documentation states that if an
Intent is targeted at such an Activity when there are Activities
sitting above it in its task stack, such Intents are discarded
(although the task is still brought to the foreground).

I've been playing around with this, and the behaviour I observe is
completely different. In particular: - Activities with
launchMode=singleTask are not always the root Activity in a task
stack. They are just plonked ontop of the existing stack with the same
affinity. - When an Intent is targeted at such an Activity and there
are other Activities above it in the stack, the Intent is not
discarded. Instead the Activities above it in the stack are discarded.
The Intent is then delivered via onNewIntent to the Activity as
normal.

Can someone confirm that this is the actual behaviour? If so, why are
the documents incorrect? If not what have I done wrong. . . Here is a
simple way to observe the behaviour:

1. Create a simple main.xml containing two buttons b1 and b2.
2. Create the following Activity:

public class ActivityA extends Activity {

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button lButton = (Button) findViewById(R.id.b1);
        lButton.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View arg0) {
                                Intent lNextIntent = new 
Intent(ActivityA.this,ActivityA.class);
                                startActivity(lNextIntent);
                        }
        });

        Button lButton2 = (Button) findViewById(R.id.b2);
        lButton2.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View arg0) {
                                Intent lNextIntent = new 
Intent(ActivityA.this,ActivityB.class);
                                startActivity(lNextIntent);
                        }
        });
    }

}

3. Create the second Activity:

public class ActivityB extends ActivityA {

}

4. The manifest:

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
      package=ojw28.activitytest
      android:versionCode=1
      android:versionName=1.0
    application android:icon=@drawable/icon android:label=@string/
app_name
        activity android:name=ActivityA
                  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=.ActivityB
android:launchMode=singleTask
        /activity
    /application
/manifest

5. Launch the application. Press button b1 a couple of times, see what
happens to the task stack using adb shell dumpsys activity. Multiple
instances of ActivityA are now in the task stack as expected.

Now press button b2. According to the documentation 

[android-developers] Re: Need a Samsung Behold II user to help identify problem

2010-09-11 Thread Stephen
Tried to test on an original Samsung Galaxy i7500 which I think has
the same lineage as the Behold II, but Android Market cannot find your
app on this phone.  Did you take it down?

Stephen

On Sep 9, 4:14 pm, dhagge damianha...@gmail.com wrote:
 I just released my first app and have several reports of crashes on
 various Samsung devices.  I suspect that it's to do with a Samsung-
 specific android version (maybe 1.6?) but that's just a pure guess.  I
 do have a single user report indicating that it will not start up on a
 Samsung Behold II.

 I've testing the app on approx 8 different devices including an x10i
 with no issues whatsoever.

 Is there anyone with an (old-ish) Samsung who could dl and let me know
 if the app functions for them or not (along with any diagnoses)?

 App Name: Baby Name-o-Matic

 I would really appreciate it!

 Damian

-- 
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] xmlrpc client library with authentication

2010-09-11 Thread kukukk
Hy,

Is anybody using the android-xmlrpc client library with
authentication? Without authentication it is working great, but I
can't get it to work with authentication.
Can somebody send me a piece of code, where the authentication works
or help me to debug what is the problem?

Or there is any other library for xmlrpc client?

Thanks in advance

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


Re: [android-developers] Re: AsyncTask and screen rotation

2010-09-11 Thread Kostya Vasilyev

 11.09.2010 15:05, Mark Murphy пишет:

  The task would also need to keep most recent progress state values, to be
  displayed in the newly created activity.

Actually, that shouldn't be needed. doInBackground() should be able to
just call publishProgress(). Those messages will just get queued up
until the new activity is ready.


Provided that the worker thread publishes updates sufficiently often - yes.

--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] ADT plugin layout editor - additional device configurations?

2010-09-11 Thread PulseDev
You know that layout editor in the Android ADT plugin that lets you
design the layout for ADP1, ADP2 and Nexus One, has anyone created
other device configurations?

It requires device information such as the x-dpi and y-dpi, which can
be difficult to find out.  I'm just wondering if anybody has added
more device configurations they're willing to share?  Perhaps together
we could compile a huge devices.xml containing many of the devices out
there.

I'm fully aware the layout editor has many faults and cannot be relied
upon but it is sometimes useful to rapidly preview how the layout
might look on a wide variety of devices without switching between
emulators.

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


Re: [android-developers] Re: How to handle Home Key in our Activity

2010-09-11 Thread Sebastián Treu
FAQ is a great idea, but will not solve the issue with repeated
questions. Simply, the won't read it. They won't google. And it's
something we need to live with. I consider myself a beginner and
always try to find out myself a way, reading, googling, and so on. And
when I find that's not obvious, I ask for help to learn and to grow as
a developer. But, that's me. I'm trying to be a professional. Some
people just don't care, or they are just playing around, or they are
different.

I think that never, ever, ever this problem will be completely
removed. No matter how many FAQs you write, or how many how-to's are
out there. The class of people that don't dig up by themself will
never be an empty set.

Best regards,
-- 
If you want freedom, compile the source.

Sebastián Treu
http://labombiya.com.ar

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


Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Sebastián Treu
On Sat, Sep 11, 2010 at 8:08 AM, Mark Murphy mmur...@commonsware.com wrote:
 On Fri, Sep 10, 2010 at 1:41 AM, DG gujar.dwark...@gmail.com wrote:
 Is there any way in Android SDK to get the screen shot.

 No. That would be a security hole. There are apparently ways to get
 this on rooted phones, though.

I don't like to twist the topic, but curiosity is such that I want to
know why. Can you provide a useful link or info on why it would be a
security hole?

Thanks!
-- 
If you want freedom, compile the source.

Sebastián Treu
http://labombiya.com.ar

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


Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 10:37 AM, Sebastián Treu
sebastian.t...@gmail.com wrote:
 I don't like to twist the topic, but curiosity is such that I want to
 know why. Can you provide a useful link or info on why it would be a
 security hole?

It's been discussed on this list a fair bit. If Application A can take
screenshots of Banking Application B, Contacts Application C, etc.,
then Application A can supply evil people with a lot of rather
interesting information.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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


Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Kostya Vasilyev

 11.09.2010 18:37, Sebastián Treu пишет:

  No. That would be a security hole. There are apparently ways to get
  this on rooted phones, though.

I don't like to twist the topic, but curiosity is such that I want to
know why. Can you provide a useful link or info on why it would be a
security hole?

Trojan applications could take screen shots and use character 
recognition to hijack private information.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


Re: [android-developers] Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Sebastián Treu
Thanks both.

(why people uses its brain for evil rather than good? :( )

Regards,
-- 
If you want freedom, compile the source.

Sebastián Treu
http://labombiya.com.ar

-- 
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 get value from ListView onListItemClick?

2010-09-11 Thread Pang
c.getString(c.getColumnIndexOrThrow(UN))

On 9月11日, 下午8时37分, Mystique joven.ch...@gmail.com wrote:
 Cancel my last qns, I understood and get it work already :)

 On Sep 11, 8:32 pm, Mystique joven.ch...@gmail.com wrote:

  Dear Mr. Murphy,

  Thanks, I understood this part ok
  c.moveToPosition(position); // where c is your Cursor
  String temp=c.getString(...); // where ... is whatever column number

  My cursor was created in onCreate, how do I initial it in public void
  onListItemClick?
  This part I do not understand.

  On Sep 11, 8:19 pm, Mark Murphy mmur...@commonsware.com wrote:

   On Sat, Sep 11, 2010 at 8:04 AM, Mystique joven.ch...@gmail.com wrote:
So if I want to get value of UN, I do this - String temp =
moveToPosition(UN)?

   No.

   c.moveToPosition(position); // where c is your Cursor
   String temp=c.getString(...); // where ... is whatever column number
   you are seeking

   --
   Mark Murphy (a Commons 
   Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

   _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
   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] does AppWidgetManager.updateAppWidget() need to be called on the UI thread?

2010-09-11 Thread sdphil
When I make this call, I am getting a   Java Binder   FAILED
BINDER TRANSACTION !!!

message in my logging window.  Is this because that call needs to be
made on the UI thread?

tia.

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


Re: [android-developers] Testing OS customizations in emulator

2010-09-11 Thread Rich
 Motorola has AVDs for their phones.  Here's the link to the install 
instructions.  I'm not sure which phones have AVDs, I'm using the Droid 
X version though and it works great.


http://developer.motorola.com/docstools/library/Installing_the_Motorola_SDK_Add-on/

Rich


On 9/11/2010 4:24 AM, mathijs wrote:

Hi,

We recently launched an update to our app in which we skinned the
button background colors lighter than the default theme. Only through
bad user comments we found out that the Droid X  Droid 2 have a
default theme with dark buttons and white text, so the white text
became unreadable on our lighter buttons.
As we're in Europe, we don't have access to either a Droid X or Droid
2 to test, and we haven't found out how we can set the emulator to
emulate how our app would look on those phones.

The UI of android apps becomes more and more important because users
don't like an app to be the default black theme anymore. Are there any
tools planned to help developers make sure their apps are usable on
all customized versions of Android that are out there?

Best regards,

Mathijs / AppBrain team



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


Re: [android-developers] does AppWidgetManager.updateAppWidget() need to be called on the UI thread?

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 11:25 AM, sdphil phil.pellouch...@gmail.com wrote:
 When I make this call, I am getting a   Java Binder       FAILED
 BINDER TRANSACTION !!!

 message in my logging window.  Is this because that call needs to be
 made on the UI thread?

No, updateAppWidget() can be called off the main application thread.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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


Re: [android-developers] does AppWidgetManager.updateAppWidget() need to be called on the UI thread?

2010-09-11 Thread Kostya Vasilyev

 Phil,

There should be more information in the logcat - describing what kind of 
bad thing happened on the remote side of the binder call.


My guess is that your RemoteViews has an state change operation that 
references a view or a resource that doesn't exist in the widget, or 
possibly just an invalid value (e.g. a null string in setTextViewText).


-- Kostya

11.09.2010 20:06, Mark Murphy пишет:

On Sat, Sep 11, 2010 at 11:25 AM, sdphilphil.pellouch...@gmail.com  wrote:

When I make this call, I am getting a   Java Binder   FAILED
BINDER TRANSACTION !!!

message in my logging window.  Is this because that call needs to be
made on the UI thread?

No, updateAppWidget() can be called off the main application thread.




--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] Re: Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Bret Foreman
Because, as Dr Horrible has taught us - evil is so much fun:
http://www.drhorrible.com/

 (why people uses its brain for evil rather than good? :( )

 Regards,
 --
 If you want freedom, compile the source.

 Sebastián Treuhttp://labombiya.com.ar

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


Re: [android-developers] Re: Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 12:31 PM, Bret Foreman bret.fore...@gmail.com wrote:
 Because, as Dr Horrible has taught us - evil is so much fun:
 http://www.drhorrible.com/

Oh, is that the lesson? I thought the Dr. Horrible lesson was geeks
bearing Froyo have no shot with Felicia Day... :-)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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


Re: [android-developers] Re: Is anyone's active install % dropping like a rock lately?

2010-09-11 Thread Fabrizio Giudici

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 9/10/10 23:57 , tdieckman wrote:
 Second, I have a paid license key for my app on the market. I've
 been keeping records daily to watch trends (why can't the console
 do this for us)? Anyway, my total sales figure right now is 584
 paid downloads, while my active downloads of that paid app is only
 452 as of two days ago. If I add the number of cancelled purchases
 (71) to my paid purchases (584), I end up with 655 which is more
 than the 639 that the console shows. I know that the console
 doesn't update as frequently, I've gotten about 10 downloads per
 day over the last few days, so that would mean the console is off
 by more than a day.

Well, thanks - your check against paid downloads is one of the most
interesting pieces of information in this thread and sounds a solid
proof that, at least in some cases, the number are buggy.

- -- 
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - We make Java work. Everywhere.
java.net/blog/fabriziogiudici - www.tidalwave.it/people
fabrizio.giud...@tidalwave.it
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyLteQACgkQeDweFqgUGxfxHACfb4ZgBVtOWb8Qq6dcHOcu8CsK
tK4AmgMCqbYGqHiKSB30XNjxaNIA8qc2
=pcKj
-END PGP SIGNATURE-

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


Re: [android-developers] Re: maps app returning a null pointer exception

2010-09-11 Thread TreKing
On Thu, Sep 9, 2010 at 12:34 PM, anushree godbole.anush...@gmail.comwrote:

 09-09 23:00:22.243: ERROR/AndroidRuntime(329): *Caused by:
 java.lang.NullPointerException*
 09-09 23:00:22.243: ERROR/AndroidRuntime(329): *at com.google.MapsProject.
 **MapsProject.setupWebView(**MapsProject.java:38)*
 09-09 23:00:22.243: ERROR/AndroidRuntime(329): *at com.google.MapsProject.
 **MapsProject.onCreate(**MapsProject.java:24)*


What more do you need to know?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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: Can android support more than one sdcard?

2010-09-11 Thread DanH
 I was just thinking back to the evolution of the PC, which also
 started out supporting just one of everything (e.g., the C: drive) and
 ended up with multiple disks, multiple partitions on a disk, multiple
 pointing devices, multiple screens, etc., etc.

Actually, the PC started out supporting multiple drives -- A, B, C, D,
etc.  I believe this mimicked CP/M.  It was a classical M$ism to place
the hard drive at C (so that the location of the two presumed
floppies wouldn't change) and assume there was only one, but one would
expect a Linux-derived box to be more general.

On Sep 11, 6:31 am, Doug Gordon gordo...@gmail.com wrote:
 I get your point, and unfortunately I once worked for such an
 organization! :-)

 I was just thinking back to the evolution of the PC, which also
 started out supporting just one of everything (e.g., the C: drive) and
 ended up with multiple disks, multiple partitions on a disk, multiple
 pointing devices, multiple screens, etc., etc.

 But in this case, even though you're understandably trying to keep
 things simple, I tend to think of my Android phone as a replacement
 for my Palm PDA, which did have OS support for the resource in
 question: multiple removable storage cards (however, I don't think
 that any such device was ever produced).

  On Fri, Sep 10, 2010 at 2:33 PM, Doug Gordon gordo...@gmail.com wrote:
  A marketing or engineering department that can't accept limitations is an
  organization that will never ship a product.

  --
  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, and so won't reply to such e-mails.  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] (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread tony obrien
I think I have discovered the reason for my troubles. I also think
that the relationship to the media process was incidental.

What I really think is going on is related to the OS reclaiming
memory.

When I leave my app in the foreground (i.e. visible) it works (and It
Won't Die, Jim) -- if I use the BACK BUTTON to push it into the
background, it *may* die, and I am convinced it is at the hands of the
OS in its memory reclamation process… I assert this as my experiments
have shown that on a device with LOTS O' memory the app works
flawlessly… on a device with less memory it will almost certainly die
 and I can guarantee to kill it if I start using the devices other
apps.

The rub here is that I NEED my app to reside in the background (or at
least my SMS BROADCAST RECEIVER class) .. I want the user to be able
to use his phone for other things while my app awaits a signaling
SMS. At that point I use a notification to get the user's attention.

I am hoping someone may respond and say … Well, all-you-gotta-do is
Blah_Blah…  Is there a way to make the OS not clean me out of
memory? Is the answer to make the b-receiver a service? And is that
allowable in Android?

On Sep 6, 10:56 am, tony obrien tobsourcecode...@gmail.com wrote:
 Hi,

 I have seen one reference to this sort of problem where a MAIN app
 dies because :::

 because provider com.android.providers.media.MediaProvider is in
 dying process android.process.media

 In that reference the implication was that if you held a CURSOR too
 long  this could happen.

 I am not using any explicit cursor, but maybe there is an implied one
 somehere?

 Hopefully these code snips will provide someone enough incite to offer
 a solution.

 I use a RINGTONE PICKER ==

                                 String uri = null;
                                 Intent intent = new
 Intent( RingtoneManager.ACTION_RINGTONE_PICKER);

 intent.putExtra( RingtoneManager.EXTRA_RINGTONE_TYPE,
 RingtoneManager.TYPE_NOTIFICATION);

 intent.putExtra( RingtoneManager.EXTRA_RINGTONE_TITLE, Select Tone);
                                 if( uri != null)
                                 {

 intent.putExtra( RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
                                     Uri.parse( uri));
                                 }

                                 else
                                 {

 intent.putExtra( RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
                                     (Uri)null);
                                 }
                                 startActivityForResult( intent,
 Set_Ringtone);

 And catch the result

 @Override
     public void onActivityResult(int reqCode, int resultCode, Intent
 data) {
         super.onActivityResult(reqCode, resultCode, data);

         if (resultCode == RESULT_OK) {
             Uri uri =
 data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
             if (uri != null) {
                 MainActivity.ringTonePath = uri.toString();
             }

         }
     }

 At some time later, I call a sound class to play the selected
 ringtone :::

             Ringtone myr =  RingtoneManager.getRingtone(context,
 Uri.parse( MainActivity.ringTonePath));
             if (MainActivity.doDebug) Log.d(FPH, clsSound:Play
 RINGTONE);
             myr.play();
             return;

 This is called repeatedly while a flag is TRUE (until the user sets it
 FALSE)

 At this point the App is sitting essentially idle  --- and if the
 android.process.media dies (say by force) then so do I. But I do not
 understand why I should die.

 Any ideas?
 thanks,
 tob

-- 
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: is there a way to implement screenshot functionality in android

2010-09-11 Thread dadada
then why can iphone support screen shot but android cannot?

does anyone know of a workaround? i just need to capture the part of
the image that the user is viewing.(after they try to zoom in or
out).

thanks!

On Sep 10, 10:06 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Fri, Sep 10, 2010 at 9:53 AM, dadada ytbr...@gmail.com wrote:
  question as above!

 This is not supported, for security reasons. There are apparently ways
 you can get something to work if you root your phone. And, of course,
 you can do screenshots from outside your phone using DDMS.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training in London:http://skillsmatter.com/go/os-mobile-server

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


Re: [android-developers] Re: is there a way to implement screenshot functionality in android

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 2:51 PM, dadada ytbr...@gmail.com wrote:
 then why can iphone support screen shot but android cannot?

I doubt any Apple employees are on this discussion group, and if they
are, there's a fairly decent chance they will decline to answer your
question.

 does anyone know of a workaround? i just need to capture the part of
 the image that the user is viewing.(after they try to zoom in or
 out).

If this is your activity and your image, you don't need a screenshot
for that. You know what the image is, you know the zoom level and size
-- draw it to a Bitmap-backed Canvas and save the result.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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


Re: [android-developers] (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread Kostya Vasilyev

 Well, all-you-gotta-do is:

Register your receiver in the manifest, like so:

receiver android:name=.YourSmsMessageReceiverClassName
intent-filter
action android:name=android.provider.Telephony.SMS_RECEIVED /
/intent-filter
/receiver

( Taken from: 
http://developer.android.com/resources/samples/ApiDemos/AndroidManifest.html 
)


Receivers declared in the manifest are active all the time, for as long 
as the application is installed (and not disabled in the manifest). You 
don't need to take any kind of special action for them to receive events.


In the onReceive() method of your broadcast receiver, you are free to do 
whatever you like: such as starting a service to do some kind of 
processing (I actually recommend this).


The application process will be started by Android as necessary.

-- Kostya

11.09.2010 22:25, tony obrien пишет:

I am hoping someone may respond and say … Well, all-you-gotta-do is
Blah_Blah…  Is there a way to make the OS not clean me out of
memory? Is the answer to make the b-receiver a service? And is that
allowable in Android?



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] Contacts and phone numbers in same query under the new contacts API?

2010-09-11 Thread Alexander Lucas
I'm trying to figure out how to get a list of contacts, with phone
numbers, filtered by group using the new (Eclair and up) Contacts
API.  Under the old API, it was a simple matter of:


Uri useUri = Uri.parse(content://contacts/groups/name/ + groupName +
/members);
Cursor swankyCursor = managedQuery(useUri, null, null, null,
People.NAME +  ASC);


But that was back when contacts had a name and phone number in the
same table.  Currently, even without the filter by group
requirement, it seems like in order to get a list of contacts and
their phone numbers, I have to run a query for contacts, and then a
seperate what's this contact's phone number for *every single
contact* - Is this true?  Or is there a way to get it all in one
query?

Thanks!

-Alex

-- 
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: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread tony obrien
Thanks, but I already HAVE such a thing in my Manifest...

I suppose that my BR intent *could be* lurking while my MAIN dies...
but then why doesn't the MAIN get REStarted when the BR starts
updating Main's (static) variables ?  Main is *not* starting and so
its just as if the SMS was never received...

any ideas?


On Sep 11, 3:02 pm, Kostya Vasilyev kmans...@gmail.com wrote:
   Well, all-you-gotta-do is:

 Register your receiver in the manifest, like so:

 receiver android:name=.YourSmsMessageReceiverClassName
 intent-filter
 action android:name=android.provider.Telephony.SMS_RECEIVED /
 /intent-filter
 /receiver

 ( Taken 
 from:http://developer.android.com/resources/samples/ApiDemos/AndroidManife...
 )

 Receivers declared in the manifest are active all the time, for as long
 as the application is installed (and not disabled in the manifest). You
 don't need to take any kind of special action for them to receive events.

 In the onReceive() method of your broadcast receiver, you are free to do
 whatever you like: such as starting a service to do some kind of
 processing (I actually recommend this).

 The application process will be started by Android as necessary.

 -- Kostya

 11.09.2010 22:25, tony obrien пишет:

  I am hoping someone may respond and say … Well, all-you-gotta-do is
  Blah_Blah…  Is there a way to make the OS not clean me out of
  memory? Is the answer to make the b-receiver a service? And is that
  allowable in Android?

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

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


[android-developers] Re: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread tony obrien
One more thing ... if I happen to be in the NetBeans IDE /
Debugger I can be at a breakpoint and (all of a sudden) its been
knocked out of debugging mode -- i.e. the App really has died


On Sep 11, 3:37 pm, tony obrien tobsourcecode...@gmail.com wrote:
 Thanks, but I already HAVE such a thing in my Manifest...

 I suppose that my BR intent *could be* lurking while my MAIN dies...
 but then why doesn't the MAIN get REStarted when the BR starts
 updating Main's (static) variables ?  Main is *not* starting and so
 its just as if the SMS was never received...

 any ideas?

 On Sep 11, 3:02 pm, Kostya Vasilyev kmans...@gmail.com wrote:

    Well, all-you-gotta-do is:

  Register your receiver in the manifest, like so:

  receiver android:name=.YourSmsMessageReceiverClassName
  intent-filter
  action android:name=android.provider.Telephony.SMS_RECEIVED /
  /intent-filter
  /receiver

  ( Taken 
  from:http://developer.android.com/resources/samples/ApiDemos/AndroidManife...
  )

  Receivers declared in the manifest are active all the time, for as long
  as the application is installed (and not disabled in the manifest). You
  don't need to take any kind of special action for them to receive events.

  In the onReceive() method of your broadcast receiver, you are free to do
  whatever you like: such as starting a service to do some kind of
  processing (I actually recommend this).

  The application process will be started by Android as necessary.

  -- Kostya

  11.09.2010 22:25, tony obrien пишет:

   I am hoping someone may respond and say … Well, all-you-gotta-do is
   Blah_Blah…  Is there a way to make the OS not clean me out of
   memory? Is the answer to make the b-receiver a service? And is that
   allowable in Android?

  --
  Kostya Vasilyev -- WiFi Manager + pretty widget 
  --http://kmansoft.wordpress.com



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


[android-developers] ListActivity - detecting which view clicked on

2010-09-11 Thread dashman
I've got a ListActivity w/ an image on the left and 2 rows of text to
the right
(see layout below).

i'd like to detect whether the user clicked on the image or the text
to
the right.

i've overridden

protected void onListItemClick(ListView l, View v, int position,
long id)

and thought the View arg would contain the view clicked on - but it
does not
seem to be.

it seems to be the top-level LinearLayout whether i click over the
image
or the text.

any help appreciated.

the sms app seems to behave this way - click on the icon - one action
and click on the text/name and another action.


LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=horizontal
android:layout_width=match_parent
android:layout_height=match_parent

ImageView android:id=@+id/icon
android:layout_width=48dip
android:layout_height=48dip /

LinearLayout
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

TextView android:id=@+id/line1
android:layout_width=fill_parent
android:layout_height=wrap_content
android:singleLine=true
android:textSize=22sp /

TextView android:id=@+id/line2
android:layout_width=fill_parent
android:layout_height=wrap_content
android:textSize=14sp /

/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


Re: [android-developers] Re: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread Kostya Vasilyev

 Tony,

Android apps are composed of individual components - activities, 
services, broadcast receivers, etc. Their lifetimes are managed by 
Android in response to events that are relevant for a particular type of 
component.


http://developer.android.com/guide/topics/fundamentals.html#appcomp

A broadcast receiver getting an event does not mean that some or other 
activity or a service should be started automatically, just because it's 
a component of the same application.


After all, you wouldn't want all activities declared within your 
application to be invoked at once, right? Same with other component 
types. Each does its own thing, and they are glued together by the code 
you write.


The issue with debugging a broadcast receiver is that Android limits the 
amount of time that an application can take in its callbacks (broadcast 
receiver's onReceive, activity lifecycle callbacks such as onStart, 
etc.) If you take too long in the debugger, Android kills the process 
thinking it's not responding.


My suggestion is to add logging calls (using Android's built-in log 
class) to your receiver's onReceive, verify that does get called, and 
take it from there.


http://developer.android.com/reference/android/util/Log.html

If you would like to notify the user that an SMS has been received, you 
have two options:


- Start an activity using Context.startActivity - which is what you seem 
to be trying to do, but which is considered in Android to be bad user 
experience.


- Use a status bar notification, which would in turn launch the activity 
to show the message:


http://developer.android.com/guide/topics/ui/notifiers/notifications.html

Finally, as for statics - this is a Java thing. Static members are, by 
definition, independent of any particular instance of the class they are 
declared in.


Hope this helps,
-- Kostya

11.09.2010 23:40, tony obrien пишет:

One more thing ... if I happen to be in the NetBeans IDE /
Debugger I can be at a breakpoint and (all of a sudden) its been
knocked out of debugging mode -- i.e. the App really has died


On Sep 11, 3:37 pm, tony obrientobsourcecode...@gmail.com  wrote:

Thanks, but I already HAVE such a thing in my Manifest...

I suppose that my BR intent *could be* lurking while my MAIN dies...
but then why doesn't the MAIN get REStarted when the BR starts
updating Main's (static) variables ?  Main is *not* starting and so
its just as if the SMS was never received...

any ideas?

On Sep 11, 3:02 pm, Kostya Vasilyevkmans...@gmail.com  wrote:


   Well, all-you-gotta-do is:
Register your receiver in the manifest, like so:
receiver android:name=.YourSmsMessageReceiverClassName
intent-filter
action android:name=android.provider.Telephony.SMS_RECEIVED /
/intent-filter
/receiver
( Taken 
from:http://developer.android.com/resources/samples/ApiDemos/AndroidManife...
)
Receivers declared in the manifest are active all the time, for as long
as the application is installed (and not disabled in the manifest). You
don't need to take any kind of special action for them to receive events.
In the onReceive() method of your broadcast receiver, you are free to do
whatever you like: such as starting a service to do some kind of
processing (I actually recommend this).
The application process will be started by Android as necessary.
-- Kostya
11.09.2010 22:25, tony obrien пишет:

I am hoping someone may respond and say … Well, all-you-gotta-do is
Blah_Blah…  Is there a way to make the OS not clean me out of
memory? Is the answer to make the b-receiver a service? And is that
allowable in Android?

--
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com





--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


[android-developers] Re: limited distribution

2010-09-11 Thread Greg
The reason I ask is that I may build a free app for limited release,
as part of a research study. If I choose iOS, then I can distribute to
up to 99 devices before I have to go through the App Store. Was
wondering if there was similar limit for Android. In the (former)
PalmOS world I could email my other app to anyone, they could install
it and that was that.

Greg

On Sep 3, 7:49 am, Lance Nanek lna...@gmail.com wrote:
 Maybe he comes from the iPhone world. There are some sort of limits
 there. 100 specifically provisioned device IDs, 50 promo codes after
 app acceptance, etc. - stuff like that, I think.

 I suppose technically we do have a limit in the Android world as well,
 because ATT forces some phones to not support applications installed
 from unknown sources. So you have unlimited non-market distribution
 for most phones, but 0 distribution for those ATT phones, heh.

 On Sep 3, 5:59 am, Droid rod...@gmail.com wrote:







  I dont think there is a limit if you just email Apps to people and
  they have ticked install any App button.
  Not sure exactly what you want to do though

  On Sep 1, 8:53 pm, Greg greg.olmst...@gmail.com wrote:

   I want to build an android app and distribute it to a limited number
   of users, without putting the app in the Market. On how many devices
   can I install my app before I have to use the market for distribution?

   Greg

-- 
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: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread tony obrien
Understood (and thanks for the in-depth response !)

I had already run  into (and repaired) the case where I was sitting
around too long.

And so now, I will try the NOTIFICATION route since I successfully use
that elsewhere...

Hopefully I can reawaken the MAIN activity and gather up the STATICs
(and I made them static just for the reason you explain) and have my
UI aspects offer the correct choices to my user.

thanks, again.

On Sep 11, 4:09 pm, Kostya Vasilyev kmans...@gmail.com wrote:
   Tony,

 Android apps are composed of individual components - activities,
 services, broadcast receivers, etc. Their lifetimes are managed by
 Android in response to events that are relevant for a particular type of
 component.

 http://developer.android.com/guide/topics/fundamentals.html#appcomp

 A broadcast receiver getting an event does not mean that some or other
 activity or a service should be started automatically, just because it's
 a component of the same application.

 After all, you wouldn't want all activities declared within your
 application to be invoked at once, right? Same with other component
 types. Each does its own thing, and they are glued together by the code
 you write.

 The issue with debugging a broadcast receiver is that Android limits the
 amount of time that an application can take in its callbacks (broadcast
 receiver's onReceive, activity lifecycle callbacks such as onStart,
 etc.) If you take too long in the debugger, Android kills the process
 thinking it's not responding.

 My suggestion is to add logging calls (using Android's built-in log
 class) to your receiver's onReceive, verify that does get called, and
 take it from there.

 http://developer.android.com/reference/android/util/Log.html

 If you would like to notify the user that an SMS has been received, you
 have two options:

 - Start an activity using Context.startActivity - which is what you seem
 to be trying to do, but which is considered in Android to be bad user
 experience.

 - Use a status bar notification, which would in turn launch the activity
 to show the message:

 http://developer.android.com/guide/topics/ui/notifiers/notifications

 Finally, as for statics - this is a Java thing. Static members are, by
 definition, independent of any particular instance of the class they are
 declared in.

 Hope this helps,
 -- Kostya

 11.09.2010 23:40, tony obrien пишет:



  One more thing ... if I happen to be in the NetBeans IDE /
  Debugger I can be at a breakpoint and (all of a sudden) its been
  knocked out of debugging mode -- i.e. the App really has died

  On Sep 11, 3:37 pm, tony obrientobsourcecode...@gmail.com  wrote:
  Thanks, but I already HAVE such a thing in my Manifest...

  I suppose that my BR intent *could be* lurking while my MAIN dies...
  but then why doesn't the MAIN get REStarted when the BR starts
  updating Main's (static) variables ?  Main is *not* starting and so
  its just as if the SMS was never received...

  any ideas?

  On Sep 11, 3:02 pm, Kostya Vasilyevkmans...@gmail.com  wrote:

     Well, all-you-gotta-do is:
  Register your receiver in the manifest, like so:
  receiver android:name=.YourSmsMessageReceiverClassName
  intent-filter
  action android:name=android.provider.Telephony.SMS_RECEIVED /
  /intent-filter
  /receiver
  ( Taken 
  from:http://developer.android.com/resources/samples/ApiDemos/AndroidManife...
  )
  Receivers declared in the manifest are active all the time, for as long
  as the application is installed (and not disabled in the manifest). You
  don't need to take any kind of special action for them to receive events.
  In the onReceive() method of your broadcast receiver, you are free to do
  whatever you like: such as starting a service to do some kind of
  processing (I actually recommend this).
  The application process will be started by Android as necessary.
  -- Kostya
  11.09.2010 22:25, tony obrien пишет:
  I am hoping someone may respond and say … Well, all-you-gotta-do is
  Blah_Blah…  Is there a way to make the OS not clean me out of
  memory? Is the answer to make the b-receiver a service? And is that
  allowable in Android?
  --
  Kostya Vasilyev -- WiFi Manager + pretty widget 
  --http://kmansoft.wordpress.com

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

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


Re: [android-developers] Re: limited distribution

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 4:19 PM, Greg greg.olmst...@gmail.com wrote:
 Was wondering if there was similar limit for Android.

No limits -- distribute away!

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
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: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread tony obrien
Well, that was a bust ...

I am pretty sure that *my* BR is not getting called... pls check my
work::

This is the Manifest = (assume the correct permissions in that I do
get the SMS when this is working in the foreground)

receiver android:name=.clsSMSRCV
intent-filter
action
android:name=android.provider.Telephony.SMS_RECEIVED /
/intent-filter
/receiver

My MAINACTIVITY declares the BR as so...

  private clsSMSRCV myClsSMSRCV;

and then in the MainActivity.onCreate() ==

 myClsSMSRCV = new clsSMSRCV();


This is the clsSMSRCV definition with the receive override:

public class clsSMSRCV extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
 // I tear apart the SMS message(s) here... and alter Statics for
review outside this routine
}
}


One last thing, I can think of...

Main has a runnable which is essentially monitoring the Statics and so
can then act upon them changing in ClsSMSRCV.

In my last experiment I had the onReceive() try to express a
Notification nuttin happened.



On Sep 11, 4:21 pm, tony obrien tobsourcecode...@gmail.com wrote:
 Understood (and thanks for the in-depth response !)

 I had already run  into (and repaired) the case where I was sitting
 around too long.

 And so now, I will try the NOTIFICATION route since I successfully use
 that elsewhere...

 Hopefully I can reawaken the MAIN activity and gather up the STATICs
 (and I made them static just for the reason you explain) and have my
 UI aspects offer the correct choices to my user.

 thanks, again.

 On Sep 11, 4:09 pm, Kostya Vasilyev kmans...@gmail.com wrote:

    Tony,

  Android apps are composed of individual components - activities,
  services, broadcast receivers, etc. Their lifetimes are managed by
  Android in response to events that are relevant for a particular type of
  component.

 http://developer.android.com/guide/topics/fundamentals.html#appcomp

  A broadcast receiver getting an event does not mean that some or other
  activity or a service should be started automatically, just because it's
  a component of the same application.

  After all, you wouldn't want all activities declared within your
  application to be invoked at once, right? Same with other component
  types. Each does its own thing, and they are glued together by the code
  you write.

  The issue with debugging a broadcast receiver is that Android limits the
  amount of time that an application can take in its callbacks (broadcast
  receiver's onReceive, activity lifecycle callbacks such as onStart,
  etc.) If you take too long in the debugger, Android kills the process
  thinking it's not responding.

  My suggestion is to add logging calls (using Android's built-in log
  class) to your receiver's onReceive, verify that does get called, and
  take it from there.

 http://developer.android.com/reference/android/util/Log.html

  If you would like to notify the user that an SMS has been received, you
  have two options:

  - Start an activity using Context.startActivity - which is what you seem
  to be trying to do, but which is considered in Android to be bad user
  experience.

  - Use a status bar notification, which would in turn launch the activity
  to show the message:

 http://developer.android.com/guide/topics/ui/notifiers/notifications

  Finally, as for statics - this is a Java thing. Static members are, by
  definition, independent of any particular instance of the class they are
  declared in.

  Hope this helps,
  -- Kostya

  11.09.2010 23:40, tony obrien пишет:

   One more thing ... if I happen to be in the NetBeans IDE /
   Debugger I can be at a breakpoint and (all of a sudden) its been
   knocked out of debugging mode -- i.e. the App really has died

   On Sep 11, 3:37 pm, tony obrientobsourcecode...@gmail.com  wrote:
   Thanks, but I already HAVE such a thing in my Manifest...

   I suppose that my BR intent *could be* lurking while my MAIN dies...
   but then why doesn't the MAIN get REStarted when the BR starts
   updating Main's (static) variables ?  Main is *not* starting and so
   its just as if the SMS was never received...

   any ideas?

   On Sep 11, 3:02 pm, Kostya Vasilyevkmans...@gmail.com  wrote:

      Well, all-you-gotta-do is:
   Register your receiver in the manifest, like so:
   receiver android:name=.YourSmsMessageReceiverClassName
   intent-filter
   action android:name=android.provider.Telephony.SMS_RECEIVED /
   /intent-filter
   /receiver
   ( Taken 
   from:http://developer.android.com/resources/samples/ApiDemos/AndroidManife...
   )
   Receivers declared in the manifest are active all the time, for as long
   as the application is installed (and not disabled in the manifest). You
   don't need to take any kind of special action for them to receive 
   events.
   In the onReceive() method of your broadcast receiver, you are free to do
   whatever you like: such as 

Re: [android-developers] Re: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread Kostya Vasilyev

 12.09.2010 0:37, tony obrien пишет:

Well, that was a bust ...

I am pretty sure that*my*  BR is not getting called... pls check my
work::

This is the Manifest =  (assume the correct permissions in that I do
get the SMS when this is working in the foreground)

 receiver android:name=.clsSMSRCV
 intent-filter
 action
android:name=android.provider.Telephony.SMS_RECEIVED /
 /intent-filter
 /receiver

Looks good. Assuming that your tags are nested correctly (receiver 
should be inside application), and that you also have this at the end 
of the manifest, inside manifest:


uses-permission android:name=android.permission.RECEIVE_SMS/

My MAINACTIVITY declares the BR as so...

   private clsSMSRCV myClsSMSRCV;

and then in the MainActivity.onCreate() ==

  myClsSMSRCV = new clsSMSRCV();

No need to do this - Android will instantiate your receiver as 
necessary, and call its onReceive().

This is the clsSMSRCV definition with the receive override:

public class clsSMSRCV extends BroadcastReceiver {

 @Override
 public void onReceive(Context context, Intent intent) {
  // I tear apart the SMS message(s) here... and alter Statics for
review outside this routine
 }
}

Have you tried logging this?

Just a simple

Log.i(clsSMSRCV, Inside onReceive)

would be immensely helpful.


One last thing, I can think of...

Main has a runnable which is essentially monitoring the Statics and so
can then act upon them changing in ClsSMSRCV.

In my last experiment I had the onReceive() try to express a
Notification nuttin happened.


Polling for events is bad - it ties the CPU, uses up the battery, and 
doesn't work when the phone is asleep. You could broadcast an intent 
with your own action string to notify other components of your application.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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

[android-developers] Re: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread tony obrien
Actually I have LOGGING all over the place.

I was able to determine that the SMS Receiver is actually getting
called ... but it has trouble doing the NM.Notify();  (I'm still
trying to decode what *that* error is all about...)

And I have Thread.sleep(lots-o'seconds) and Thread.yeild() in the
runnable so I am being careful regarding your concerns.

What I would REALLY like to do is a startActivity() from inside the
Receiver...   but I don't suppose that's possible? (In my first timid
attempts to do that awhile ago I could not get it to compile, I think
the extends BroadcastReceiever makes the compiler not understand
what startActivity() means.)



On Sep 11, 5:02 pm, Kostya Vasilyev kmans...@gmail.com wrote:
   12.09.2010 0:37, tony obrien пишет: Well, that was a bust ...

  I am pretty sure that*my*  BR is not getting called... pls check my
  work::

  This is the Manifest =  (assume the correct permissions in that I do
  get the SMS when this is working in the foreground)

           receiver android:name=.clsSMSRCV
               intent-filter
                   action
  android:name=android.provider.Telephony.SMS_RECEIVED /
               /intent-filter
           /receiver

 Looks good. Assuming that your tags are nested correctly (receiver
 should be inside application), and that you also have this at the end
 of the manifest, inside manifest:

 uses-permission android:name=android.permission.RECEIVE_SMS/ My 
 MAINACTIVITY declares the BR as so...

         private clsSMSRCV myClsSMSRCV;

  and then in the MainActivity.onCreate() ==

        myClsSMSRCV = new clsSMSRCV();

 No need to do this - Android will instantiate your receiver as
 necessary, and call its onReceive(). This is the clsSMSRCV definition with 
 the receive override:

  public class clsSMSRCV extends BroadcastReceiver {

      �...@override
       public void onReceive(Context context, Intent intent) {
        // I tear apart the SMS message(s) here... and alter Statics for
  review outside this routine
       }
  }

 Have you tried logging this?

 Just a simple

      Log.i(clsSMSRCV, Inside onReceive)

 would be immensely helpful.



  One last thing, I can think of...

  Main has a runnable which is essentially monitoring the Statics and so
  can then act upon them changing in ClsSMSRCV.

  In my last experiment I had the onReceive() try to express a
  Notification nuttin happened.

 Polling for events is bad - it ties the CPU, uses up the battery, and
 doesn't work when the phone is asleep. You could broadcast an intent
 with your own action string to notify other components of your application.

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

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


Re: [android-developers] ListActivity - detecting which view clicked on

2010-09-11 Thread TreKing
On Sat, Sep 11, 2010 at 2:57 PM, dashman erjdri...@gmail.com wrote:

 i'd like to detect whether the user clicked on the image or the text to
 the right.


Then add click listeners to each of those views.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
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] mkdir() fails when min sdk version is 4

2010-09-11 Thread milind
The following code works when I either have no min sdk version
specified in the app manifest or if it's 5 or greater.  But if I set
the min sdk level to 4 (Android 1.6) , it fails to create a
subdirectory in the sdcard.  There is no error.  mkdir() or mkdirs()
just returns false.

String msg;
try {
String theState = Environment.getExternalStorageState();
if (theState.equals(Environment.MEDIA_MOUNTED)) {
File theBasedir =
Environment.getExternalStorageDirectory();
File theSubdir = new File(theBasedir, subdir);
boolean created = theSubdir.mkdirs();
msg = theSubdir.exists() ? Success : Fail;
} else {
msg = Invalid State;
}
} catch (Exception e) {
msg = Error -  + e;
}
System.out.println(msg);

Am I doing something wrong here?  Or is this a bug?  I'd prefer not to
set the target to 2.1 and min version to 1.6.  But right now, I have
to set it to 2.0 for it to work.

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


Re: [android-developers] Re: (EDITED by author) My app gets killed ... but I think I know why now

2010-09-11 Thread Kostya Vasilyev
Tony,

Your receiver is getting called - that's good. Can't comment on
notifications without seeing the code.

There should not be any reason why startActivity from within onReceive
wouldn't work (use the context object that's passed into onReceive to fix
the compile error you mentioned), but I don't think your users are going to
appreciate a window popping up like that.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

12.09.2010 1:10 пользователь tony obrien tobsourcecode...@gmail.com
написал:

Actually I have LOGGING all over the place.

I was able to determine that the SMS Receiver is actually getting
called ... but it has trouble doing the NM.Notify();  (I'm still
trying to decode what *that* error is all about...)

And I have Thread.sleep(lots-o'seconds) and Thread.yeild() in the
runnable so I am being careful regarding your concerns.

What I would REALLY like to do is a startActivity() from inside the
Receiver...   but I don't suppose that's possible? (In my first timid
attempts to do that awhile ago I could not get it to compile, I think
the extends BroadcastReceiever makes the compiler not understand
what startActivity() means.)




On Sep 11, 5:02 pm, Kostya Vasilyev kmans...@gmail.com wrote:
   12.09.2010 0:37, tony obrien ...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers g...

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

Re: [android-developers] mkdir() fails when min sdk version is 4

2010-09-11 Thread Mark Murphy
Do you have the WRITE_EXTERNAL_STORAGE permission?

On Sat, Sep 11, 2010 at 5:24 PM, milind mili...@gmail.com wrote:
 The following code works when I either have no min sdk version
 specified in the app manifest or if it's 5 or greater.  But if I set
 the min sdk level to 4 (Android 1.6) , it fails to create a
 subdirectory in the sdcard.  There is no error.  mkdir() or mkdirs()
 just returns false.

    String msg;
    try {
        String theState = Environment.getExternalStorageState();
        if (theState.equals(Environment.MEDIA_MOUNTED)) {
            File theBasedir =
 Environment.getExternalStorageDirectory();
            File theSubdir = new File(theBasedir, subdir);
            boolean created = theSubdir.mkdirs();
            msg = theSubdir.exists() ? Success : Fail;
        } else {
            msg = Invalid State;
        }
    } catch (Exception e) {
        msg = Error -  + e;
    }
    System.out.println(msg);

 Am I doing something wrong here?  Or is this a bug?  I'd prefer not to
 set the target to 2.1 and min version to 1.6.  But right now, I have
 to set it to 2.0 for it to work.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 2.2 Programming Books: http://commonsware.com/books

-- 
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] Prevent Rotation/change of orientation in a certain tab/activity

2010-09-11 Thread Patrick
Hallo!

My MainActivity (the one that is started by the android application)
is a TabActivity which contains several tabs (which are implemented as
activities as well). In a certain tab/activity I want to prevent the
change of orientation/rotation when the phone is turned. What is the
easiest way to achieve this?

Thanks
Patrick

-- 
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: mkdir() fails when min sdk version is 4

2010-09-11 Thread milind
Actually, I made a mistake.  If I have the uses-sdk in the manifest,
no matter what the value, it fails to create the directory.  I do have
the write_external_storage permission.

The code used to work until I upgraded the SDK to 2.1 I think.  This
used to work till around 2.0 of the sdk.

If I create the directory under data/data using
File basedirectory = getFileStreamPath(basedir);
subdirectory = new File( basedirectory, subdir_0/subdir_1 );
but I don't want the directory to be deleted when the app is
uninstalled.

The manifest file is as under.

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=test.test
  android:versionCode=1
  android:versionName=1.0

uses-sdk android:minSdkVersion=4/
uses-permission-group android:name=android.permission-
group.STORAGE /

application android:icon=@drawable/icon
 android:label=@string/app_name

activity android:name=.Test1
  android:label=@string/app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity

/application

/manifest

On Sep 12, 2:41 am, Mark Murphy mmur...@commonsware.com wrote:
 Do you have the WRITE_EXTERNAL_STORAGE permission?



 On Sat, Sep 11, 2010 at 5:24 PM, milind mili...@gmail.com wrote:
  The following code works when I either have no min sdk version
  specified in the app manifest or if it's 5 or greater.  But if I set
  the min sdk level to 4 (Android 1.6) , it fails to create a
  subdirectory in the sdcard.  There is no error.  mkdir() or mkdirs()
  just returns false.

     String msg;
     try {
         String theState = Environment.getExternalStorageState();
         if (theState.equals(Environment.MEDIA_MOUNTED)) {
             File theBasedir =
  Environment.getExternalStorageDirectory();
             File theSubdir = new File(theBasedir, subdir);
             boolean created = theSubdir.mkdirs();
             msg = theSubdir.exists() ? Success : Fail;
         } else {
             msg = Invalid State;
         }
     } catch (Exception e) {
         msg = Error -  + e;
     }
     System.out.println(msg);

  Am I doing something wrong here?  Or is this a bug?  I'd prefer not to
  set the target to 2.1 and min version to 1.6.  But right now, I have
  to set it to 2.0 for it to work.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android 2.2 Programming Books:http://commonsware.com/books

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


Re: [android-developers] Re: mkdir() fails when min sdk version is 4

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 6:19 PM, milind mili...@gmail.com wrote:
 Actually, I made a mistake.  If I have the uses-sdk in the manifest,
 no matter what the value, it fails to create the directory.  I do have
 the write_external_storage permission.

 The code used to work until I upgraded the SDK to 2.1 I think.  This
 used to work till around 2.0 of the sdk.

Are you sure there are no messages in LogCat?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 2.2 Programming Books: http://commonsware.com/books

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


Re: [android-developers] Re: mkdir() fails when min sdk version is 4

2010-09-11 Thread Dianne Hackborn
On Sat, Sep 11, 2010 at 3:19 PM, milind mili...@gmail.com wrote:

 \   uses-permission-group android:name=android.permission-
 group.STORAGE /


This should be uses-permission

-- 
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, and so won't reply to such e-mails.  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

Re: [android-developers] Re: Can android support more than one sdcard?

2010-09-11 Thread Dianne Hackborn
Well you are totally missing my point.  Of course it would be *nice* to
support an arbitrary number of everything.  To actually ship a product on
time, though, you probably aren't going to be able to do so.

The SD card is an especially good case of this, because it's not just a
matter of adding an API -- you also need to figure out the whole UX around
this, which is fairly non-trivial.

Anyway, done with this thread.

On Sat, Sep 11, 2010 at 1:51 AM, blindfold seeingwithso...@gmail.comwrote:

  A marketing or engineering department that can't accept limitations is an
  organization that will never ship a product.

 When you are a research department you aim to develop new products
 rather than shorten time to market. When even the basic building
 blocks are already highly restrictive it becomes much harder to
 innovate.

 Although this thread is mostly about having a second SD card, your
 comments seem to indicate a general attitude towards and lack of
 interest in generalized API support for enumerating peripherals:

  I'll only support one camera!  Okay.

 Not OK! If one wants to compete on the market one has to look at
 competitors that already sport two cameras, such as a front-facing
 camera. Think many Nokia phones, and Apple's iPhone 4G. (I added
 second camera support to my own Nokia Java MIDlet app back in 2006.)
 Do you want every Android phone manufacturer to invent and develop
 their own proprietary Android API extensions even to just keep up with
 existing functionality elsewhere? You encourage fragmentation!

 Also, please look across platform boundaries as well as look at
 broadening the scope towards gaming devices. What Microsoft is doing
 with Kinect (formerly Natal) involves either a stereo camera or a time-
 of-flight camera. Do you want individual Android device manufacturers
 to create proprietary API extensions here too? Why make it impossible
 to develop an Android counterpart of the Nintendo 3DS by sticking to a
 conventional single camera API, forcing proprietary extensions?

 Thanks!


 The vOICe for Android
 http://www.seeingwithsound.com/android.htm


 On Sep 11, 3:04 am, Dianne Hackborn hack...@android.com wrote:
  On Fri, Sep 10, 2010 at 2:33 PM, Doug Gordon gordo...@gmail.com wrote:
   I am really surprised that the Android design would only account for
   one of anything. In my experience, any time you say we're only going
   to support one of feature X, the marketing or engineering departments
   decide to add another X. In any case, having support for more than
   one is the same as having support for any quantity.
 
  U...  I'll only support one touch screen!  Okay.  I'll only support
 one
  DPAD!  Okay.  I'll only support one CPU!  Okay.  I'll only support one
  graphics accelerator!  Okay.  I'll only support one SIM!  Okay.  I'll
 only
  support one headphone output!  Okay.  I'll only support one camera!
  Okay.
 
  A marketing or engineering department that can't accept limitations is an
  organization that will never ship a product.
 
  (And you don't note all of the complexity that comes from going from 1 to
 2
  -- how is this reflecting in the UI?  How does the user decide where they
  want their stuff to go?  How about telling them how much space is where?
   And now you've got to let them move stuff around.  I can make a good
  argument that multiple SD cards is just intrinsically a crummy user
  experience and should be avoided.  Heck even one SD card significantly
  complicates the UX.)
 
  --
  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, and so won't reply to such e-mails.  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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
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, and so won't reply to such e-mails.  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

Re: [android-developers] does AppWidgetManager.updateAppWidget() need to be called on the UI thread?

2010-09-11 Thread Dianne Hackborn
This is often because you are trying to send too much data over the IPC
(there is a 1MB buffer); are you trying to send over a large or many
bitmaps?

On Sat, Sep 11, 2010 at 8:25 AM, sdphil phil.pellouch...@gmail.com wrote:

 When I make this call, I am getting a   Java Binder   FAILED
 BINDER TRANSACTION !!!

 message in my logging window.  Is this because that call needs to be
 made on the UI thread?

 tia.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
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, and so won't reply to such e-mails.  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

Re: [android-developers] Re: is there a way to implement screenshot functionality in android

2010-09-11 Thread Dianne Hackborn
On Sat, Sep 11, 2010 at 11:51 AM, dadada ytbr...@gmail.com wrote:

 then why can iphone support screen shot but android cannot?


Android relies on the platform for security, rather than people reviewing
and approving apps, so has much more focus on proactively enforcing
security.

-- 
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, and so won't reply to such e-mails.  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

Re: [android-developers] Prevent Rotation/change of orientation in a certain tab/activity

2010-09-11 Thread Sebastián Treu
On Sat, Sep 11, 2010 at 6:58 PM, Patrick patrick.manges...@gmail.com wrote:
 Hallo!

 My MainActivity (the one that is started by the android application)
 is a TabActivity which contains several tabs (which are implemented as
 activities as well). In a certain tab/activity I want to prevent the
 change of orientation/rotation when the phone is turned. What is the
 easiest way to achieve this?

I don't know if it's the easiest. You can prevent an activity of being
restarted by an orientation change by using android:configChanges and
make your way in onConfigurationChanged().

Since you are using a TabActivity, I'm not sure what behaviour you
want to achieve, and to be honest, I don't know much about
TabActivity. But I can think, if posible, to manage the changes in the
tab activity concerning the current activity that is running (the one
you want to rotate you set the android:orientation) so you won't get
the tabs rotated.

But, that's an idea from someone away from a developer-computer right
now, and junior to android development.

-- 
If you want freedom, compile the source.

Sebastián Treu
http://labombiya.com.ar

-- 
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: SQLiteDatabase.update() super slow

2010-09-11 Thread Sheado
Thanks guys! You rock!
Transactions did the trick.

@Mark I'll check out that presentation you mentioned.

I guess I discounted the flash write as being the bottleneck, because
even at a slow 1.5Mbps write speed I expected better performance
(5-10ms) for writing a few hundred bytes.

On Sep 11, 4:14 am, Mark Murphy mmur...@commonsware.com wrote:
 On Fri, Sep 10, 2010 at 10:11 PM, Sheado chad...@gmail.com wrote:
  The issue:
  SQLiteDatabase.update(...) takes anywhere from 30ms to 700ms on a
  simple update (on a Motorola Droid). I'm not sure why there's such a
  huge range in the timing, but despite that it still means that in the
  best case updating one column in 30 rows will take at least one second
  - in the best case! On average updating 30-40 rows is taking me 3-4
  seconds - this is crazy slow - like 1985 computer slow!

 No, it's like flash slow. Please watch Brad Fitzpatrick's Writing
 Zippy Android Apps presentation from the 2010 Google I|O conference.
 He covers this very point.

  I've tried:
  * update(...) with ContentValues
  * update with execSql()
  * add/removing indices on the columns in question

 None of those should have any effect. You're assuming the problem is
 with the CPU. It's not. It is with the flash writes. You need to cut
 down on the number of flash writes.

  Is there anything else I can try to improve performance? For example,
  is there any way to update multiple rows with one statement?

 As the others on this thread pointed out, use transactions. That will
 turn ~30 individual transactions (each with its own set of flash
 write) into one.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
 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


Re: [android-developers] Re: is there a way to implement screenshot functionality in android

2010-09-11 Thread Sebastián Treu
déjà vu?

-- 
If you want freedom, compile the source.

Sebastián Treu
http://labombiya.com.ar

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


Re: [android-developers] Re: SQLiteDatabase.update() super slow

2010-09-11 Thread Mark Murphy
On Sat, Sep 11, 2010 at 7:17 PM, Sheado chad...@gmail.com wrote:
 Thanks guys! You rock!
 Transactions did the trick.

 @Mark I'll check out that presentation you mentioned.

 I guess I discounted the flash write as being the bottleneck, because
 even at a slow 1.5Mbps write speed I expected better performance
 (5-10ms) for writing a few hundred bytes.

You'll find that presentation to be an eye-opener. I know I did.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 3.0.1 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] What unit is used by Toast offset?

2010-09-11 Thread William Ferguson
I want to position a Toast at the bottom of the top View on the
screen.
But I've found that

  myToast.setGravity(Gravity.TOP, 0, topView.getHeight());

Only places the Toast about 1/3 of the way down topView.
Clearly the offset used by Toast is not specified in the same units as
View#height (which is pixels).

So what units is Toast#offset specified in?


William

-- 
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: Ho to take a screenshot of the current activity and email it to a specific email id

2010-09-11 Thread Traveler
If you are using Windows, this should work: The Print Screen key will
copy the screen image to the windows clipboard. Alt Print Screen will
copy the active window to the clipboard. You should be able to past
into an e-mail, or at least paste into an editor like Paint and save
it to a file for insertion into an e-mail.

Jerry

On Sep 10, 1:41 am, DG gujar.dwark...@gmail.com wrote:
 Hello,

 Currently, I am working on an Android application were I have a
 requirement to get a screenshot of current activity on a button click
 and send it to a specific email id.

 I have searched the documentation and did not got any way to get the
 screen shot and add it as the attachment.

 Is there any way in Android SDK to get the screen shot.

 Thanks for Help,
 Dwakresh

-- 
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] HTTP Multipart POST: data + text

2010-09-11 Thread David Tiago
Hello,

I would like to develop an application that uploads an image and some
text data about that image.
To do that, I am trying to create a HTTP Multipart Post, as follows:
[code]
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(servlet address);
FileBody file = new FileBody(new File(image file));
StringBody text = new StringBody(text data);
MultipartEntity reqEntity = new
MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart(myFile, file);
reqEntity.addPart(textData, text);
[/code]

My doubt is: how can I extract those values in the server? I would
like to develop a Servlet to receive and process the post requests. In
this Servlet I would need to extract these values in th request.
Can you help me?
Do you have any sample of server to answer the android multipart
requests?

-- 
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 launch the app from the Web page?

2010-09-11 Thread ls02
I added to the manifest file for the activity to be launched:

intent-filter
action android:name=android.intent.action.VIEW/action
category android:name=android.intent.category.DEFAULT/category
category android:name=android.intent.category.BROWSABLE/category
data android:scheme=my_scheme/
/intent-filter

I load the link in WebView:

mWebView.loadData(a href=\my_scheme://launch_my_app/refresh_all
\Launch App/a, text/html, utf-8);

When I click on the link I get the error -10 The protocol is not
supported in My WebViewClient.OnReceivedError override.

-- 
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 compile a helloworld in AOSP- Entire android source code..!! Couldnt see apk generated.

2010-09-11 Thread mani
I wanted to run a helloworld application with the AOSP and see it in
emulator.
[ Not through Android SDK setup]

I followed the steps in http://source.android.com/source/download.html
and compiled successfully the full code from / directory.

I could see contacts.apk, camera.apk all applications apk in
~/mydroid/out/target/product/generic/system/app.

 I tried two things.


1 - Went to /package/apps folder. Took a helloworld
application( helloworld folder which was created in android-sdk), and
copied a 'Android.mk' file from Launcher2 folder, kept my new name for
application 'LOCAL_PACKAGE_NAME := helloworld'
and placed the folder in packages/app folder and compiled at /.
 I couldnt see .apk file created for helloworld in ~/mydroid/out/
target/product/generic/system/app.

2 - I went to Launcher2 folde /package/apps/Launcher2. I changed the
package name for Launcher2 in packages/app folder in 'Android,mk' file
and compiled at root. I couldnt see a new apk created on the new
packaged name( i gave) under
 ~/mydroid/out/target/product/generic/system/app.

I tried several times with changes in activity names, application
names in manifest.xml file. Nothing reflects.But it is sure, both
helloworld, and change in package name is getting picked up while
compiling. I could see intermediate classes getting created.
~/mydroid/out/target/common/obj/APPS/manifirst_intermediates/src/com/
android/mani-- manifirst is like a helloworld which i created and
run.
~/mydroid/out/target/common/obj/APPS/Launcher2_intermediates/src/com/
android/launcher

Could anyone please share the steps of compiling a simple Helloworld
program in AOSP.?

Thanks,
Mani

-- 
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: mkdir() fails when min sdk version is 4

2010-09-11 Thread milind
Thanks Dianne.

That was it.  It worked as soon as I changed
   uses-permission-group android:name=android.permission-
group.STORAGE /
to
uses-permission
android:name=android.permission.WRITE_EXTERNAL_STORAGE /

I had neither in the old code.  Probably a tightening of specs in
2.1.  I do wonder what the permission group does.  I thought that I
saw that in some old post and used it.  Seems like the correct one
since I assumed it would allow me to read/write/rename/delete files on
the external storage.

Another related question is that the Vibrant has 16 GB as internal
storage.  But that's where the /sdcard directory is.  There is also
another replaceable 2GB MicroSD slot.  If I want to write to that
drive, how do I access it and does Android consider that as external
storage as well?

On Sep 12, 3:36 am, Dianne Hackborn hack...@android.com wrote:
 On Sat, Sep 11, 2010 at 3:19 PM, milind mili...@gmail.com wrote:
  \   uses-permission-group android:name=android.permission-
  group.STORAGE /

 This should be uses-permission

 --
 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, and so won't reply to such e-mails.  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


Re: [android-developers] Re: mkdir() fails when min sdk version is 4

2010-09-11 Thread Dianne Hackborn
On Sat, Sep 11, 2010 at 9:13 PM, milind mili...@gmail.com wrote:

 I had neither in the old code.  Probably a tightening of specs in
 2.1.  I do wonder what the permission group does.  I thought that I
 saw that in some old post and used it.  Seems like the correct one
 since I assumed it would allow me to read/write/rename/delete files on
 the external storage.


There is no uses-permission-group tag.  Permissions are just for declaring
permissions, for help in displaying them to the user.


 Another related question is that the Vibrant has 16 GB as internal
 storage.  But that's where the /sdcard directory is.  There is also
 another replaceable 2GB MicroSD slot.  If I want to write to that
 drive, how do I access it and does Android consider that as external
 storage as well?


The Android SDK currently only supports one external storage, which for
devices with both internal media mountable for USB mass storage and an SD
card should be the internal media.

-- 
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, and so won't reply to such e-mails.  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] java issues in mac and window

2010-09-11 Thread dadada
hi all,


So i opened my android project(from win7 environment) in my mac.

then i have these java problems :

@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub

}



@Override
public void onLocationChanged(Location location) {


@Override
public void onClick(View v)
{



removing those @override notation solve the issues. why is this
happening in the first place?

who is right? mac or window

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