[android-developers] implicit intent launch Activity

2010-01-21 Thread xiaowei guo
hi all:
i found a surprised problem descripted following
 manifest.xml
 application android:icon=@drawable/icon
android:label=@string/app_name

activity android:name=.IntentMainActivity
  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=.CategoryAltertiveActivity
  android:label=CategoryAltertive
intent-filter android:label=alternative
action android:name=edu.lib.altertive /
category android:name=android.intent.category.ALTERNATIVE
/
/intent-filter
/activity
/application

java code :
Intent intent=new Intent();
intent.setAction(edu.lib.altertive);
intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
startActivity(intent);

i got an ActivityNotFoundException,but i have already registered
CategoryAltertiveActivity in manifest.xml ,and by
Intent intent =new Intent(this,CategoryAltertiveActivity.class)
startActivity(intent)
it run normally,and use getPackageManager.queryIntentActivity(intent),return
result which included ActivityInfo of CategoryAltertiveActivity.
 why?
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Andre
Link to my .apk file:

http://rapidshare.com/files/338665093/Asteroids.apk.html

You can use following command to see output from the app:

adb logcat dalvikvm:D Asteroids:D *:S

There is a little issue with gc somewhere during the app init, not
solved yet..., and after this I have no gc calls during the game loop.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Orientation change crash in tab activity with list activity.

2010-01-21 Thread NoraBora
When views with different type have same id and screen orientation
changes,

either
java.lang.ClassCastException: android.view.AbsSavedState$1  or
java.lang.IllegalArgumentException: Wrong state class -- expecting
View State
will occur. (depends on the view's order)

Because View.dispatchRestoreInstanceState() checks id only.

You may wonder why anyone would make views with different type to have
same id.

But it can happen when you use tab activity.

Imagine you have tab activity with two children activity.

Tab1 is ListActivity and Tab2 is ExpandableListActivity.

Both activity have id of @android:id/list but the type of view is
different.

This means we cannot use ListActivity  ExpandableListActivit at the
same in one tab activity.

or can we?

Please correct me if I'm wrong... hopefully :)
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Orientation change crash in tab activity with list activity.

2010-01-21 Thread Mark Murphy
 This means we cannot use ListActivity  ExpandableListActivit at the
 same in one tab activity.

Presumably not, if your analysis is correct, and I suspect it is.

To get the visual effect you want, use ListView and ExpandableListView as
the contents of the tabs, not activities. Then, you can provide them with
unique widget IDs. You will save memory, save CPU time, save battery life,
reduce the odds that you will encounter a StackOverflowException for
having too complicated of a UI, and solve this problem, all at the same
time.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


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

[android-developers] Problem in sending sms

2010-01-21 Thread Nemat
Hi.

I am trying to send sms using SmsManager class.Here is my code:

PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, SMSSender.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(9001100444, null, This is test message, pi,
null);

SMS is sent successfully but it is sent two times on the same phone-
number and aving same content.

I dont get the problem.Can anyone describe me the reason of this
problem.??

Thanks in Advance
Nemat
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 any changes in the child of listview is reflected in its adaptor.

2010-01-21 Thread Manoj
Hi can anybody tell me exactly how can i get the the exact status of
the listview items.(I have used checkbox as the listview item)
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Example on how to use Scroller in an activity

2010-01-21 Thread Sonic..
Hello

I tried googling for any example on how to use Scroller for doing
manual handling of scrolling, but couldn't came across one.

I would be grateful if anyone could please help me out in this, on how
to use a Scroller in an activity.

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

[android-developers] Re: Example on how to use Scroller in an activity

2010-01-21 Thread Manoj
You can add scrollView to your layout and then add what you want to
scroll as a single child to that scrollview.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Access Download Manager DB

2010-01-21 Thread Manjunatha M
Hi,

I want to access Downloads databases in my Activity. But I am seeing a
SecurityException. Even though I added the permission in my Manifest file, I
still see the same crash happening.

Here is the Java Code..

   mDownloadCursor = managedQuery(Downloads.CONTENT_URI,
new String [] {_id, Downloads.COLUMN_TITLE,
Downloads.COLUMN_STATUS,
Downloads.COLUMN_TOTAL_BYTES,
Downloads.COLUMN_CURRENT_BYTES,
Downloads._DATA, Downloads.COLUMN_DESCRIPTION,
Downloads.COLUMN_MIME_TYPE,
Downloads.COLUMN_LAST_MODIFICATION,
Downloads.COLUMN_VISIBILITY},
null, null, null);


I see the following exception.

01-21 14:39:48.817: ERROR/DatabaseUtils(140): Writing exception to parcel
01-21 14:39:48.817: ERROR/DatabaseUtils(140): java.lang.SecurityException:
Permission Denial: reading com.android.providers.downloads.DownloadProvider
uri content://downloads/download from pid=902, uid=10024 requires
android.permission.ACCESS_DOWNLOAD_MANAGER
01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:240)
01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:116)
01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:98)
01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
android.os.Binder.execTransact(Binder.java:287)
01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
dalvik.system.NativeStart.run(Native Method)
01-21 14:39:48.848: DEBUG/AndroidRuntime(902): Shutting down VM
01-21 14:39:48.857: WARN/dalvikvm(902): threadid=3: thread exiting with
uncaught exception (group=0x4001b188)
01-21 14:39:48.857: ERROR/AndroidRuntime(902): Uncaught handler: thread main
exiting due to uncaught exception
01-21 14:39:48.907: ERROR/AndroidRuntime(902): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.my.prefactivity/com.android.browser.BrowserDownloadPage}:
java.lang.SecurityException: Permission Denial: reading
com.android.providers.downloads.DownloadProvider uri
content://downloads/download from pid=902, uid=10024 requires
android.permission.ACCESS_DOWNLOAD_MANAGER
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.os.Handler.dispatchMessage(Handler.java:99)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.os.Looper.loop(Looper.java:123)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.app.ActivityThread.main(ActivityThread.java:4363)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
java.lang.reflect.Method.invokeNative(Native Method)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
java.lang.reflect.Method.invoke(Method.java:521)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
dalvik.system.NativeStart.main(Native Method)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): Caused by:
java.lang.SecurityException: Permission Denial: reading
com.android.providers.downloads.DownloadProvider uri
content://downloads/download from pid=902, uid=10024 requires
android.permission.ACCESS_DOWNLOAD_MANAGER
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.os.Parcel.readException(Parcel.java:1218)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.content.ContentProviderProxy.bulkQuery(ContentProviderNative.java:326)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.content.ContentProviderProxy.query(ContentProviderNative.java:345)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.content.ContentResolver.query(ContentResolver.java:202)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
android.app.Activity.managedQuery(Activity.java:1495)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
com.android.browser.BrowserDownloadPage.onCreate(BrowserDownloadPage.java:74)
01-21 14:39:48.907: ERROR/AndroidRuntime(902): at

[android-developers] How to implement SyncML Device management objects in android

2010-01-21 Thread saikiran n
Hi,
I want to implement SyncML Device management and gone through following
document
http://www.openmobilealliance.org/tech/affiliates/syncml/syncml_dm_std_obj_v11_20020215.pdf
In that they have specified SyncML DM supports 3 types of device management
objects
1 The DevInfo management object
2 The DevDetail management object
3 SyncML DM
The DevInfo object is having the following fields like
DevId-device Id (we can get from android.os.Build)
Man-manufaturer(we can get from android.os.Build)
Mod-model(we can get from android.os.Build)
Lang-Display language(we can get from java.util.Locale)
Dmv-A SyncML device management client version identifier (manufacturer
specified string) (I didn't get information about this)
Bearer- Type of the bearer(I didn't get information about this)
Ext-An optional, internal object, marking up the single branch of the
DevInfo sub tree into
which extensions can be added, permanently or dynamically.(I didn't get
information about this)
Oem-original equipment manufaturer((I didn't get information about this)

How can i get above fields ie Dmv,Ext,Bearer,Oem
How to start implementing device management from scratch
Please give me any suggestion any help is really apriciatable
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

[android-developers] Re: Example on how to use Scroller in an activity

2010-01-21 Thread Sonic..
I know, but then I require to move two seperate layouts horizontally
simultaneously. and these layouts are not child of one parent, so it's
not possible to add them in a single HorizontalScrollView.

It is for this reason that I thought that I need to scroll them
programmatically using Scroller.
Any other way would be welcome.
Thanx

On Jan 21, 2:23 pm, Manoj linkex.ma...@gmail.com wrote:
 You can add scrollView to your layout and then add what you want to
 scroll as a single child to that scrollview.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Example on how to use Scroller in an activity

2010-01-21 Thread skink


On Jan 21, 10:23 am, Manoj linkex.ma...@gmail.com wrote:
 You can add scrollView to your layout and then add what you want to
 scroll as a single child to that scrollview.

hi
Scroller has nothing to do with ScrollView

Scroller is just a thing to simulate some kind of mechanics
(kinetics?)

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

[android-developers] Re: Saving the contents of an array

2010-01-21 Thread free1000
One way could be to use StringTokenizer

Google for the java.util.StringTokenizer java class.

Save your string array by concatenating the contents with eg: a comma
to your prefs string

Then read the string and use StringTokenizer to split the prefs string
using the comma as the token, and load into a string array.


On Jan 21, 4:20 am, Jeffrey jeffisagen...@gmail.com wrote:
 Well, I'm needing to save potentially over 1000 values in about 12 or
 so arrays. I was kind of hoping that there was an easy way to save an
 array and then load it back without having to do a bunch of stuff to
 it. I'm not too experienced with programming so most of my knowledge
 comes from reverse engineering examples I see, and I haven't been able
 to find an example on saving a populated array and re-loading it
 later.

 What would be the best way to go about saving the data, since shared
 preferences can't save a String[] type or an int[] type. If I mush
 them all together into one item I don't know how to separate them
 later.

 On Jan 19, 10:12 pm, schwiz sch...@gmail.com wrote: you could use the 
 xmlSerializer class to write an xml file and sax to
  read it back in

  On Jan 19, 9:23 pm, Charlie Collins charlie.coll...@gmail.com wrote:

   If your array is not too large, I agree with theSmith, using
   SharedPreferences is very easy if you are not sure about how to use
   other data storage approaches. If you store it as a String you could
   then parse it and rebuild the array.

   If you have a lot of data, you might want to go ahead and check out
   using a database. Here is a quick database example I wrote recently,
   in case it helps:http://www.screaming-penguin.com/node/7742.

   Also, here are some examples of writing and reading to 
   files:http://unlocking-android.googlecode.com/svn/chapter5/trunk/FileStorag
   See CreateFile for writing to a file, and ReadFile for reading the
   data back. These are a bit simplified, and the process is pretty raw,
   but the concepts are there.

   HTH

   On Jan 19, 8:25 pm, Jeffrey jeffisagen...@gmail.com wrote:

How do I save the contents of an array to a file and then read it
again later? I have a small amount of data that will need to be stored
and since I have no idea where to start on using a SQLite database, I
think this will work a lot better.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 implement SyncML Device management objects in android

2010-01-21 Thread Miguel Paraz
On Jan 21, 5:26 pm, saikiran n saikiran@gmail.com wrote:
 Bearer- Type of the bearer(I didn't get information about this)

TelephonyManager can give you this.

 Oem-original equipment manufaturer((I didn't get information about this)

I don't think there is a method to get the OEM - even the phone
doesn't know!
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] New AChartEngine release

2010-01-21 Thread Dan Dromereschi
Hi all,

We are proud to announce a new release for the AChartEngine charting
library.
You can download it here: http://code.google.com/p/achartengine/downloads/list

As it is an open-source project (Apache License 2.0), everyone is
welcome to contribute:
  * join the AChartEngine group http://groups.google.com/group/achartengine
  * ask for new features, ideas,...
  * contribute new features and patches

Regards,

Dan
http://www.achartengine.org
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread skink


On Jan 21, 9:22 am, Andre andranik.abra...@gmail.com wrote:
 Link to my .apk file:

 http://rapidshare.com/files/338665093/Asteroids.apk.html

 You can use following command to see output from the app:

 adb logcat dalvikvm:D Asteroids:D *:S

 There is a little issue with gc somewhere during the app init, not
 solved yet..., and after this I have no gc calls during the game loop.

hi,

i got 20-30 fps with average 27

one observation: you have bullet 8x8 px but actual bullet is 2x6, try
to crop it to that size or prepare bitmap of 8x(N*8) with prerotated
bullets, where N is number of possible angles your spaceship can turn
- that way you dont have to rotate your bullets in runtime

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

[android-developers] How to close an application?

2010-01-21 Thread pink 444
Hi,

In my application i have to close the application.

Hence i am using System.exit(1).

But some times it is trying to restart entire application.

What is the problem?

 How can i close an application safely?


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

[android-developers] How to execute Replace command

2010-01-21 Thread saikiran n
Hi,
In SyncML Device management Replace command is used to replace DevInfo or
DeviceDetails
But i don't know how to acheive this.
We can read the DevInfo from android.os.Build API
This is only readable , how to  execute this Replace  command in remote
device management using SyncML.
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

[android-developers] Run application from last Activity/state

2010-01-21 Thread ayanir
Hello,

I have an application with several Activities.
My A Activity has the Manifest Intent filter parameters: action.MAIN
and category.LAUNCHER. after its being loaded I call Activity B and
finish() A since I don't use it anymore.

After I run my application, go from Activity A to B and press the Home
button, when I relaunch it from the applications menu or from the
Market app for ex.(not by a long press on the Home button), it starts
from the A Activity and do not save its last Activity B.

I definitely know that this is possible to relaunch an application
from its last Activity (some application from the Market do support
it) and I think that this can be determined by the Manifest parameters
but I don't know which one.

does anyone know how to implement it so my application can relaunch
from its last Activity B?

Thanks
ayanir

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Access Download Manager DB

2010-01-21 Thread Manjunatha M
is there any work around to test this?? I am not able to push my apk to
/system/app. it says out of memory. Any other way??

On Thu, Jan 21, 2010 at 2:54 PM, Manjunatha M man...@gmail.com wrote:

 Hi,

 I want to access Downloads databases in my Activity. But I am seeing a
 SecurityException. Even though I added the permission in my Manifest file, I
 still see the same crash happening.

 Here is the Java Code..

mDownloadCursor = managedQuery(Downloads.CONTENT_URI,
 new String [] {_id, Downloads.COLUMN_TITLE,
 Downloads.COLUMN_STATUS,
 Downloads.COLUMN_TOTAL_BYTES,
 Downloads.COLUMN_CURRENT_BYTES,
 Downloads._DATA, Downloads.COLUMN_DESCRIPTION,
 Downloads.COLUMN_MIME_TYPE,
 Downloads.COLUMN_LAST_MODIFICATION,
 Downloads.COLUMN_VISIBILITY},
 null, null, null);


 I see the following exception.

 01-21 14:39:48.817: ERROR/DatabaseUtils(140): Writing exception to parcel
 01-21 14:39:48.817: ERROR/DatabaseUtils(140): java.lang.SecurityException:
 Permission Denial: reading com.android.providers.downloads.DownloadProvider
 uri content://downloads/download from pid=902, uid=10024 requires
 android.permission.ACCESS_DOWNLOAD_MANAGER
 01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
 android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:240)
 01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
 android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:116)
 01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
 android.content.ContentProviderNative.onTransact(ContentProviderNative.java:98)
 01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
 android.os.Binder.execTransact(Binder.java:287)
 01-21 14:39:48.817: ERROR/DatabaseUtils(140): at
 dalvik.system.NativeStart.run(Native Method)
 01-21 14:39:48.848: DEBUG/AndroidRuntime(902): Shutting down VM
 01-21 14:39:48.857: WARN/dalvikvm(902): threadid=3: thread exiting with
 uncaught exception (group=0x4001b188)
 01-21 14:39:48.857: ERROR/AndroidRuntime(902): Uncaught handler: thread
 main exiting due to uncaught exception
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): java.lang.RuntimeException:
 Unable to start activity
 ComponentInfo{com.my.prefactivity/com.android.browser.BrowserDownloadPage}:
 java.lang.SecurityException: Permission Denial: reading
 com.android.providers.downloads.DownloadProvider uri
 content://downloads/download from pid=902, uid=10024 requires
 android.permission.ACCESS_DOWNLOAD_MANAGER
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.app.ActivityThread.access$2200(ActivityThread.java:119)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.os.Handler.dispatchMessage(Handler.java:99)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.os.Looper.loop(Looper.java:123)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.app.ActivityThread.main(ActivityThread.java:4363)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 java.lang.reflect.Method.invokeNative(Native Method)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 java.lang.reflect.Method.invoke(Method.java:521)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 dalvik.system.NativeStart.main(Native Method)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): Caused by:
 java.lang.SecurityException: Permission Denial: reading
 com.android.providers.downloads.DownloadProvider uri
 content://downloads/download from pid=902, uid=10024 requires
 android.permission.ACCESS_DOWNLOAD_MANAGER
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.os.Parcel.readException(Parcel.java:1218)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.content.ContentProviderProxy.bulkQuery(ContentProviderNative.java:326)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.content.ContentProviderProxy.query(ContentProviderNative.java:345)
 01-21 14:39:48.907: ERROR/AndroidRuntime(902): at
 android.content.ContentResolver.query(ContentResolver.java:202)
 01-21 

Re: [android-developers] How to close an application?

2010-01-21 Thread Mark Murphy
 In my application i have to close the application.

No, you don't.

 Hence i am using System.exit(1).

Please do not do this.

 But some times it is trying to restart entire application.

 What is the problem?

You are trying to close the application. Please do not do this.

If you want to simply close up an activity, the activity can call finish().

  How can i close an application safely?

You do not need to:

http://stackoverflow.com/questions/2033914/quitting-an-application-is-that-frowned-upon/2034238#2034238

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Access Download Manager DB

2010-01-21 Thread Mark Murphy
 I want to access Downloads databases in my Activity.

You cannot do this from an SDK application.

 But I am seeing a SecurityException.

That is because you cannot do this from an SDK application.

 Even though I added the permission in my Manifest file,
 I
 still see the same crash happening.

That permission (ACCESS_DOWNLOAD_MANAGER) is not in the SDK. It is not
available to SDK applications.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


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

[android-developers] Android 2.1 bug: uses res/layout-v3 instead of res/layout

2010-01-21 Thread Stefan Klumpp
In addition to the general res/layout folder I have a res/layout-v3
folder for backward compatibility with Android 1.5, which has problems
with some RelativeLayouts.

It works perfectly with all phones and emulator versions tested so
far. Except of 2.1 (emulator and Nexus One). They choose to display
the Android 1.5 layout (res/layout-v3) instead of the default res/
layout.

Can anyone else confirm that? Is this an Android OS bug? If so, where
is the best place to submit the bug report?

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: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Andre
Hi skink, thanks for test.

On what device you tested? What FPS you got, when not shooting
bullets?

Yes, I think I should avoid any rotation operation on Canvas...

Best Regards, Andre

On 21 янв, 12:41, skink psk...@gmail.com wrote:
 On Jan 21, 9:22 am, Andre andranik.abra...@gmail.com wrote:

  Link to my .apk file:

 http://rapidshare.com/files/338665093/Asteroids.apk.html

  You can use following command to see output from the app:

  adb logcat dalvikvm:D Asteroids:D *:S

  There is a little issue with gc somewhere during the app init, not
  solved yet..., and after this I have no gc calls during the game loop.

 hi,

 i got 20-30 fps with average 27

 one observation: you have bullet 8x8 px but actual bullet is 2x6, try
 to crop it to that size or prepare bitmap of 8x(N*8) with prerotated
 bullets, where N is number of possible angles your spaceship can turn
 - that way you dont have to rotate your bullets in runtime

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

[android-developers] Accessing google calendar through Android using the given protocol

2010-01-21 Thread Nikhil Agarwal
I need to insert,update,delete events in google calendar using
android. I tried using the gdata calendar protocol directly from
http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html
but I could not go beyond authenticating the user.

I was able to authenticate the user and I extracted the Auth code
using:-

temp1 = EntityUtils.toString(response.getEntity());
if(response.getStatusLine().getStatusCode()==200)
auth = temp1.substring(temp1.indexOf(Auth=)+5).trim
();

After this I tried inserting an event which did not work. I was
getting status code 200 in response and I am not sure even if I did
get a proper response, how can I extract the cookie s and gsessionid
for my next request.

I tried creating a calendar instead and I received the same status
code 200. I used the following code:-

   String messageBody=entry xmlns='http://www.w3.org/2005/Atom'+
xmlns:gd='http://schemas.google.com/g/2005'+
xmlns:gCal='http://schemas.google.com/gCal/2005'+
   title type='text'SMS Invite Schedule/title+
   summary type='text'This calendar contains the practice schedule
and game times./summary+
   gCal:timezone value='Singapore/Asia'/gCal:timezone+
   gCal:hidden value='false'/gCal:hidden+
   gCal:color value='#2952A3'/gCal:color+
   gd:where rel='' label='' valueString='Oakland'/gd:where+
 /entry;
 StringEntity entity =new StringEntity(messageBody);
entity.setContentType(application/atom+xml);
entity.setChunked(true);
httppost.setEntity(entity);
httppost.setHeader(Authorization, GoogleLogin
auth=+auth);
httppost.setHeader(GData-Version, 2);
//httppost.setHeader(Content-Length,String.valueOf
(entity.getContentLength()));
//httppost.setHeader(Content-Type, application/atom
+xml);
HttpResponse response = httpclient.execute(httppost);

As can be seen from the code, I commented Content-Length and Content-
Type as otherwise I would get a ClientProtocolException (content-
length was causing the exception, didn't put content-type since it is
already mentioned in the entity...not sure where it should be
defined).

I am sorry that I don't understand the basics correctly. I did refer
to the apache site for httpclient stuff but it wasn't of much help.
Please help me out with the above problems.  Thank you.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Accessing google calendar through Android using the given protocol

2010-01-21 Thread Nikhil Agarwal
I need to insert,update,delete events in google calendar using
android. I tried using the protocol given at
http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html
but I was unable to go beyond authenticating the user.

I was able to authenticate the user and I extracted the Auth code
using:-
 temp1 = EntityUtils.toString(response.getEntity());
if(response.getStatusLine().getStatusCode()==200)
auth = temp1.substring(temp1.indexOf(Auth=)+5).trim
();

After this I tried inserting an event which did not work. I was
getting status code 200 in response and I am not sure even if I did
get a proper response, how can I extract the cookie s and gsessionid
for my next request.

I tried creating a calendar instead and I received the same status
code 200. I used the following code:-

   String messageBody=entry xmlns='http://www.w3.org/2005/Atom'+
xmlns:gd='http://schemas.google.com/g/2005'+
xmlns:gCal='http://schemas.google.com/gCal/2005'+
   title type='text'ABC Project Schedule/title+
   summary type='text'This calendar.../summary+
   gCal:timezone value='Singapore/Asia'/gCal:timezone+
   gCal:hidden value='false'/gCal:hidden+
   gCal:color value='#2952A3'/gCal:color+
   gd:where rel='' label='' valueString='Oakland'/gd:where+
 /entry;
 StringEntity entity =new StringEntity(messageBody);
entity.setContentType(application/atom+xml);
entity.setChunked(true);
httppost.setEntity(entity);
httppost.setHeader(Authorization, GoogleLogin
auth=+auth);
httppost.setHeader(GData-Version, 2);
//httppost.setHeader(Content-Length,String.valueOf
(entity.getContentLength()));
//httppost.setHeader(Content-Type, application/atom
+xml);
HttpResponse response = httpclient.execute(httppost);

As can be seen from the code, I commented Content-Length and Content-
Type as otherwise I would get a ClientProtocolException (content-
length was causing the exception, didn't put content-type since it is
already mentioned in the entity...not sure where it should be
defined).

I am sorry that I don't understand the basics correctly. I did refer
to the apache site for httpclient stuff but it wasn't of much help.
Please help me out with the above problems. It is very important for
my Android application to have this functionality. Thank you.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Accessing google calendar through Android using the given protocol

2010-01-21 Thread Nikhil Agarwal
I need to insert,update,delete events in google calendar using
android. I tried using the protocol given at
http://code.google.com/apis/calendar/data/2.0/developers_guide_protoc...
but I was unable to go beyond authenticating the user.

I was able to authenticate the user and I extracted the Auth code
using:-
 temp1 = EntityUtils.toString(response.getEntity());
if(response.getStatusLine().getStatusCode()==200)
auth = temp1.substring(temp1.indexOf(Auth=)+5).trim
();

After this I tried inserting an event which did not work. I was
getting status code 200 in response and I am not sure even if I did
get a proper response, how can I extract the cookie s and gsessionid
for my next request.

I tried creating a calendar instead and I received the same status
code 200. I used the following code:-

   String messageBody=entry xmlns='http://www.w3.org/2005/Atom'+
xmlns:gd='http://schemas.google.com/g/2005'+
xmlns:gCal='http://schemas.google.com/gCal/2005'+
   title type='text'ABC Project Schedule/title+
   summary type='text'This calendar.../summary+
   gCal:timezone value='Singapore/Asia'/gCal:timezone+
   gCal:hidden value='false'/gCal:hidden+
   gCal:color value='#2952A3'/gCal:color+
   gd:where rel='' label='' valueString='Lab'/gd:where+
 /entry;
 StringEntity entity =new StringEntity(messageBody);
entity.setContentType(application/atom+xml);
entity.setChunked(true);
httppost.setEntity(entity);
httppost.setHeader(Authorization, GoogleLogin
auth=+auth);
httppost.setHeader(GData-Version, 2);
//httppost.setHeader(Content-Length,String.valueOf
(entity.getContentLength()));
//httppost.setHeader(Content-Type, application/atom
+xml);
HttpResponse response = httpclient.execute(httppost);

As can be seen from the code, I commented Content-Length and Content-
Type as otherwise I would get a ClientProtocolException (content-
length was causing the exception, didn't put content-type since it is
already mentioned in the entity...not sure where it should be
defined).

I am sorry that I don't understand the basics correctly. I did refer
to the apache site for httpclient stuff but it wasn't of much help.
Please help me out with the above problems.  Thank you.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Loop audio from mic to earpiece?

2010-01-21 Thread draf...@gmail.com
Hi all,

I was wondering is it possible with Android to record from the mic and
play the sound back out the earpiece with just a 1 second delay?

I have seen the tutorials and can currently record from the mike and
save a 3gp file to the sd card.

However is it posssible to record and say stream the audio straight to
the ear piece with just a 1 - 2 second delay?

If so how would I go about doing this?

Would I need to record from the mic and save it to a file and then
repaly to the ear piece? and continually do this?

Or would it be possible to record from the mic and stream it directly
to the ear piece with just a slight delay?

Any help, info or directions to tutorials would be greatly
appreciated,

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

[android-developers] Re: Problem in sending sms

2010-01-21 Thread Nikhil Agarwal
Probably your SMSSender.class also sends a SMS. Once SMS is sent, it
will pass an intent to the SMSSender activity.

On Jan 21, 5:02 pm, Nemat nemate...@gmail.com wrote:
 Hi.

 I am trying to send sms using SmsManager class.Here is my code:

 PendingIntent pi = PendingIntent.getActivity(this, 0,
 new Intent(this, SMSSender.class), 0);
 SmsManager sms = SmsManager.getDefault();
 sms.sendTextMessage(9001100444, null, This is test message, pi,
 null);

 SMS is sent successfully but it is sent two times on the same phone-
 number and aving same content.

 I dont get the problem.Can anyone describe me the reason of this
 problem.??

 Thanks in Advance
 Nemat
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread Michael
AudioRecord and AudioTrack are the classes you need.

If you use them in streaming mode then you can pipe data out of
AudioRecord straight into AudioTrack and you should be able to acheive
the desired effect.

I have done something similar, but without the delay.

Mike

On Jan 21, 11:28 am, draf...@gmail.com draf...@gmail.com wrote:
 Hi all,

 I was wondering is it possible with Android to record from the mic and
 play the sound back out the earpiece with just a 1 second delay?

 I have seen the tutorials and can currently record from the mike and
 save a 3gp file to the sd card.

 However is it posssible to record and say stream the audio straight to
 the ear piece with just a 1 - 2 second delay?

 If so how would I go about doing this?

 Would I need to record from the mic and save it to a file and then
 repaly to the ear piece? and continually do this?

 Or would it be possible to record from the mic and stream it directly
 to the ear piece with just a slight delay?

 Any help, info or directions to tutorials would be greatly
 appreciated,

 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

[android-developers] Re: Does any changes in the child of listview is reflected in its adaptor.

2010-01-21 Thread Nikhil Agarwal
I suppose you mean that how can we extract which items are checked.
That can be done using:-
SparseBooleanArray checkedItems = getListView().getCheckedItemPositions
();
You can check each item's state by using its position. So for the 0th
position, use checkedItems.get(0) and check if it is true or false.

On Jan 21, 5:10 pm, Manoj linkex.ma...@gmail.com wrote:
 Hi can anybody tell me exactly how can i get the the exact status of
 the listview items.(I have used checkbox as the listview item)
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread draf...@gmail.com
Hi Mike,

Thanks for the prompt reply.

I was looking at the AudioRecord class but had somehow missed the
AudioTrack class,

thanks for pointing it out.

From looking at the classes I think what I have to do is read the
recording data and put it straight into a streamed
AudioTrack, would I be correct in saying that?

And then is it possible to send it to the earpiece?

Thanks again,

Donal

On Jan 21, 11:36 am, Michael nicholls...@googlemail.com wrote:
 AudioRecord and AudioTrack are the classes you need.

 If you use them in streaming mode then you can pipe data out of
 AudioRecord straight into AudioTrack and you should be able to acheive
 the desired effect.

 I have done something similar, but without the delay.

 Mike

 On Jan 21, 11:28 am, draf...@gmail.com draf...@gmail.com wrote:

  Hi all,

  I was wondering is it possible with Android to record from the mic and
  play the sound back out the earpiece with just a 1 second delay?

  I have seen the tutorials and can currently record from the mike and
  save a 3gp file to the sd card.

  However is it posssible to record and say stream the audio straight to
  the ear piece with just a 1 - 2 second delay?

  If so how would I go about doing this?

  Would I need to record from the mic and save it to a file and then
  repaly to the ear piece? and continually do this?

  Or would it be possible to record from the mic and stream it directly
  to the ear piece with just a slight delay?

  Any help, info or directions to tutorials would be greatly
  appreciated,

  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

[android-developers] Re: How to increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread skink


On Jan 21, 11:54 am, Andre andranik.abra...@gmail.com wrote:
 Hi skink, thanks for test.

 On what device you tested? What FPS you got, when not shooting
 bullets?

 Yes, I think I should avoid any rotation operation on Canvas...

 Best Regards, Andre



a friend of mine tested your apk on his good old g1, but he claims his
g1 is somewhat slow since some time ago

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

[android-developers] Question about background task applications?

2010-01-21 Thread Tom
Is it possible to developp an application which :
- run in background (I know that it's possible with Services)
- is impossible to close or to stop ?

Best Regards
Tom

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Synchronizing AudioTrack and AudioRecord

2010-01-21 Thread Omer Gilad
Hello,
My application uses AudioTrack in streaming mode and AudioRecord
simultaneously.
My problem is that I start them at the same time, but I have no
guarantee that they will actually start playback\recording in the same
timestamp.
The reason I need this kind of accuracy is because I use echo
cancellation (subtracting audio played to speaker from the recording).
My echo canceller doesn't require an exact delay, but the delay
introduced between AudioTrack and AudioRecord moves in the range of
250ms (between different runs), and that's too much - each run is
different because they start themselves asynchronously. The API
doesn't provide me a way to make sure they start in the same time, so
I thought about measuring this starting delay somehow and then using
it in my calculation.
Does anyone have an idea how to do that, utilizing their API or in any
other way?

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

[android-developers] Re: Does any changes in the child of listview is reflected in its adaptor.

2010-01-21 Thread Manoj
Mr. Nikhil can you send me the code to use this method .

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

[android-developers] scanDirectories() using MediaScanner when media files are deleted like BlueTooth?

2010-01-21 Thread skan95
Dear.
If media files are deleted using the BlueTooth, how should I handle
it?
Should scanDirectories() be called?
In the case that new media files are transferred via BT,  scanFile()
is called.
But if media files are deleted, what should be done?
Please let me know the process.

Thanks.
BR.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] MediaScannerConnection and delete media file.

2010-01-21 Thread skan95
Dear

According to MediaScannerConnection,
 * MediaScannerConnection provides a way for applications to pass a
 * newly created or downloaded media file to the media scanner
service.
 * The media scanner service will read metadata from the file and add
 * the file to the media content provider.
 * The MediaScannerConnectionClient provides an interface for the
 * media scanner service to return the Uri for a newly scanned file
 * to the client of the MediaScannerConnection class.

So, I think this class is used for adding media file and getting new
Uri information from media scanner service.

My question is reverse case.
That is, if media files are deleted using like BlueTooth, how should
BT service let media provider know this event?

Please share your information.

Thanks.
Best regards.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread TonyDoc
Hi all, interesting thread, here's my tuppenceworth.

My first attempt at a simple game took the same approach, things
looked favourable when I first threw a few dozen sprites onto the
canvas along with some simple game logic to try and get a handle on
fps and timing. I was getting around 40-45fps which I was happy with,
as my goal was around 30fps for the final game. I then added matrix
transformations to the sprites (scaling and/or rotating) and bang!
20-25fps... I fiddled some more for a while then gave up. I guessed
that without GL hardware acceleration, bitmap transforms just take way
too long. The only solution that I could come up with, was to cache a
whole load of transformed bitmaps prior to game start up, and draw/
swap these 'pre transformed' sprites directly to the canvas without
the use of matrix/rotate etc...

GL is probably the way to go, and biting the bullet might be the only
solution. It's a pity google don't provide a basic example of a 2d GL
game with their SDK, if they did, they might end up with a few more
decent games on the market.


On Jan 20, 7:05 am, Kevin Duffey andjar...@gmail.com wrote:
 Was just watching the video from back in May by Chris Pruett. He had a
 performance slide comparing canvas to opengl and as he noted there, canvas
 is much slower. I am sure you know this, but getting 30fps on a Canvas with
 more than a dozen or so sprites might be difficult when you factor in game
 logic, collision detections, etc. I didn't realize you were running this on
 the emulator as well. For sure you'll see much faster fps on a real device.

 On Tue, Jan 19, 2010 at 10:55 PM, Dan Sherman impact...@gmail.com wrote:
   I run my app on emulator, and currently have
   not tested it on real device.

  The emulator is not, in any way, going to run the same speed as a real
  device.

  Run it on a real device and see what FPS you get.  Or if you want, publish
  an APK and someone here will run it I'm sure (I'll do it =P)

  - Dan

  On Wed, Jan 20, 2010 at 1:44 AM, Andre andranik.abra...@gmail.com wrote:

  Hi,

  Yesterday, I've changed my code, to work with the matrix more
  effectively...

  My GameEntity class now looks like this:

  --GAME ENTITY--

  public class GameEntity {
         public Bitmap mBitmap;
         private Rect mBounds;
         private Matrix mMatrix;
         public int mWidth;
         public int mHeight;
         public boolean mAlive;
         public float mX, mY;
         public float mVelocityX, mVelocityY;
         public float mMoveAngle, mFaceAngle;
         public float mRotationVelocity;

         public GameEntity(Bitmap bitmap) {
                 mBitmap = bitmap;
                 mBounds = new Rect();
                 mMatrix = new Matrix();
                 mWidth = bitmap.getWidth();
                 mHeight = bitmap.getHeight();
                 mAlive = false;
                 mX = 0.0f;
                 mY = 0.0f;
                 mVelocityX = 0.0f;
                 mVelocityY = 0.0f;
                 mMoveAngle = 0.0f;
                 mFaceAngle = 0.0f;
                 mRotationVelocity = 0.0f;
         }

         public void draw(Canvas canvas, float angle) {
                 Matrix m = mMatrix;
                 m.reset();
                 m.postTranslate(mX - mWidth / 2, mY - mHeight / 2);
                 m.postRotate(angle, mX, mY);
                 canvas.drawBitmap(mBitmap, m, null);
         }

          public Rect getBounds() {
                 mBounds.left = (int)(mX - mWidth / 2);
                 mBounds.top = (int)(mY - mHeight / 2);
                 mBounds.right = (int)(mX + mWidth / 2);
                 mBounds.bottom = (int)(mY + mHeight / 2);
                 return mBounds;
         }
  }

  And draw methods in GameView class:

  --GAME VIEW--

  private void drawSpaceship(Canvas canvas) {
          mSpaceship.draw(canvas, mSpaceship.mFaceAngle);
  }

  private void drawAsteroids(Canvas canvas) {
         GameEntity[] asteroids = mAsteroids;
         GameEntity asteroid;
         for(int i = 0; i  MAX_ASTEROIDS; i++) {
                 asteroid = asteroids[i];
                  if(asteroid.mAlive) {
                         asteroid.draw(canvas, asteroid.mMoveAngle);
                  }
         }
  }

  private void drawBullets(Canvas canvas) {
         GameEntity[] bullets = mBullets;
          GameEntity bullet;
         for(int i = 0; i  MAX_BULLETS; i++) {
                 bullet = bullets[i];
                 if(bullet.mAlive) {
                         bullet.draw(canvas, bullet.mMoveAngle + 90);
                 }
         }
  }

  This gives me an extra 4-5 FPS, and now I have ~25 FPS.
  It worth to mention, that I run my app on emulator, and currently have
  not tested it on real device.

  I decide to go little further with testing and commented out
  m.postTranslate() method call, and got +4 FPS, after that I commented
  out m.postRotate(), and got +12-15 FPS, it seems that 

[android-developers] Re: Loop audio from mic to earpiece?

2010-01-21 Thread Michael
Hi Donal,

Yeah if you kick the record off and the play, then you can sit in a
loop reading the data out of Record and putting it into play (on a
thread other than the UI thread of course).

Not 100% sure about the earpiece, but you specify a stream when you
create the AudioTrack and I think a stream encpsulates audio routing
and volume amongst possibly other things.

If you set the stream to STREAM_VOICE_CALL it might come through the
earpiece as this is where a call would be routed, although I guess
that depends on headsets and stuff.

Can anyone clarify if I am right?

Mike

On Jan 21, 11:49 am, draf...@gmail.com draf...@gmail.com wrote:
 Hi Mike,

 Thanks for the prompt reply.

 I was looking at the AudioRecord class but had somehow missed the
 AudioTrack class,

 thanks for pointing it out.

 From looking at the classes I think what I have to do is read the
 recording data and put it straight into a streamed
 AudioTrack, would I be correct in saying that?

 And then is it possible to send it to the earpiece?

 Thanks again,

 Donal

 On Jan 21, 11:36 am, Michael nicholls...@googlemail.com wrote:

  AudioRecord and AudioTrack are the classes you need.

  If you use them in streaming mode then you can pipe data out of
  AudioRecord straight into AudioTrack and you should be able to acheive
  the desired effect.

  I have done something similar, but without the delay.

  Mike

  On Jan 21, 11:28 am, draf...@gmail.com draf...@gmail.com wrote:

   Hi all,

   I was wondering is it possible with Android to record from the mic and
   play the sound back out the earpiece with just a 1 second delay?

   I have seen the tutorials and can currently record from the mike and
   save a 3gp file to the sd card.

   However is it posssible to record and say stream the audio straight to
   the ear piece with just a 1 - 2 second delay?

   If so how would I go about doing this?

   Would I need to record from the mic and save it to a file and then
   repaly to the ear piece? and continually do this?

   Or would it be possible to record from the mic and stream it directly
   to the ear piece with just a slight delay?

   Any help, info or directions to tutorials would be greatly
   appreciated,

   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

[android-developers] Re: Market access on the emulator?

2010-01-21 Thread TonyDoc
Option 1. Get hold of the APK from the developer and install it on
your emulator

Option 2. If the app is unprotected, use a backup utility to copy the
APK off your phone and onto your SD card, then copy it onto the
emulator  install.

Option 3. Make (or google for) an AVD with the market app
installed. ;)

On Jan 20, 7:33 pm, Mark Murphy mmur...@commonsware.com wrote:
    I suppose that there is probably several approaches to dealing with
  the situation at hand but after some quick checks online about it, I
  had conflicting thoughts as to what people were really doing/using.
   If one were to start testing communications with the ContentProviders
  and ContentResolver classes on the Android phone, it would be helpful
  if a couple applications that we would like to interact with could be
  tested through the emulator against our code that we are writing.

 Ask the authors of those applications for an APK to be made available
 outside of the Market.

  Can we not
  download an application from the market onto the emulator and then
  test communicate with the application?

 The emulators do not have the Android Market. If you cannot get the apps
 you want on your emulator, that is those apps' developers fault for not
 offering more places to get their app.

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 Android App Developer Books:http://commonsware.com/books.html
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Custom ClassLoader - Urgent!

2010-01-21 Thread Lior
Hi guys,

I'm trying to replace the class loader with my custom class loader. I
don't want to replace the default functionality, only add new
functionality.

The goal is that every new class instance that calls:
getClass().getResourceAsStream(resName)

will load the requested resource in the way I define in my
CustomClassLoader.

My code contains the following:
ClassLoader classLoader = new CustomClassLoader
(ClassLoaderTestActivity.class.getClassLoader()); // Create my own
class loader with the default class loader as parent.

Thread.currentThread().setContextClassLoader(classLoader); // This is
just for testing

TestClass test = (TestClass)Class.forName(com.test.TestClass, true,
classLoader).newInstance() ;

Since the 'test' TestClass instance is created with reference to the
new class-loader, I'd expect that after this line executes,
test.getClass().getClassLoader() will return an instance of
CustomClassLoader, but I always get the default PathClassLoader
returned.

My only assumption so far is that since my CustomClassLoader only
overrides specific functionality, and the ClassLoader that actually
calls 'defineClass' is the default one, the TestClass instance is
never associated with my ClassLoader.

Any help would be highly appreciated.
Thanks,
Lior
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 close an application?

2010-01-21 Thread pink 444

Thanks for your replay.

And i went through the link , which you specified.

As i understood process will be killed by android only.

 But my question is Why does user has to wait till android closes
particular application, Instead why doesn't user do this?

Instead of waiting till android system cleans all the resources used
by the application , It is more efficient if user able to clean all
the resources used by the application. Especially it is useful in
embedded environment like mobiles.


If you take any game and user does not have any option to close the
game . Then the application has to wait for android system to clean
resources , which are owned by the application. But these type of
applications are not used by the user regularly(Generally Once in a
day or week).





On Jan 21, 3:06 pm, Mark Murphy mmur...@commonsware.com wrote:
      In my application i have to close the application.

 No, you don't.

      Hence i am using System.exit(1).

 Please do not do this.

      But some times it is trying to restart entire application.

      What is the problem?

 You are trying to close the application. Please do not do this.

 If you want to simply close up an activity, the activity can call finish().

       How can i close an application safely?

 You do not need to:

 http://stackoverflow.com/questions/2033914/quitting-an-application-is...

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 Android App Developer Books:http://commonsware.com/books.html
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Forcing a mobile data connection

2010-01-21 Thread Adrian Jackson
I'm working on an app that needs to make certain requests over the
mobile network rather than WiFi, as it relies on data added by the
mobile operator which isn't added when connecting over WiFi.

Searching through the discussions on the subject and the API
documentation, it appears that there is currently no way to achieve
this. Is that really the case? Seems like a fairly major oversight if
so...
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 increase FPS (now ~20, desired ~40-50)

2010-01-21 Thread Andre
Hi TonyDoc,

I agree with you, recently I've started to study Open GL ES...
But I think it worth to know, what limitations exist for Canvas? And
what kind of games can be implemented with Canvas? As we know, thanks
to google, simple 2D games like Snake, Tetris and so on, can be
created without Open GL ES.

Best Regards, Andre

On 21 янв, 16:07, TonyDoc tony...@gmail.com wrote:
 Hi all, interesting thread, here's my tuppenceworth.

 My first attempt at a simple game took the same approach, things
 looked favourable when I first threw a few dozen sprites onto the
 canvas along with some simple game logic to try and get a handle on
 fps and timing. I was getting around 40-45fps which I was happy with,
 as my goal was around 30fps for the final game. I then added matrix
 transformations to the sprites (scaling and/or rotating) and bang!
 20-25fps... I fiddled some more for a while then gave up. I guessed
 that without GL hardware acceleration, bitmap transforms just take way
 too long. The only solution that I could come up with, was to cache a
 whole load of transformed bitmaps prior to game start up, and draw/
 swap these 'pre transformed' sprites directly to the canvas without
 the use of matrix/rotate etc...

 GL is probably the way to go, and biting the bullet might be the only
 solution. It's a pity google don't provide a basic example of a 2d GL
 game with their SDK, if they did, they might end up with a few more
 decent games on the market.

 On Jan 20, 7:05 am, Kevin Duffey andjar...@gmail.com wrote:



  Was just watching the video from back in May by Chris Pruett. He had a
  performance slide comparing canvas to opengl and as he noted there, canvas
  is much slower. I am sure you know this, but getting 30fps on a Canvas with
  more than a dozen or so sprites might be difficult when you factor in game
  logic, collision detections, etc. I didn't realize you were running this on
  the emulator as well. For sure you'll see much faster fps on a real device.

  On Tue, Jan 19, 2010 at 10:55 PM, Dan Sherman impact...@gmail.com wrote:
I run my app on emulator, and currently have
not tested it on real device.

   The emulator is not, in any way, going to run the same speed as a real
   device.

   Run it on a real device and see what FPS you get.  Or if you want, publish
   an APK and someone here will run it I'm sure (I'll do it =P)

   - Dan

   On Wed, Jan 20, 2010 at 1:44 AM, Andre andranik.abra...@gmail.com wrote:

   Hi,

   Yesterday, I've changed my code, to work with the matrix more
   effectively...

   My GameEntity class now looks like this:

   --GAME ENTITY--

   public class GameEntity {
  public Bitmap mBitmap;
  private Rect mBounds;
  private Matrix mMatrix;
  public int mWidth;
  public int mHeight;
  public boolean mAlive;
  public float mX, mY;
  public float mVelocityX, mVelocityY;
  public float mMoveAngle, mFaceAngle;
  public float mRotationVelocity;

  public GameEntity(Bitmap bitmap) {
  mBitmap = bitmap;
  mBounds = new Rect();
  mMatrix = new Matrix();
  mWidth = bitmap.getWidth();
  mHeight = bitmap.getHeight();
  mAlive = false;
  mX = 0.0f;
  mY = 0.0f;
  mVelocityX = 0.0f;
  mVelocityY = 0.0f;
  mMoveAngle = 0.0f;
  mFaceAngle = 0.0f;
  mRotationVelocity = 0.0f;
  }

  public void draw(Canvas canvas, float angle) {
  Matrix m = mMatrix;
  m.reset();
  m.postTranslate(mX - mWidth / 2, mY - mHeight / 2);
  m.postRotate(angle, mX, mY);
  canvas.drawBitmap(mBitmap, m, null);
  }

   public Rect getBounds() {
  mBounds.left = (int)(mX - mWidth / 2);
  mBounds.top = (int)(mY - mHeight / 2);
  mBounds.right = (int)(mX + mWidth / 2);
  mBounds.bottom = (int)(mY + mHeight / 2);
  return mBounds;
  }
   }

   And draw methods in GameView class:

   --GAME VIEW--

   private void drawSpaceship(Canvas canvas) {
   mSpaceship.draw(canvas, mSpaceship.mFaceAngle);
   }

   private void drawAsteroids(Canvas canvas) {
  GameEntity[] asteroids = mAsteroids;
  GameEntity asteroid;
  for(int i = 0; i  MAX_ASTEROIDS; i++) {
  asteroid = asteroids[i];
   if(asteroid.mAlive) {
  asteroid.draw(canvas, asteroid.mMoveAngle);
   }
  }
   }

   private void drawBullets(Canvas canvas) {
  GameEntity[] bullets = mBullets;
   GameEntity bullet;
  for(int i = 0; i  MAX_BULLETS; i++) {
  bullet = bullets[i];
  

[android-developers] Re: Nexus GPS antenna is always active when Use GPS Satellites is checked...

2010-01-21 Thread Alain
I have intermittently the same problem on my Milestone/Droid. The GPS
comes on on its own.
I end up turning off the Use GPS setting to preven the battery from
draining.


On Jan 21, 2:42 am, String sterling.ud...@googlemail.com wrote:
 On Jan 20, 9:21 pm, Richard Schilling richard.rootwirel...@gmail.com
 wrote:

  I may be answering my own question here.  The power control widget had
  the GPS antenna selected to on.  When I turn off the GPS antenna in
  the power control widget, the antenna goes off.

 FYI, the power control widget is simply a shortcut to the Settings
 option for Enable GPS satellites. So this isn't doing anything
 different than in your original post.

 Unless this is an N1 bug (possible, I can't test), the likelihood is
 that you have a poorly-designed app running in the background which is
 consuming the GPS location all the time. It's impossible for us to say
 what app it might be without seeing your phone, though. You'll need to
 look through your installed apps yourself to try to find the culprit.

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

Re: [android-developers] Custom ClassLoader - Urgent!

2010-01-21 Thread Karl Pauls
On Thu, Jan 21, 2010 at 2:50 PM, Lior lior.gon...@gmail.com wrote:
 Hi guys,

 I'm trying to replace the class loader with my custom class loader. I
 don't want to replace the default functionality, only add new
 functionality.

 The goal is that every new class instance that calls:
 getClass().getResourceAsStream(resName)

 will load the requested resource in the way I define in my
 CustomClassLoader.

 My code contains the following:
 ClassLoader classLoader = new CustomClassLoader
 (ClassLoaderTestActivity.class.getClassLoader()); // Create my own
 class loader with the default class loader as parent.

 Thread.currentThread().setContextClassLoader(classLoader); // This is
 just for testing

 TestClass test = (TestClass)Class.forName(com.test.TestClass, true,
 classLoader).newInstance() ;

 Since the 'test' TestClass instance is created with reference to the
 new class-loader, I'd expect that after this line executes,
 test.getClass().getClassLoader() will return an instance of
 CustomClassLoader, but I always get the default PathClassLoader
 returned.

Why would you expect that? Java uses parent delegation first so it
will find the class in the parent and return that one -- hence, its
classloader is the parent.

 My only assumption so far is that since my CustomClassLoader only
 overrides specific functionality, and the ClassLoader that actually
 calls 'defineClass' is the default one, the TestClass instance is
 never associated with my ClassLoader.

yup. as it should be.

 Any help would be highly appreciated.

Well, what is it you want to do? You now have a working classloader
that delegates classloads to its parent. Assuming you only want to
override getResource* then you still need to do that. Otherwise, I'm
missing your problem...

regards,

Karl
 Thanks,
 Lior

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




-- 
Karl Pauls
karlpa...@gmail.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] creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
Hi,

Can i create a package (apk) that has no activities, but only a View?
If yes, what exactly i have to change in the manifest to allow this?

The view will be in package A, and the activity will be in package B.
How can a class in B instantiate the view in A?

Any tips are welcome.

Ps: package A is a library-only and should have no icons displayed at
the applications list.

thanks

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

[android-developers] Re: Android 2.1 bug: uses res/layout-v3 instead of res/layout

2010-01-21 Thread Lance Nanek
The documentation states that version qualifiers are for that version
and higher, not just that version:

http://developer.android.com/guide/practices/screens_support.html#qualifiers
 Resources that are for use only on a specific API Level or higher. For 
 example, if your application is designed to run on both Android 1.5 (API 
 Level 3) and Android 1.6 (API Level 4 and higher), you can use the -v4 
 qualifier to tag any resources that should be excluded when your application 
 is running on Android 1.5 (API Level 3).

Although there are bugs. Android 2.0.0 matches only -v6, for example.

On Jan 21, 5:50 am, Stefan Klumpp stefan.klu...@gmail.com wrote:
 In addition to the general res/layout folder I have a res/layout-v3
 folder for backward compatibility with Android 1.5, which has problems
 with some RelativeLayouts.

 It works perfectly with all phones and emulator versions tested so
 far. Except of 2.1 (emulator and Nexus One). They choose to display
 the Android 1.5 layout (res/layout-v3) instead of the default res/
 layout.

 Can anyone else confirm that? Is this an Android OS bug? If so, where
 is the best place to submit the bug report?

 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] UPnP

2010-01-21 Thread Abhi
Hi,

Need help in understanding how to build UPnP stack in Android? Anyone?

Abhi

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread draf...@gmail.com
Hi Micheal,

Thanks again,

I now have it recording in PCM format from the mic and saving it to
the sd card and then
playing it back through the ear piece.

So I just have to look into how to into piping the AudioRecord
straight into the AuditTrack.

So with the AudioRecord instead of creating a file to save to what
should I look into doing?

And with the AudioTrack, instead of looking for a file to read in what
should I look into doing?

Thanks,
Kind Regards,
Donal

On Jan 21, 1:10 pm, Michael nicholls...@googlemail.com wrote:
 Hi Donal,

 Yeah if you kick the record off and the play, then you can sit in a
 loop reading the data out of Record and putting it into play (on a
 thread other than the UI thread of course).

 Not 100% sure about the earpiece, but you specify a stream when you
 create the AudioTrack and I think a stream encpsulates audio routing
 and volume amongst possibly other things.

 If you set the stream to STREAM_VOICE_CALL it might come through the
 earpiece as this is where a call would be routed, although I guess
 that depends on headsets and stuff.

 Can anyone clarify if I am right?

 Mike

 On Jan 21, 11:49 am, draf...@gmail.com draf...@gmail.com wrote:

  Hi Mike,

  Thanks for the prompt reply.

  I was looking at the AudioRecord class but had somehow missed the
  AudioTrack class,

  thanks for pointing it out.

  From looking at the classes I think what I have to do is read the
  recording data and put it straight into a streamed
  AudioTrack, would I be correct in saying that?

  And then is it possible to send it to the earpiece?

  Thanks again,

  Donal

  On Jan 21, 11:36 am, Michael nicholls...@googlemail.com wrote:

   AudioRecord and AudioTrack are the classes you need.

   If you use them in streaming mode then you can pipe data out of
   AudioRecord straight into AudioTrack and you should be able to acheive
   the desired effect.

   I have done something similar, but without the delay.

   Mike

   On Jan 21, 11:28 am, draf...@gmail.com draf...@gmail.com wrote:

Hi all,

I was wondering is it possible with Android to record from the mic and
play the sound back out the earpiece with just a 1 second delay?

I have seen the tutorials and can currently record from the mike and
save a 3gp file to the sd card.

However is it posssible to record and say stream the audio straight to
the ear piece with just a 1 - 2 second delay?

If so how would I go about doing this?

Would I need to record from the mic and save it to a file and then
repaly to the ear piece? and continually do this?

Or would it be possible to record from the mic and stream it directly
to the ear piece with just a slight delay?

Any help, info or directions to tutorials would be greatly
appreciated,

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] creating activity-less packages

2010-01-21 Thread Mark Murphy
 Can i create a package (apk) that has no activities, but only a View?

Not really.

 How can a class in B instantiate the view in A?

It can't.

 Ps: package A is a library-only and should have no icons displayed at
 the applications list.

Package it as a JAR and include that JAR in B.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread Michael
Hi Donal,

Once you have constructed an AudioRecord instance you can call
startRecording and then you can use the various read methods to pull
the PCM data out.
Likewise once you have constructed an AudioTrack and called play you
can use one of the write methods to push the data you got from
AudioRecord into the play buffer.

Mike

On Jan 21, 3:12 pm, draf...@gmail.com draf...@gmail.com wrote:
 Hi Micheal,

 Thanks again,

 I now have it recording in PCM format from the mic and saving it to
 the sd card and then
 playing it back through the ear piece.

 So I just have to look into how to into piping the AudioRecord
 straight into the AuditTrack.

 So with the AudioRecord instead of creating a file to save to what
 should I look into doing?

 And with the AudioTrack, instead of looking for a file to read in what
 should I look into doing?

 Thanks,
 Kind Regards,
 Donal

 On Jan 21, 1:10 pm, Michael nicholls...@googlemail.com wrote:

  Hi Donal,

  Yeah if you kick the record off and the play, then you can sit in a
  loop reading the data out of Record and putting it into play (on a
  thread other than the UI thread of course).

  Not 100% sure about the earpiece, but you specify a stream when you
  create the AudioTrack and I think a stream encpsulates audio routing
  and volume amongst possibly other things.

  If you set the stream to STREAM_VOICE_CALL it might come through the
  earpiece as this is where a call would be routed, although I guess
  that depends on headsets and stuff.

  Can anyone clarify if I am right?

  Mike

  On Jan 21, 11:49 am, draf...@gmail.com draf...@gmail.com wrote:

   Hi Mike,

   Thanks for the prompt reply.

   I was looking at the AudioRecord class but had somehow missed the
   AudioTrack class,

   thanks for pointing it out.

   From looking at the classes I think what I have to do is read the
   recording data and put it straight into a streamed
   AudioTrack, would I be correct in saying that?

   And then is it possible to send it to the earpiece?

   Thanks again,

   Donal

   On Jan 21, 11:36 am, Michael nicholls...@googlemail.com wrote:

AudioRecord and AudioTrack are the classes you need.

If you use them in streaming mode then you can pipe data out of
AudioRecord straight into AudioTrack and you should be able to acheive
the desired effect.

I have done something similar, but without the delay.

Mike

On Jan 21, 11:28 am, draf...@gmail.com draf...@gmail.com wrote:

 Hi all,

 I was wondering is it possible with Android to record from the mic and
 play the sound back out the earpiece with just a 1 second delay?

 I have seen the tutorials and can currently record from the mike and
 save a 3gp file to the sd card.

 However is it posssible to record and say stream the audio straight to
 the ear piece with just a 1 - 2 second delay?

 If so how would I go about doing this?

 Would I need to record from the mic and save it to a file and then
 repaly to the ear piece? and continually do this?

 Or would it be possible to record from the mic and stream it directly
 to the ear piece with just a slight delay?

 Any help, info or directions to tutorials would be greatly
 appreciated,

 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

[android-developers] Bitmap formats

2010-01-21 Thread Neil
There are several bitmap formats:
ALPHA_8, ARGB_, ARGB_ and RGB_565
but where are they described?
How am I supposed to know which one to use?

Regards

Neil
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread Donal Rafferty
Really sorry to keep annoying you Micheal, head just doesn't seem to be
functioning properly today.

I currenlty have the AudiRecord buffer set up like this:

static final int bufferSize = 8;
final short[] buffer = new short[bufferSize];
short[] readBuffer = new short[bufferSize];

File file = new File(Environment.getExternalStorageDirectory
  ().getAbsolutePath() + /record.pcm);

OutputStream os = new FileOutputStream(file);
 BufferedOutputStream bos = new BufferedOutputStream(os);
 DataOutputStream dos = new DataOutputStream(bos);

So that sets up to buffer to the file record.pcm and the AudioRecord.read()
methos is as follows:

 int bufferReadResult = audioRecord.read(readBuffer, 0,bufferSize);

for (int i = 0; i  bufferSize; i++)
buffer[i] = readBuffer[i];
for (int i = 0; i  bufferReadResult; i++)
  dos.writeShort(buffer[i]);

So it ends up reading to the file that way, so instead of the OutputStream
os being set
to a FileOutputStream do I set it to something else? and then add the
OutputStream to
a BufferedOutputStream and then that to DaraOutPutStream?

Or does buffer[i] hold exactly what I need and I just need to get whats in
buffer[i] to
the AudioTrack?

Thanks again and sorry to be so much hassle





On Thu, Jan 21, 2010 at 3:19 PM, Michael nicholls...@googlemail.com wrote:

 Hi Donal,

 Once you have constructed an AudioRecord instance you can call
 startRecording and then you can use the various read methods to pull
 the PCM data out.
 Likewise once you have constructed an AudioTrack and called play you
 can use one of the write methods to push the data you got from
 AudioRecord into the play buffer.

 Mike

 On Jan 21, 3:12 pm, draf...@gmail.com draf...@gmail.com wrote:
  Hi Micheal,
 
  Thanks again,
 
  I now have it recording in PCM format from the mic and saving it to
  the sd card and then
  playing it back through the ear piece.
 
  So I just have to look into how to into piping the AudioRecord
  straight into the AuditTrack.
 
  So with the AudioRecord instead of creating a file to save to what
  should I look into doing?
 
  And with the AudioTrack, instead of looking for a file to read in what
  should I look into doing?
 
  Thanks,
  Kind Regards,
  Donal
 
  On Jan 21, 1:10 pm, Michael nicholls...@googlemail.com wrote:
 
   Hi Donal,
 
   Yeah if you kick the record off and the play, then you can sit in a
   loop reading the data out of Record and putting it into play (on a
   thread other than the UI thread of course).
 
   Not 100% sure about the earpiece, but you specify a stream when you
   create the AudioTrack and I think a stream encpsulates audio routing
   and volume amongst possibly other things.
 
   If you set the stream to STREAM_VOICE_CALL it might come through the
   earpiece as this is where a call would be routed, although I guess
   that depends on headsets and stuff.
 
   Can anyone clarify if I am right?
 
   Mike
 
   On Jan 21, 11:49 am, draf...@gmail.com draf...@gmail.com wrote:
 
Hi Mike,
 
Thanks for the prompt reply.
 
I was looking at the AudioRecord class but had somehow missed the
AudioTrack class,
 
thanks for pointing it out.
 
From looking at the classes I think what I have to do is read the
recording data and put it straight into a streamed
AudioTrack, would I be correct in saying that?
 
And then is it possible to send it to the earpiece?
 
Thanks again,
 
Donal
 
On Jan 21, 11:36 am, Michael nicholls...@googlemail.com wrote:
 
 AudioRecord and AudioTrack are the classes you need.
 
 If you use them in streaming mode then you can pipe data out of
 AudioRecord straight into AudioTrack and you should be able to
 acheive
 the desired effect.
 
 I have done something similar, but without the delay.
 
 Mike
 
 On Jan 21, 11:28 am, draf...@gmail.com draf...@gmail.com
 wrote:
 
  Hi all,
 
  I was wondering is it possible with Android to record from the
 mic and
  play the sound back out the earpiece with just a 1 second delay?
 
  I have seen the tutorials and can currently record from the mike
 and
  save a 3gp file to the sd card.
 
  However is it posssible to record and say stream the audio
 straight to
  the ear piece with just a 1 - 2 second delay?
 
  If so how would I go about doing this?
 
  Would I need to record from the mic and save it to a file and
 then
  repaly to the ear piece? and continually do this?
 
  Or would it be possible to record from the mic and stream it
 directly
  to the ear piece with just a slight delay?
 
  Any help, info or directions to tutorials would be greatly
  appreciated,
 
  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] Re: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
Hi,

Thanks for the reply. Is there a way to prevent the application list
from displaying an apk?

I'll try to do another approach: use shareUserId and using two
activities, one calling the other. Once (if) i succeed, i'll post the
results here to help others.

guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Display TextFile

2010-01-21 Thread TreKing
On Wed, Jan 20, 2010 at 8:35 PM, perumal316 perumal...@gmail.com wrote:

 Suppose I have a text file in /data folder, is there any way I can
 display the textfile to user through an app?


Sure. If you want to do this yourself, just read the contents of the file
and dump it to a TextView or something you can show in an Activity or a
Dialog.

If you want to use a separate app, create an Intent with a URI created from
the path to the file and call startActivity with that Intent. The user can
then choose which app to use to open the file, of the ones that are capable
of handling that file type.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Google Map retains the reference to the context of the enclosing activity?

2010-01-21 Thread Katsiaryna
Still no luck. Seems I should report it as a bug...

On Jan 15, 6:27 pm, Katsiaryna katsiaryna.nali...@ndrc.ie wrote:
 Hello All,

 I am trying to get rid of the memory leaks in my application. The
 structure of the application is as follows: the main tab activity
 includes several other activities as its tabs, one of these child
 activities contains a map view to display a standard Google map.

 I noticed that after the application is restarted a copy of the main
 activity (and all its children) is created, so, of course, the memory
 is consumed very quickly. By memory profiling I eliminated several
 long-lived pointers to my activities. However, according to the
 profiling data, one last pointer is retained by the map with the
 following path to garbage collection:

 my tab activity @
 0x4323c2f0
 '- mParent my child activity with map   @
 0x4324c788
    '- context com.google.common.io.android.AndroidPersistentStore @
 0x43250180
       '- store com.google.googlenav.map.MapFlashService @
 0x43263d70
          '- flashService com.google.googlenav.map.MapService @
 0x43263158
             |- Java Local, target java.lang.Thread @ 0x4326cf00
 MapService Thread
             |- mapService com.google.googlenav.map.Map @
 0x43262538

 So it seems that the map service is keeping the pointer to my activity
 in order to use its persistent store, and this pointer is not released
 after the activity, to which it refers, is destroyed. Is this the
 intended behavior of the map service? Also, is it possible to release
 this pointer somehow to allow the garbage collector to recycle the
 activity?

 Thanks in advance for your suggestions!

 ---
 Best regards,
 Katsiaryna
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 close an application?

2010-01-21 Thread Mark Murphy
 As i understood process will be killed by android only.

Correct.

  But my question is Why does user has to wait till android closes
 particular application, Instead why doesn't user do this?

Does the user close each Web page in their Web browser when navigating a
Web site? Or do they just click on links?

 Instead of waiting till android system cleans all the resources used
 by the application , It is more efficient if user able to clean all
 the resources used by the application.

It would be more efficient if users would manually delete each Web page
when they are done viewing it. Amazingly enough, mankind has survived well
over a decade of Web use without this feature.

You are, of course, welcome to write your own Web browser that forces
people to close each Web page when they are done viewing it, so the
browser can release cached information about that page (HTML, JS, CSS,
images). That would be more efficient than existing browsers. And there
may even be a market for that browser. However, I expect more people will
stick with the existing model, because it is easier to use.

Similarly, the core Android team is making a bet that users will prefer an
OS that handles app cleanup itself, rather than one that forces a
single-process paradigm or one that forces users to have to clean up all
apps themselves.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread Mark Murphy
 Thanks for the reply. Is there a way to prevent the application list
 from displaying an apk?

No. That would be a security violation.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Question about background task applications?

2010-01-21 Thread Mark Murphy
 Is it possible to developp an application which :
 - run in background (I know that it's possible with Services)
 - is impossible to close or to stop ?

No. Users can always stop background services using the Settings application.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] activity stack issue :help please

2010-01-21 Thread Sudeep Sharma
Hi,
  I am seeing an issue regarding Activity stack .

 Suppose i launch dialler app from Home screen and exit from it. After that
i go to Settings---Call Settings--Operator Selection and then press the
back key.

Instead of seeing the CallSettings activity dialler app is activity is
shown.

From the logs i see that resume of dialler app is called somehow and thats
why dialler apps comes first and now if i press back again then i can see
Call Settings Activity.

Can anyone tell me what can be wrong here.


Regards,
Sudeep.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Intent filter for text/calendar ?

2010-01-21 Thread jarkman
I've been trying (and failing) to write an intent filter which will
allow my app to handle text/calendar attachments received in the
GMail or email apps

I don't really know if my failure is because the mail apps are just
not looking for apps to handle these attachments, or if I am getting
the intent filter wrong.

And I realise that the MIME types I see in sample intent filters are
always vnd.android.something, not regular text/something types, which
makes me wonder if intent filters just don't work on anything that
doesn't have a provider.

So, what's the story ? Here's my current attempt:

intent-filter
action android:name=android.intent.action.VIEW /
action android:name=android.intent.action.EDIT /
action android:name=android.intent.action.PICK /
category
android:name=android.intent.category.DEFAULT /
category
android:name=android.intent.category.ALTERNATIVE /
data android:mimeType=text/calendar /
/intent-filter

Thanks,

Richard
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
Well... Very strange that Android doesn't support the creation of
application libraries...

I putted this in the xml:

  android:sharedUserId=totalcross

But when i run, i get INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID

Seems that it is not correctly formed... any tips of a valid shared
user id?

thanks

guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread Diego Torres Milano
Both must be signed with the same signature.

On Jan 21, 5:40 pm, guiha...@gmail.com guiha...@gmail.com wrote:
 Well... Very strange that Android doesn't support the creation of
 application libraries...

 I putted this in the xml:

       android:sharedUserId=totalcross

 But when i run, i get INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID

 Seems that it is not correctly formed... any tips of a valid shared
 user id?

 thanks

     guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 close an application?

2010-01-21 Thread Vladimir
But my question is Why does user has to wait till android closes
particular application, Instead why doesn't user do this?

Because this is how it is done in Android. If you change it, users
will get confused and eventually annoyed.

On Jan 21, 3:58 pm, pink 444 pnk...@gmail.com wrote:
 Thanks for your replay.

 And i went through the link , which you specified.

 As i understood process will be killed by android only.

  But my question is Why does user has to wait till android closes
 particular application, Instead why doesn't user do this?

 Instead of waiting till android system cleans all the resources used
 by the application , It is more efficient if user able to clean all
 the resources used by the application. Especially it is useful in
 embedded environment like mobiles.

 If you take any game and user does not have any option to close the
 game . Then the application has to wait for android system to clean
 resources , which are owned by the application. But these type of
 applications are not used by the user regularly(Generally Once in a
 day or week).

 On Jan 21, 3:06 pm, Mark Murphy mmur...@commonsware.com wrote:



       In my application i have to close the application.

  No, you don't.

       Hence i am using System.exit(1).

  Please do not do this.

       But some times it is trying to restart entire application.

       What is the problem?

  You are trying to close the application. Please do not do this.

  If you want to simply close up an activity, the activity can call finish().

        How can i close an application safely?

  You do not need to:

 http://stackoverflow.com/questions/2033914/quitting-an-application-is...

  --
  Mark Murphy (a Commons Guy)http://commonsware.com
  Android App Developer Books:http://commonsware.com/books.html
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Junit testing on Android

2010-01-21 Thread Loki117
Morning all,

I am currently setting up a number of JUnit tests to get some decent
coverage of my applications.

I have noticed that Android does not seem to produce XML output files
for the JUnit tests run on device I understand that if I like I can
export them via eclipse however this is not an option for me as these
tests will eventually be automated in some form of CI implementation.

Can anyone tell me is it possible to have the tests produce an XML
document onto the device which I can at least use a pull command for?

Tom
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Doc of java.util.Formatter. %$ available or not?

2010-01-21 Thread Diego Torres Milano
Use:

String.format(It is %d and %d again!, 10)


On Jan 21, 3:37 am, Farproc farp...@gmail.com wrote:
 http://d.android.com/reference/java/util/Formatter.html
 In the doc above there is The two characters $ immediately following
 the % sign indicate that the previous value should be used again
 instead of moving on to the next value argument.
 I tested it as String.format(It is %d and %$ again!, 10) but it
 throws. Any idea?
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
I thought that the debugging signature (which is the same for all
applications) would work... since i'm using the emulator.

thx

   guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread Michael
Hi Donal,

I have pulled together some of my code to form an example. I have no
idea if this code would compile, but it should be pretty close and
should serve as an example to get you going.



android.os.Process.setThreadPriority
(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);

int buffersize = AudioRecord.getMinBufferSize(11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);

AudioRecord arec = new 
AudioRecord(MediaRecorder.AudioSource.MIC,
11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
buffersize);

AudioTrack atrack = new AudioTrack(AudioManager.STREAM_MUSIC,
11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
ba.size(),
AudioTrack.MODE_STREAMING);

atrack.setPlaybackRate(11025);

byte[] buffer = new byte[buffersize];
arec.startRecording();
atrack.play();

while(isRecording) {
arec.read(buffer, 0, buffersize);
try {
atrack.write(buffer, 0, buffer.size());
} catch (IOException e) {

e.printStackTrace();
}
}

arec.stop();
atrack.stop();

This sets up an AudioRecord and an AudioTrack, tells the one to record
and the other to play. You then have the while loop which reads the
data out of the record and writes it to the play. This should
reproduce the microphone audio as output for you (the code above will
most likely put it out the speaker, play with the stream in the
AudioTrack constructor for earpiece).

You will need to run this code on a seperate thread and control the
lifetime of the thread using the isRecording boolean.
The first line elevates the thread to a higher priority, this may or
may not be correct, so you should play with it and see.
As for your delay, you may need to increase your buffer sizes to hold
a few seconds worth of data and then just write the data to the
AudioTrack later to create the delay.

Oh and watch for feedback if the sound does come out of the speaker as
it can be exponential if it's loud. You can always call:

setVolumeControlStream(AudioManager.STREAM_MUSIC);

from your activity and just make sure you pass the same stream as the
one you pass to AudioTrack and your volume control will control the
volume of that stream, enabling you to turn it down ;-)

Hope that helps,
Mike

On Jan 21, 3:49 pm, Donal Rafferty draf...@gmail.com wrote:
 Really sorry to keep annoying you Micheal, head just doesn't seem to be
 functioning properly today.

 I currenlty have the AudiRecord buffer set up like this:

 static final int bufferSize = 8;
 final short[] buffer = new short[bufferSize];
 short[] readBuffer = new short[bufferSize];

 File file = new File(Environment.getExternalStorageDirectory
       ().getAbsolutePath() + /record.pcm);

 OutputStream os = new FileOutputStream(file);
  BufferedOutputStream bos = new BufferedOutputStream(os);
  DataOutputStream dos = new DataOutputStream(bos);

 So that sets up to buffer to the file record.pcm and the AudioRecord.read()
 methos is as follows:

      int bufferReadResult = audioRecord.read(readBuffer, 0,bufferSize);

                             for (int i = 0; i  bufferSize; i++)
                                 buffer[i] = readBuffer[i];
                             for (int i = 0; i  bufferReadResult; i++)
                               dos.writeShort(buffer[i]);

 So it ends up reading to the file that way, so instead of the OutputStream
 os being set
 to a FileOutputStream do I set it to something else? and then add the
 OutputStream to
 a BufferedOutputStream and then that to DaraOutPutStream?

 Or does buffer[i] hold exactly what I need and I just need to get whats in
 buffer[i] to
 the AudioTrack?

 Thanks again and sorry to be so much hassle

 On Thu, Jan 21, 2010 at 3:19 PM, Michael nicholls...@googlemail.com wrote:
  Hi Donal,

  Once you have constructed an AudioRecord instance you can call
  startRecording and then you can use the various read methods to pull
  the PCM data out.
  Likewise once you have constructed an AudioTrack and called play you
  can use one of the write methods to push the data you got from
  AudioRecord into the play buffer.

  Mike

  On Jan 21, 3:12 pm, draf...@gmail.com draf...@gmail.com wrote:
   Hi Micheal,

   Thanks again,

   I now have it recording in PCM format from the mic and saving it to
   the sd card and then
   playing it back through the ear piece.

   So I 

Re: [android-developers] Re: creating activity-less packages

2010-01-21 Thread Mark Murphy

 I thought that the debugging signature (which is the same for all
 applications) would work... since i'm using the emulator.

Hmmm...

If you have not done so already, fully uninstall both apps, then try
installing them. If you have been upgrading in place, it may not apply the
new user ID.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Intent filter for text/calendar ?

2010-01-21 Thread Mark Murphy
 I've been trying (and failing) to write an intent filter which will
 allow my app to handle text/calendar attachments received in the
 GMail or email apps

 I don't really know if my failure is because the mail apps are just
 not looking for apps to handle these attachments, or if I am getting
 the intent filter wrong.

 And I realise that the MIME types I see in sample intent filters are
 always vnd.android.something, not regular text/something types, which
 makes me wonder if intent filters just don't work on anything that
 doesn't have a provider.

 So, what's the story ? Here's my current attempt:

 intent-filter
 action android:name=android.intent.action.VIEW /
 action android:name=android.intent.action.EDIT /
 action android:name=android.intent.action.PICK /
 category
 android:name=android.intent.category.DEFAULT /
 category
 android:name=android.intent.category.ALTERNATIVE /
 data android:mimeType=text/calendar /
 /intent-filter

In answer to your one question, you definitely can (and should) use
real-world MIME types here when they are available. Most samples are using
fake sorts of data and therefore use equally fake MIME types.

You don't really describe the nature of the failure. What specifically is
happening when you try to view one of these attachments.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
Hi,

I used the option wipe user data and tried to reinstall the package.
The problem occurs with the very first installed package using the id.
In other words: the emulator if fully clean, and when i try to install
the first package, the error occurs. It occurs with all packages i try
to install with this id.

thanks

guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
Also, i just tried to sign with another key and it gives the same
result:

R:\adb install tcvm-android.apk
914 KB/s (614355 bytes in 0.656s)
pkg: /data/local/tmp/tcvm-android.apk
Failure [INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID]

guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread Donal Rafferty
Thanks Mike,

Your a legend, have that working now,

I owe you a pint!

Many thanks,
Regards,
Donal

On Thu, Jan 21, 2010 at 5:02 PM, Michael nicholls...@googlemail.com wrote:

 Hi Donal,

 I have pulled together some of my code to form an example. I have no
 idea if this code would compile, but it should be pretty close and
 should serve as an example to get you going.



android.os.Process.setThreadPriority
 (android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);

int buffersize = AudioRecord.getMinBufferSize(11025,
 AudioFormat.CHANNEL_CONFIGURATION_MONO,
 AudioFormat.ENCODING_PCM_16BIT);

AudioRecord arec = new
 AudioRecord(MediaRecorder.AudioSource.MIC,
11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
buffersize);

AudioTrack atrack = new
 AudioTrack(AudioManager.STREAM_MUSIC,
11025,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT,
ba.size(),
AudioTrack.MODE_STREAMING);

atrack.setPlaybackRate(11025);

byte[] buffer = new byte[buffersize];
arec.startRecording();
atrack.play();

while(isRecording) {
arec.read(buffer, 0, buffersize);
try {
atrack.write(buffer, 0, buffer.size());
} catch (IOException e) {

e.printStackTrace();
}
}

arec.stop();
atrack.stop();

 This sets up an AudioRecord and an AudioTrack, tells the one to record
 and the other to play. You then have the while loop which reads the
 data out of the record and writes it to the play. This should
 reproduce the microphone audio as output for you (the code above will
 most likely put it out the speaker, play with the stream in the
 AudioTrack constructor for earpiece).

 You will need to run this code on a seperate thread and control the
 lifetime of the thread using the isRecording boolean.
 The first line elevates the thread to a higher priority, this may or
 may not be correct, so you should play with it and see.
 As for your delay, you may need to increase your buffer sizes to hold
 a few seconds worth of data and then just write the data to the
 AudioTrack later to create the delay.

 Oh and watch for feedback if the sound does come out of the speaker as
 it can be exponential if it's loud. You can always call:

setVolumeControlStream(AudioManager.STREAM_MUSIC);

 from your activity and just make sure you pass the same stream as the
 one you pass to AudioTrack and your volume control will control the
 volume of that stream, enabling you to turn it down ;-)

 Hope that helps,
 Mike

 On Jan 21, 3:49 pm, Donal Rafferty draf...@gmail.com wrote:
  Really sorry to keep annoying you Micheal, head just doesn't seem to be
  functioning properly today.
 
  I currenlty have the AudiRecord buffer set up like this:
 
  static final int bufferSize = 8;
  final short[] buffer = new short[bufferSize];
  short[] readBuffer = new short[bufferSize];
 
  File file = new File(Environment.getExternalStorageDirectory
().getAbsolutePath() + /record.pcm);
 
  OutputStream os = new FileOutputStream(file);
   BufferedOutputStream bos = new BufferedOutputStream(os);
   DataOutputStream dos = new DataOutputStream(bos);
 
  So that sets up to buffer to the file record.pcm and the
 AudioRecord.read()
  methos is as follows:
 
   int bufferReadResult = audioRecord.read(readBuffer, 0,bufferSize);
 
  for (int i = 0; i  bufferSize; i++)
  buffer[i] = readBuffer[i];
  for (int i = 0; i  bufferReadResult; i++)
dos.writeShort(buffer[i]);
 
  So it ends up reading to the file that way, so instead of the
 OutputStream
  os being set
  to a FileOutputStream do I set it to something else? and then add the
  OutputStream to
  a BufferedOutputStream and then that to DaraOutPutStream?
 
  Or does buffer[i] hold exactly what I need and I just need to get whats
 in
  buffer[i] to
  the AudioTrack?
 
  Thanks again and sorry to be so much hassle
 
  On Thu, Jan 21, 2010 at 3:19 PM, Michael nicholls...@googlemail.com
 wrote:
   Hi Donal,
 
   Once you have constructed an AudioRecord instance you can call
   startRecording and then you can use the various read methods to pull
   the PCM data out.
   Likewise once you have constructed an AudioTrack and called play you
   can use one of the write methods to push the data you got from
   AudioRecord into the play 

[android-developers] Re: Intent filter for text/calendar ?

2010-01-21 Thread jarkman
On Jan 21, 5:11 pm, Mark Murphy mmur...@commonsware.com wrote:
  I've been trying (and failing) to write an intent filter which will
  allow my app to handle text/calendar attachments received in the
  GMail or email apps

  I don't really know if my failure is because the mail apps are just
  not looking for apps to handle these attachments, or if I am getting
  the intent filter wrong.

  And I realise that the MIME types I see in sample intent filters are
  always vnd.android.something, not regular text/something types, which
  makes me wonder if intent filters just don't work on anything that
  doesn't have a provider.

  So, what's the story ? Here's my current attempt:

  intent-filter
                  action android:name=android.intent.action.VIEW /
                  action android:name=android.intent.action.EDIT /
                  action android:name=android.intent.action.PICK /
                  category
  android:name=android.intent.category.DEFAULT /
                  category
  android:name=android.intent.category.ALTERNATIVE /
                  data android:mimeType=text/calendar /
  /intent-filter

 In answer to your one question, you definitely can (and should) use
 real-world MIME types here when they are available. Most samples are using
 fake sorts of data and therefore use equally fake MIME types.

 You don't really describe the nature of the failure. What specifically is
 happening when you try to view one of these attachments.

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 Android App Developer Books:http://commonsware.com/books.html


Well, what I'd like to happen is this:
 - Receive a mail with a text/calendar attachment in the GMail (or
email) app
 - Click on the attachment
 - See my app open to handle it

What actually happens is that the mail apps show the attachment is
there, but don't offer any way to open it. And I'm not sure if that is
simply because I have my intent filter wrong, or because the mail apps
aren't even looking for apps to open these attachments.

Thanks,

Richard

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Loop audio from mic to earpiece?

2010-01-21 Thread Michael
No worries.

Had a week off in summer and spent some of it watching the tennis in
the sweltering heat and learning how the AudioRecord and AudioTrack
stuff works.
Just polishing some of it up to release my first app, but glad it
could be of use to someone else as well.

I look forward to that pint ;-)

Mike

On Jan 21, 5:23 pm, Donal Rafferty draf...@gmail.com wrote:
 Thanks Mike,

 Your a legend, have that working now,

 I owe you a pint!

 Many thanks,
 Regards,
 Donal

 On Thu, Jan 21, 2010 at 5:02 PM, Michael nicholls...@googlemail.com wrote:
  Hi Donal,

  I have pulled together some of my code to form an example. I have no
  idea if this code would compile, but it should be pretty close and
  should serve as an example to get you going.

                 android.os.Process.setThreadPriority
  (android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);

                 int buffersize = AudioRecord.getMinBufferSize(11025,
  AudioFormat.CHANNEL_CONFIGURATION_MONO,
  AudioFormat.ENCODING_PCM_16BIT);

                 AudioRecord arec = new
  AudioRecord(MediaRecorder.AudioSource.MIC,
                                 11025,
                                 AudioFormat.CHANNEL_CONFIGURATION_MONO,
                                 AudioFormat.ENCODING_PCM_16BIT,
                                 buffersize);

                 AudioTrack atrack = new
  AudioTrack(AudioManager.STREAM_MUSIC,
                                 11025,
                                 AudioFormat.CHANNEL_CONFIGURATION_MONO,
                                 AudioFormat.ENCODING_PCM_16BIT,
                                 ba.size(),
                                 AudioTrack.MODE_STREAMING);

                 atrack.setPlaybackRate(11025);

                 byte[] buffer = new byte[buffersize];
                 arec.startRecording();
                 atrack.play();

                 while(isRecording) {
                         arec.read(buffer, 0, buffersize);
                         try {
                                 atrack.write(buffer, 0, buffer.size());
                         } catch (IOException e) {

                                 e.printStackTrace();
                         }
                 }

                 arec.stop();
                 atrack.stop();

  This sets up an AudioRecord and an AudioTrack, tells the one to record
  and the other to play. You then have the while loop which reads the
  data out of the record and writes it to the play. This should
  reproduce the microphone audio as output for you (the code above will
  most likely put it out the speaker, play with the stream in the
  AudioTrack constructor for earpiece).

  You will need to run this code on a seperate thread and control the
  lifetime of the thread using the isRecording boolean.
  The first line elevates the thread to a higher priority, this may or
  may not be correct, so you should play with it and see.
  As for your delay, you may need to increase your buffer sizes to hold
  a few seconds worth of data and then just write the data to the
  AudioTrack later to create the delay.

  Oh and watch for feedback if the sound does come out of the speaker as
  it can be exponential if it's loud. You can always call:

         setVolumeControlStream(AudioManager.STREAM_MUSIC);

  from your activity and just make sure you pass the same stream as the
  one you pass to AudioTrack and your volume control will control the
  volume of that stream, enabling you to turn it down ;-)

  Hope that helps,
  Mike

  On Jan 21, 3:49 pm, Donal Rafferty draf...@gmail.com wrote:
   Really sorry to keep annoying you Micheal, head just doesn't seem to be
   functioning properly today.

   I currenlty have the AudiRecord buffer set up like this:

   static final int bufferSize = 8;
   final short[] buffer = new short[bufferSize];
   short[] readBuffer = new short[bufferSize];

   File file = new File(Environment.getExternalStorageDirectory
         ().getAbsolutePath() + /record.pcm);

   OutputStream os = new FileOutputStream(file);
    BufferedOutputStream bos = new BufferedOutputStream(os);
    DataOutputStream dos = new DataOutputStream(bos);

   So that sets up to buffer to the file record.pcm and the
  AudioRecord.read()
   methos is as follows:

        int bufferReadResult = audioRecord.read(readBuffer, 0,bufferSize);

                               for (int i = 0; i  bufferSize; i++)
                                   buffer[i] = readBuffer[i];
                               for (int i = 0; i  bufferReadResult; i++)
                                 dos.writeShort(buffer[i]);

   So it ends up reading to the file that way, so instead of the
  OutputStream
   os being set
   to a FileOutputStream do I set it to something else? and then add the
   OutputStream to
   a BufferedOutputStream and then that to DaraOutPutStream?

   Or does buffer[i] hold exactly what I need and I just need to get whats
  in
   buffer[i] to
   the AudioTrack?

   Thanks again and 

[android-developers] Re: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
Got it.

Althought not mentioned anywhere, the id must have dots. Seems to be a
restriction: it must be in the form of a package. So, i used
totalcross.app.sharedid and it succeed.

HTH,

   guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread Mark Murphy
 I used the option wipe user data and tried to reinstall the package.
 The problem occurs with the very first installed package using the id.
 In other words: the emulator if fully clean, and when i try to install
 the first package, the error occurs. It occurs with all packages i try
 to install with this id.

The places I see android:sharedUserId in use via Google Code Search all
have dot-delimited names (e.g., com.sandisk.waterloo.shareduserid).
Perhaps change yours to match that pattern and see if that helps.

It is also possible that you need to supply the android:sharedUserLabel as
well, not just android:sharedUserId.

Beyond that...I'm stumped. I haven't used sharedUserId personally, so I
don't have any of my own sample code to point you to.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Intent filter for text/calendar ?

2010-01-21 Thread Mark Murphy
 Well, what I'd like to happen is this:
  - Receive a mail with a text/calendar attachment in the GMail (or
 email) app
  - Click on the attachment
  - See my app open to handle it

Sounds reasonable.

 What actually happens is that the mail apps show the attachment is
 there, but don't offer any way to open it. And I'm not sure if that is
 simply because I have my intent filter wrong, or because the mail apps
 aren't even looking for apps to open these attachments.

Well, if you hunt through Google Code Search, you'll find a number of
sample intent filters that use android:mimeType. See if any of those are
treated properly by the mail client. If one does, try mirroring their
intent filter.

BTW, you're *sure* the email is coming over the wire with the attachment
as text/calendar (versus some other MIME type)?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: AdWhirl - any experience with it?

2010-01-21 Thread westmeadboy
Yeah thanks, I didn't realise that about house ads either.

I've configured it all - the house ads are running but none are
showing up (confirmed by looking at the stats over the last couple of
days).

Does something need to be set in the app itself?

On Jan 21, 1:16 am, Seni Sangrujee sangru...@gmail.com wrote:
 On Jan 20, 6:00 am, AppToolkit develo...@apptoolkit.com wrote:

  It is possible to use AdMob House Ads for Android as well. You need to
  setup as a mobile web ad and just use the same format for the url as

 Thanks for the help!  I wouldn't have thought to look there.  That
 seems odd that AdMob classifies Android apps under Mobile Web apps
 instead of a top-level category like iPhone apps.

 -seni
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Intent filter for text/calendar ?

2010-01-21 Thread jarkman


On Jan 21, 5:34 pm, Mark Murphy mmur...@commonsware.com wrote:

 Well, if you hunt through Google Code Search, you'll find a number of
 sample intent filters that use android:mimeType. See if any of those are
 treated properly by the mail client. If one does, try mirroring their
 intent filter.

That's a cunning plan - ta!

 BTW, you're *sure* the email is coming over the wire with the attachment
 as text/calendar (versus some other MIME type)?

That's how it turns up in my desktop mail client, where I can see the
source, so I am reasonably (but not completely) sure.

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

[android-developers] Creating dialogs from a thread

2010-01-21 Thread Dirk Vranckaert
I'm working on an application which loads some data from the net in a
thread.
However when something goes wrong (no internet connection or sth) I'dd
like to create a dialog to show an error message to the user.
However my code works fine not using threads but creating a dialog
from my thread makes my application crashing.

In my activity I have overwritten the onCreateDialog method and looks
like this:
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
switch (id) {
case EPISODE_LOADING_DIALOG:
ProgressDialog progressDialog = new 
ProgressDialog(this);
progressDialog.setMessage(this.getString
(R.string.progressLoadingTitle));

//progressDialog.setTitle(R.string.progressLoadingTitle);
dialog = progressDialog;
break;
case EXCEPTION_DIALOG:
if (exceptionMessageResId == null) {
exceptionMessageResId = 
R.string.defaultExceptionMessage;
}
AlertDialog.Builder builder = new 
AlertDialog.Builder(this);
builder.setTitle(R.string.exceptionDialogTitle)
   .setMessage(exceptionMessageResId)
   .setCancelable(false)
   
.setPositiveButton(R.string.dialogOK, new
DialogInterface.OnClickListener() {
   public void onClick(DialogInterface 
dialog, int id) {
dialog.cancel();
   }
   });
exceptionMessageResId = null;
default:
dialog = super.onCreateDialog(id);
}
return dialog;
}

The method which is calling a method and catching an exception (within
a thread):
private void getEpisodes() {
try {
episodes = myEpisodesService.retrieveEpisodes(user);
} catch (InternetConnectivityException e) {
String message = Could not connect to host;
Log.e(LOG_TAG, message, e);
exceptionMessageResId = 
R.string.internetConnectionFailureReload;
showDialog(EXCEPTION_DIALOG);
}
runOnUiThread(returnEpisodes);
}

So does anyone of you guys knows what I am doing wrong here? Can't you
create a dialog from within a thread?
If so, what's the best way of handling my exceptions here?
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Creating dialogs from a thread

2010-01-21 Thread TreKing
On Thu, Jan 21, 2010 at 11:56 AM, Dirk Vranckaert
dirkvrancka...@gmail.comwrote:

 So does anyone of you guys knows what I am doing wrong here? Can't you
 create a dialog from within a thread?

No.


 If so, what's the best way of handling my exceptions here?


There are various options, but you could use the runOnUiThread function as
you are already to run yet another small thread to show the dialog on the UI
thread.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] bug: Android emulator keeps timing out

2010-01-21 Thread guiha...@gmail.com
Hi,

This is a really odd bug. Seems that if you try to access the /data/
data folder, the emulator bails out after some seconds.

Try this:

adb shell ls -l /data/data

Wait 1 minute, then try again: it will say: error: device not found.

This happens in eclipse's File Explorer too.

Hope it will be fixed soon. Anyone else had this problem? I'm using
winxp.

thx

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

[android-developers] Re: adding voice search

2010-01-21 Thread Achanta
Thank you Schwiz and David for the replies. they were helpful.

I included the part that David advised and it works great.

Now I have a requirement with the search in my project.
I need to provide a widget like the quick Search box in the main page
of the app..ie., it should always be visible. It should also have the
voice search[mic] button.

So when users start typing in this or click on the mic button and
start speaking, it should grab the string and open the search results
page with this search string.
How can I implement that?

Thanks again.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Mystery Segfault after exiting game. Happens reliably but unable to track it down.

2010-01-21 Thread Robert Green
I'm not sure what to post yet.  I don't know what's causing it.  My
gut tells me that it has something to do with the surface or gles, but
since it doesn't happen as a result of any method call that I make, I
can't tell.  It's something in Android causing it, probably as a
result of something I did previously but can not track down.  Once I
know better what's causing it, I'll post the bug.

Is there any way to track down the function segfaulting using those
memory addresses?

On Jan 21, 1:45 am, Mark Murphy mmur...@commonsware.com wrote:
  So my game always runs perfectly the first time.  When I run it, it
  loads and plays.  You can switch activities and it resumes correctly.
  Great, right!  Well, either after you exit out and the activity is
  destroyed or right when you start a new game, about 5 seconds into
  loading, this happens.  I clean up very well after myself in the
  process so that it isn't consuming memory after the game is quit and
  so that the next load works correctly.  I'm having a very difficult
  time tracking this down.

  Like I said in the above paragraph, this only happens AFTER I quit the
  game or while loading a new game, after quitting a first one.  It
  never happens the first time.

 While I have no suggestions on how to resolve the problem, definitely post
 this tohttp://b.android.comif it does not appear to be there already.
 Segfaults are always a bug in Android -- at minimum, it should throw a
 Java exception rather than segfaulting.

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 Android App Developer Books:http://commonsware.com/books.html
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 lifecycle and threads

2010-01-21 Thread Nathan
From the interface methods on SQLiteDatabase, it seems very much like
it is intended for one instance of SQLiteDatabase per open database,
and that you share it between threads.

You can apparently even set locking enabled.

=
public void setLockingEnabled (boolean lockingEnabled)

Since: API Level 1
Control whether or not the SQLiteDatabase is made thread-safe by using
locks around critical sections. This is pretty expensive, so if you
know that your DB will only be used by a single thread then you should
set this to false. The default is true.
=

I think I will have to set/leave this to true and take the performance
hit - I hope it is not too huge.

To find out all the dynamic behavior with multiple readers and
writers, I will probably have to experiment. I'm pretty sure that
someone has figured this all out, but it wouldn't hurt to know how it
all fits my application.

Nathan





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

[android-developers] Re: adding voice search

2010-01-21 Thread schwiz
I think you would override onActivityResult like I did in my project.

On Jan 21, 12:17 pm, Achanta krishna.acha...@gmail.com wrote:
 Thank you Schwiz and David for the replies. they were helpful.

 I included the part that David advised and it works great.

 Now I have a requirement with the search in my project.
 I need to provide a widget like the quick Search box in the main page
 of the app..ie., it should always be visible. It should also have the
 voice search[mic] button.

 So when users start typing in this or click on the mic button and
 start speaking, it should grab the string and open the search results
 page with this search string.
 How can I implement that?

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

[android-developers] Creating a proper Splash/Loading screen

2010-01-21 Thread Chris
Hello all,

I have an application that uses OpenGL on a GLSurfaceView. The problem
is that the initial load takes quite a while processing textures and
getting things ready.

What i want to do is have a simple PNG displayed (with a slight
animation) while the GLSurfaceView is getting ready. As soon as it's
ready to render, i would like to tear down the splash screen.

What is the right way to do this? I've tried ViewFlipper, ViewSwitcher
and a bunch of other things to switch between my R.layout.main view
and my GLSurfaceView but i can't seem to get it right.

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

[android-developers] Re: Android Performance Monitoring..

2010-01-21 Thread Menion
try look at this ...

http://developer.android.com/intl/fr/guide/developing/tools/traceview.html

i mean, very usefull ;)

On Jan 21, 10:54 am, bharat yeahbha...@gmail.com wrote:
 Guys,
 I am working on a project where I need to measure the performance of
 an app in terms of memory and CPU cycles used...I need to know any
 simple way to do it(even code is ok)...

 Has anyone implemented PerformanceTestCase interface provided by
 android and got results(performance parameters)

 Regards,
 Bharat Pawar
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
Hi,

I got it working with this:

public class Stub extends Activity
{
   /** Called when the activity is first created. */
   public void onCreate(Bundle savedInstanceState)
   {
  //super.onCreate(savedInstanceState);
  Intent intent = new Intent(android.intent.action.MAIN);
  intent.setClassName
(totalcross.android,totalcross.android.Loader);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT );
  intent.putExtra(param1, Barbara and Andre);
  startActivity(intent);
  System.exit(0);
   }
}

Then the Loader class has:

   public void onCreate(Bundle savedInstanceState)
   {
  super.onCreate(savedInstanceState);
  Bundle b = getIntent().getExtras();
  if (b != null)
  {
 String app = b.getString(param1);
 Log.i(TotalCross, param1: +app);
  }

HTH someone.

regards and thanks for the help

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

[android-developers] Re: Custom ClassLoader - Urgent!

2010-01-21 Thread fadden
On Jan 21, 6:31 am, Karl Pauls karlpa...@gmail.com wrote:
  Since the 'test' TestClass instance is created with reference to the
  new class-loader, I'd expect that after this line executes,
  test.getClass().getClassLoader() will return an instance of
  CustomClassLoader, but I always get the default PathClassLoader
  returned.

 Why would you expect that? Java uses parent delegation first so it
 will find the class in the parent and return that one -- hence, its
 classloader is the parent.

It uses parent delegation *by default*.  You can override it.  (See
e.g. dalvik/tests/068-classloader/src/FancyLoader.java for an
example.)

However, if you do, your custom loader has to take responsibility for
actually loading the class.  This can get messy in a hurry.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: creating activity-less packages

2010-01-21 Thread guiha...@gmail.com
I have one more question: can i load the view of another package,
instead of calling another activity?
In the sample above, i would call setContentView(LoaderView) someway.
This would be perfect for me.

thx

   guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Keep activity running while in sleep mode

2010-01-21 Thread Mark Murphy
 I am newer to Android development and I have a app that needs to run a
 command even if the phone goes to sleep.

 I have it running as a service but it runs randomly when.
 Is there a way to have the service run even when the phone is
 sleeping.

Use AlarmManager. Keep your service stopped normally, and use an alarm to
wake up the device and run your code.

http://tinyurl.com/y9mttv5

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Keep activity running while in sleep mode

2010-01-21 Thread Mark Murphy

 I am newer to Android development and I have a app that needs to run a
 command even if the phone goes to sleep.

 I have it running as a service but it runs randomly when.
 Is there a way to have the service run even when the phone is
 sleeping.

 Use AlarmManager. Keep your service stopped normally, and use an alarm to
 wake up the device and run your code.

 http://tinyurl.com/y9mttv5

Whoops, sorry, errant URL paste there. I was aiming for:

http://www.androidguys.com/2009/04/02/wake-up-with-the-alarm/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Working in Windows 2000

2010-01-21 Thread Doug Aitken
Guich,

Ubuntu (or even Xubuntu, to run something lighter) will work really
well for you if you can do that.

On Jan 18, 10:19 pm, guiha...@gmail.com guiha...@gmail.com wrote:
 Thanks for all suggestions. I'll try to run linux, either in a
 partition or in virtualbox.

 cheers

     guich
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Creating dialogs from a thread

2010-01-21 Thread Dirk Vranckaert
I certainly will try it out later this evening (studying for my
certification right now) but is there any more detailed/advanced
explanation about why I can't run a bunch of code in a thread and at
the end of the thread start a dialog? Why I have to start a nested
thread with just the dialog creation? :s Still don't really get the
reason why...

Anyway thx in advance for giving me a possible working solution, and
I'll certainly keep you informed if it did the job for me (later this
evening).

On 21 jan, 19:47, TreKing treking...@gmail.com wrote:
 On Thu, Jan 21, 2010 at 12:28 PM, Dirk Vranckaert
 dirkvrancka...@gmail.comwrote:

  So if I understand you correct I should run two nested threads to show
  the dialog?

 Yup. So instead of showDialog(int) in the thread, do
 runOnUiThread(someThread); where someThread just calls showDialog(int) in
 it's run method.

 Yes, it's annoying and messy, but you can't do UI related operations in
 separate threads, so there you go.

 -
 TreKing - Chicago transit tracking app for Android-powered 
 deviceshttp://sites.google.com/site/rezmobileapps/treking
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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 lifecycle and threads

2010-01-21 Thread Nathan


On Jan 21, 11:08 am, jotobjects jotobje...@gmail.com wrote:
 You might want to look into the transaction paradigm/pattern:

 http://developer.android.com/reference/android/database/sqlite/SQLite...

 Transactions are the well understood way to get consistent results
 with multiple readers and writers.  Exactly what the semantics are for
 transaction in the Android database.sqllite API is not clear to me.

My experience with SQLite in .NET Compact Framework has given me
enough motivation to ask these kind of questions.

Using transactions - or not using them - can have unexpected SQLite
performance implications even in a single threaded world. Once a
simple xml import was taking up to half an hour. I put a transaction
around a long series of small updates and it was reduced to a few
seconds.  This was a situation where you would think a transaction
would improve correctness, but degrade performance slightly.

The questions I have are:
Does a Cursor hold a lock while it it being used, for example, in a
SimpleCursorAdapter?
Does a transaction hold a lock starting at Begingtransaction ? Long
transactions can be bad if I wish to keep the write lock short.

This is a discussion of locking in SQLite3:

http://www.sqlite.org/lockingv3.html

I don't know how the SQLiteDatabase interface interacts with this
model yet.


 For instance, when you would want to or need to use the
 setLockingEnabled method and how that relates to using transactions is
 unclear.


I think that I don't have any choice about setLockingEnabled - SQLite
will probably crash without it. I don't expect that it will solve all
problems, though.

Nathan

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: RatingBar size issues on high-density screens (Droid, Nexus One)

2010-01-21 Thread Smelly Eddie
Surely someone has an idea.  I have continued to search the SDK
reference and resources but I can't even ind an allusion to the layout/
formatting issues with high-density screens.

On Jan 20, 6:32 pm, Smelly Eddie ollit...@gmail.com wrote:
 Hello Group -

  I am hoping someone that has formatted rating bars on a Droid, or
 Nexus One can help me.

 I had a few users with Droid s report oddities with rating bars in my
 application.  Everything looked fine on my G1 but when I recently
 upgraded to a Nexus One ( for $49 !! ) and I see the issue they are
 talking about.

 You only see the top half of 3 stars. When it should be a full 5 star
 bank. The user must rotate for a landscape layout to see all 5.

 (image)http://images.webbmaster.org/device.png

 My layout is pretty standard, this is a dialog 
 (pastebin)http://pastebin.org/79473;
 --
 ?xml version=1.0 encoding=utf-8?
 RelativeLayout
   xmlns:android=http://schemas.android.com/apk/res/android;
   android:id=@+id/active_rating_layout
   android:layout_width=fill_parent
   android:layout_height=wrap_content
   android:orientation=vertical
 RatingBar android:id=@+id/ActiveRatingBar
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:layout_centerInParent=true/
 Button android:background=@drawable/no_interest_drk
 android:paddingLeft=24px
 android:layout_below=@id/ActiveRatingBar
 android:layout_centerHorizontal=true
 android:layout_marginTop=45dp
 android:layout_marginBottom=50dp
 android:paddingRight=5dp
 android:text=@string/no_thanks android:id=@+id/no_thanks
 android:layout_width=wrap_content
 android:layout_height=wrap_content/Button
 /RelativeLayout
 

 The Market rating bar fits the screen just fine.  - I am just not sure
 how they are doing it...

 Perhaps a custom layout for those type of screens - but what do i set
 differently?
 Do I need to override the measure function, or specify something
 differently for Droid and Nexus type screens?

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

  1   2   >