[android-developers] Re: AsyncTask null exception for the activity reference in the doInBackground method while rotating.

2011-11-20 Thread BelvCompSvs
doInBackground like you have it is not the way to do that -- what you
have coded is called spinning

Kostya Vasilyev's explanation is clearer than mine and will move you
in the direction of correct code if you take the suggestion and
continue to work it but rather than doing a spin-lock as a wait we use
instead a programming approach known as interfaces - sometimes called
callbacks - which will be in the AsyncTask documents

rather than detaching what you do is call dot start on AsyncTask (a
form of Threading) and let it run

If it ( the program ) has to callback to the User Interface then use
of AsyncTask needs to have the UI element in it that the UI thread
will call into

If background thread does not need UI to then dont really need
AsyncTask but need a service or something instead

you can pass object references to some forms of background processing
which then can set a var in the AsyncTask based class from background
processing or there are callbacks / interfaces in some supplied
classes that are meant for that

Google I/O 2010 - Writing zippy Android apps

http://developer.android.com/videos/index.html#v=Oq05KqjXTvs

the guy talks fast by most people but seems rather simple to me -- you
fix this stuff now or get blown off the sidewalk later by an NPE when
IntentService.onBind (Intent intent) default implementation returns
null but you decided not to implement android:maxSdkVersion

to do this work you have to keep clear in your mind that a Thread
( from wherever it came ) is an instruction pointer in whatever is
driving the code ( which usually is a processor ) then the whole thing
becomes remarkably simple

surprisingly for those who have not bit the dust on it several times
one can do an amazing amount just by making all method calls
synchronized or using synchronizaton blocks -- you will see in most
accomplished code a style of code design Object lock = new Object()
and you just barrier on that

On Nov 18, 9:40 pm, Bluemercury joao.ro...@gmail.com wrote:
 Hi there! Sorry for posting here again, but i was hoping if i could try
 this sample, you said to put the synchronized in the detach method here:

 void detach() {
 *activity=null;*

 }

 in the asynctask, is this correct?but detach() is only called in the
 activity and not the in the async task itself, i thought synchronized
 methods assumed that they're both launched from 2 different threadsbut
 in this case the activity(UI thread) calls the detach method like you said,
 but the async task doesnt, only the attach method...

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


[android-developers] Multiple layouts

2011-11-20 Thread Stephen Lebed
Hi,

I'm trying to add support for a layout for the Samsung Galaxy Tab 7
device.  I can't seem to find a way to specify a layout config that it
will pull the layout xml from.  It keeps using the resource from the
Normal screen/High Density folder, which makes sense, but the layout
is small and centered in the middle of the screen.  I was hoping to
use the newer layout-sw600dpi folder config, but it never pulls from
the folder.  I've set my min api to 4 and target api to 14.

Does the Support Library offer a backward compatible means to use the
newer qualifiers in 3.2 in older api's?  (I'm hoping this is the
solution!)

Is there a way to code my app to identity a devices resolution and
direct the system to use a particle layout?

Will using Fragments in anyway help with older apis?

I know that there is a huge debate about resolutions and densities and
I should create a layout that hard codes sizes, but that is what my
app requires.  I've done everything I can to keep it resolution
independent and have created several layout to address a range to
display sizes, but the Samsung 7 device falls through the cracks.

I've search everywhere I could find and have read and reread to sdk
docs, but I haven't found an answer.

Any help would be appreciated.

Thanks,
Stephen Lebed

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

2011-11-20 Thread Kostya Vasilyev

You should be able to do it by subclassing ReplacementSpan:

http://developer.android.com/reference/android/text/style/ReplacementSpan.html

... which lets you do the drawing yourself, rather than modifying a 
TextPaint.


-- Kostya

20.11.2011 8:24, Jay пишет:

I have actually already considered that. The StrikethruSpan class just
sets the strikethru bit on the Paint that is passed through it; there
does not seem to be a separate field for strikethru color.
Unfortunately, I cannot find any documentation of the entry points
that custom Spans have available to modify the drawing process, so I
don't know how to implement custom-colored strikethru by hand. I
will continue to chase through the source, but would appreciate any
insight anyone can provide as to how the Span classes interact with
the text.

Jay

On Nov 19, 9:41 pm, Zsolt Vasvarizvasv...@gmail.com  wrote:

Get the source code for the class that implements strikethru and
modiify it to your liking.

On Nov 20, 4:43 am, Jayjohnabloodwor...@gmail.com  wrote:








Is it possible to to create a span of text in a textview in which the
strikethru line is a different color than the text. I cannot find much
documentation on the SpannableString interface.
Thanks,
Jay


--
Kostya Vasilyev

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

2011-11-20 Thread Kostya Vasilyev

Assuming you mean the original Galaxy Tab P1000.

According to Samsung, it is a -large device, so using res/layout-large, 
or perhaps values-large/dimen.xml should work.


Those new resource qualifiers are new with 3.2, and it's a runtime 
version requirement.


Layouts scaled to a portion of the screen and centered sounds like 
compatibility mode. Make sure that uses-sdk is directly inside 
manifest, like this:


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

uses-sdk
android:minSdkVersion=4
android:targetSdkVersion=13 /

application  and other stuff

/manifest

-- Kostya

20.11.2011 12:31, Stephen Lebed пишет:

Hi,

I'm trying to add support for a layout for the Samsung Galaxy Tab 7
device.  I can't seem to find a way to specify a layout config that it
will pull the layout xml from.  It keeps using the resource from the
Normal screen/High Density folder, which makes sense, but the layout
is small and centered in the middle of the screen.  I was hoping to
use the newer layout-sw600dpi folder config, but it never pulls from
the folder.  I've set my min api to 4 and target api to 14.

Does the Support Library offer a backward compatible means to use the
newer qualifiers in 3.2 in older api's?  (I'm hoping this is the
solution!)

Is there a way to code my app to identity a devices resolution and
direct the system to use a particle layout?

Will using Fragments in anyway help with older apis?

I know that there is a huge debate about resolutions and densities and
I should create a layout that hard codes sizes, but that is what my
app requires.  I've done everything I can to keep it resolution
independent and have created several layout to address a range to
display sizes, but the Samsung 7 device falls through the cracks.

I've search everywhere I could find and have read and reread to sdk
docs, but I haven't found an answer.

Any help would be appreciated.

Thanks,
Stephen Lebed



--
Kostya Vasilyev

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


[android-developers] Phone model penetration

2011-11-20 Thread Efi Merdler-Kravitz
Hi,

Where can I find reliable information on the various Android phone
model, their latest Android version and their penetration rate in the
US/Global market, in other words I want to know which phones are the
most popular.

Thank you,
Efi

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


[android-developers] Tutorial HelloTabWidget crashes

2011-11-20 Thread wyo
I've tried the tutorial HelloTabWidget and think I've done
everything as described yet it crashes with

11-20 10:23:33.166: E/AndroidRuntime(12801):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{hello.android.tabwidget/
hello.android.tabwidget.HelloTabWidgetActivity}:
android.content.ActivityNotFoundException: Unable to find explicit
activity class {hello.android.tabwidget/
hello.android.tabwidget.HelloTabWidgetActivity$ArtistsActivity}; have
you declared this activity in your AndroidManifest.xml?

Sure enough there isn't a HelloTabWidgetActivity$ArtistsActivity
activity since there wasn't an advice to add it. I've tried to add
this missing activity yet it seems I'm not able to add it right. Could
anybody help me with this missing activity?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Problem with losing contains of ArrayList please help

2011-11-20 Thread Graham Bright
Hi Shashi,

Thanks for responding, from myphone i am calling querycontacts which
presents to the user a button called block and textbox. Using querycontacts
i am calling another class (now part of querycontacts) to populate an
arraylist called items. I want to use this arraylist later as a
blockinglist. However from querycontacts when I press the back button the
state info is lost i.e. Arraylist is empty. So I cannot use it. I am
guessing I need a service not an activity. Code would help me here. Thanks
Graham

On 20 Nov 2011 05:25, shashi asanka shashi.kalut...@gmail.com wrote:

What Do you need? mez with your code . tell what exact you want

do you want to pass  values from one activity to another activity ?

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

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

Re: [android-developers] Tutorial HelloTabWidget crashes

2011-11-20 Thread Robinns
Have you defined you activity under the Manifest.xml file.
Check it out

On Sun, Nov 20, 2011 at 3:32 PM, wyo otto.w...@orpatec.ch wrote:

 I've tried the tutorial HelloTabWidget and think I've done
 everything as described yet it crashes with

 11-20 10:23:33.166: E/AndroidRuntime(12801):
 java.lang.RuntimeException: Unable to start activity
 ComponentInfo{hello.android.tabwidget/
 hello.android.tabwidget.HelloTabWidgetActivity}:
 android.content.ActivityNotFoundException: Unable to find explicit
 activity class {hello.android.tabwidget/
 hello.android.tabwidget.HelloTabWidgetActivity$ArtistsActivity}; have
 you declared this activity in your AndroidManifest.xml?

 Sure enough there isn't a HelloTabWidgetActivity$ArtistsActivity
 activity since there wasn't an advice to add it. I've tried to add
 this missing activity yet it seems I'm not able to add it right. Could
 anybody help me with this missing activity?

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




-- 
Robin

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

2011-11-20 Thread wyo
My manifest.xml looks like this as the tutorial specifies

application
android:icon=@drawable/ic_launcher
android:label=@string/app_name 
activity
android:label=@string/app_name
android:name=.HelloTabWidgetActivity
android:theme=@android:style/Theme.NoTitleBar

intent-filter 
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity

/application


On Nov 20, 11:25 am, Robinns librain.ro...@gmail.com wrote:
 Have you defined you activity under the Manifest.xml file.

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


Re: [android-developers] Re: Tutorial HelloTabWidget crashes

2011-11-20 Thread HideCheck
Manifest file must be added to ArtistsActivity, AlbumsActivity, and
SongsActivity.

http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
-
Notice that this doesn't use a layout file. Just create a TextView,
give it some text and set that as the content. Duplicate this for each
of the three activities, and add the corresponding activity/ tags to
the Android Manifest file.

-

Thanks

2011/11/20 wyo otto.w...@orpatec.ch:
 My manifest.xml looks like this as the tutorial specifies

    application
        android:icon=@drawable/ic_launcher
        android:label=@string/app_name 
        activity
            android:label=@string/app_name
            android:name=.HelloTabWidgetActivity
            android:theme=@android:style/Theme.NoTitleBar
            
            intent-filter 
                action android:name=android.intent.action.MAIN /
                category
 android:name=android.intent.category.LAUNCHER /
            /intent-filter
        /activity

    /application


 On Nov 20, 11:25 am, Robinns librain.ro...@gmail.com wrote:
 Have you defined you activity under the Manifest.xml file.

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

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


[android-developers] Informations about Dev Phone 1 characteristics (for Wikitude use)

2011-11-20 Thread Pedro Teixeira
Hi,

Is anyone familiar with wikitude? I'm trying to build a simple AR mode
activity and I would like to try Wikitude ARchitect since it has the
feature I'd like to implement: An overlaid picture instead of an
overlaid icon.

This are the requirements they say I need:
Android 2.2 or higher
support for OpenGL ES 2.0

The only mobile I have available from the university is an Android Dev
Phone 1. Will this work or is it too much outdated?

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


Re: [android-developers] Re: Control any led of the device, does the sdk allow?

2011-11-20 Thread Poqit
Hello Dianne,

It would be good if the LED capability could be queried in future APIs, in 
a similar way that you can query keyboard and screen types.
Cheers...

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

[android-developers] Re: localization bloats my app - is there an alternative approach?

2011-11-20 Thread String
On Friday, November 18, 2011 1:43:48 AM UTC, Zsolt Vasvari wrote:

In my opinion, people seem to like larger apps -- more like getting 
 more bang for your buck.


Also not true if your app has one of the many incompatibilities with 
InstallToSD. As most of mine do. I still need to work really hard to keep 
my APKs small, because the user's essentially forced to keep them in device 
main memory.

But an interesting observation!

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

[android-developers] Layout Question

2011-11-20 Thread Kubilay D . Yılmaz
Hi Friends;

I have a problem with layout.
I have 4 images,

   - redbackground.png 80px
   - triangle.png 80px
   - star.png 80px
   - green_diamond.png 160px

I want to show these images like attached file as shouldbe.png

My layout xml is like

 //above layout fit
LinearLayout
android:id=@+id/linearLayout1
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_gravity=bottom
android:background=@drawable/red_background
android:gravity=center 

ImageView
android:id=@+id/imagetriangle
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_weight=1
android:src=@drawable/triangle
android:onClick=backClicked
/

ImageView
android:id=@+id/imgb
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_weight=1
android:src=@drawable/green_diamond /

ImageView
android:id=@+id/imageright
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_weight=1
android:src=@drawable/star
android:onClick=digerClicked

 /
/LinearLayout

However it shows as wrong.png. Problem is that I have to put background
image only for 80px
thank you for your advice.

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

Re: [android-developers] AsyncTask null exception for the activity reference in the doInBackground method while rotating.

2011-11-20 Thread João Rossa
Thanks guys. The idea was to call a unique class whenever an activity had
the need to launch tasks, but since i have parent activity where all the
activities extend from, they would call the async task and each one would
have a method that would used in the doinbackground method of said async
task. Right now im using no reference to the activity in the doinbackground
but because of this im extending the asynctask class i've created to
acomodate the different needs to the different activities, but i thought it
would be more direct if i had the logic to run in the async tasks right in
the activities

regards,

On Sat, Nov 19, 2011 at 1:19 PM, Kostya Vasilyev kmans...@gmail.com wrote:

  Hi,

 The original code that you posted did contain concurrent (multithreaded)
 reads and writes of the activity member variable. That concurrency was
 causing null pointed exceptions in a *seemingly* impossible place. The
 reason, as far as I can tell, you had concurrent access to the member
 variable was that you wanted to delegate the actual background work to the
 activity, while keeping your async task implementation generic and unaware
 of the exact nature of background work.

 So, with this in mind, I can see two ways of fixing things:

 1) Keeping your way of structuring the code, and adding proper thread
 synchronization.

 Here is one way:

 void detach() {
 synchronized(this) {
 this.activity = null
 }
 }

 ... elsewhere (IIRC)...

 void the_method_where_you_were_getting_a_null_pointer_exception() {
 MyActivityClass checkedActivity;
 synchronized(this) {
 checkedActivity = this.activity;
 }
 if (checkedActivity != null) {
 .
 }
 }

 There are other things to be careful with here, for example, the activity
 may be paused, stopped, or its onDestroy called (on the UI thread) while
 the async task's thread is still in its worker method. Accesses to member
 variables of activity would also need to be synchronized, or preferably
 avoided So don't undertake this unless you've learned at least the
 basics of concurrent programming.

 2) Restructuring the code in a more orthodox way, as described in the
 docs and was already suggested on this thread by Streets of Boston and
 TreKing (IIRC).

 Have your AsyncTask perform the work without delegating to the activity,
 and only reference the activity (if any) on the UI thread, in
 onPostExecute. This way you'll be avoiding concurrent reads/writes of the
 activity member variable, because onPostExecute and detach are both
 executed on the UI thread.

 Hope this helps.

 -- Kostya

 19.11.2011 7:40, Bluemercury пишет:

 Hi there! Sorry for posting here again, but i was hoping if i could try
 this sample, you said to put the synchronized in the detach method here:

  void detach() {
  *activity=null;*
  }

  in the asynctask, is this correct?but detach() is only called in the
 activity and not the in the async task itself, i thought synchronized
 methods assumed that they're both launched from 2 different threadsbut
 in this case the activity(UI thread) calls the detach method like you said,
 but the async task doesnt, only the attach method...
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


 --
 Kostya Vasilyev

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


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

Re: [android-developers] Remove menu if no camera found?

2011-11-20 Thread Mark Murphy
On Sun, Nov 20, 2011 at 12:14 AM, limtc thyech...@gmail.com wrote:
 I have a menu item in menu.xml that allows user to click and use
 camera.

 Since now there are more devices without camera (Kindle Fire, etc),
 would like to remove menu (or disable it) if no camera detected. Has
 anybody done this before?

What is this?

If this is detect whether there is a camera, between PackageManager
and hasSystemFeature() and the Camera class on API Level 9+, you have
options for detecting it.

If this is disable or remove a menu item, just find the MenuItem by
ID from your Menu and call the appropriate setter (e.g.,
setEnabled()). Until such time as we have to worry about cameras
coming and going, you could just do this as part of our
onCreateOptionsMenu() logic.

If this is something else, use fewer pronouns. :-)

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Informations about Dev Phone 1 characteristics (for Wikitude use)

2011-11-20 Thread Mark Murphy
ADP1, IIRC, was the HTC Dream/T-Mobile G1. That does not support
either of your requirements AFAIK. Though you might find a modded ROM
that could offer 2.2. I'm fairly certain the Dream only offered OpenGL
ES 1.1, though, and I'll be surprised if a ROM can fix that.

On Sun, Nov 20, 2011 at 7:01 AM, Pedro Teixeira
pedroteixeir...@gmail.com wrote:
 Hi,

 Is anyone familiar with wikitude? I'm trying to build a simple AR mode
 activity and I would like to try Wikitude ARchitect since it has the
 feature I'd like to implement: An overlaid picture instead of an
 overlaid icon.

 This are the requirements they say I need:
 Android 2.2 or higher
 support for OpenGL ES 2.0

 The only mobile I have available from the university is an Android Dev
 Phone 1. Will this work or is it too much outdated?

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Layout Question

2011-11-20 Thread Mark Murphy
You have your green diamond as a child of the LinearLayout. It is not
a child of the LinearLayout in your desired result.

On Sun, Nov 20, 2011 at 7:51 AM, Kubilay D. Yılmaz
kubilayd.yil...@gmail.com wrote:
 Hi Friends;
 I have a problem with layout.
 I have 4 images,

 redbackground.png 80px
 triangle.png 80px
 star.png 80px
 green_diamond.png 160px

 I want to show these images like attached file as shouldbe.png
 My layout xml is like
  //above layout fit
     LinearLayout
         android:id=@+id/linearLayout1
         android:layout_width=wrap_content
         android:layout_height=wrap_content
         android:layout_gravity=bottom
         android:background=@drawable/red_background
         android:gravity=center 
         ImageView
             android:id=@+id/imagetriangle
             android:layout_width=wrap_content
             android:layout_height=wrap_content
             android:layout_weight=1
             android:src=@drawable/triangle
             android:onClick=backClicked
             /
         ImageView
             android:id=@+id/imgb
             android:layout_width=wrap_content
             android:layout_height=wrap_content
             android:layout_weight=1
             android:src=@drawable/green_diamond /
         ImageView
             android:id=@+id/imageright
             android:layout_width=wrap_content
             android:layout_height=wrap_content
             android:layout_weight=1
             android:src=@drawable/star
             android:onClick=digerClicked

              /
     /LinearLayout
 However it shows as wrong.png. Problem is that I have to put background
 image only for 80px
 thank you for your advice.

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



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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Phone model penetration

2011-11-20 Thread Mark Murphy
Pay for a market survey report from Gartner or similar firms. I hope
you have a deep wallet.

On Sun, Nov 20, 2011 at 4:13 AM, Efi Merdler-Kravitz
efi.merd...@gmail.com wrote:
 Where can I find reliable information on the various Android phone
 model, their latest Android version and their penetration rate in the
 US/Global market, in other words I want to know which phones are the
 most popular.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Tutorial HelloTabWidget crashes

2011-11-20 Thread wyo
Well then why isn't it documented in the tutorial?

I've now simply duplicated the app activitiy and replaced the name
like

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

yet I've no idea if this is correct or what all these means. So far it
seems to work.

On Nov 20, 12:07 pm, HideCheck hidech...@gmail.com wrote:
 Manifest file must be added to ArtistsActivity, AlbumsActivity, and
 SongsActivity.

 http://developer.android.com/resources/tutorials/views/hello-tabwidge...
 -
 Notice that this doesn't use a layout file. Just create a TextView,
 give it some text and set that as the content. Duplicate this for each
 of the three activities, and add the corresponding activity/ tags to
 the Android Manifest file.

 -

 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


Re: [android-developers] AsyncTask null exception for the activity reference in the doInBackground method while rotating.

2011-11-20 Thread João Rossa
So in my Async Task  class doInBackground and detach methods i could use :


@Override
protected Object *doInBackground*(Void... params) {

MyActivityClass *checkedActivity*;
synchronized(this) {
*checkedActivity *= this.activity;
}

if(*checkedActivity*!=null){
Logger.write(QuadrosMobileActivityTask ,  AsyncTask background
initialized +Current Activity: +checkedActivity .getClass().getName(),
Logger.INFO);
return *checkedActivity *.doBackGroundRequest();
}else{
Logger.write(QuadrosMobileActivityTask , AsyncTask finished while no
Activity was attached., Logger.INFO);
return null;}

}

and the detach method would change to:

void *detach*() {
synchronized(this) {
this.activity = null
}
}


Still i need to study this morethanks the same to both

regards,

2011/11/20 João Rossa joao.ro...@gmail.com

 Thanks guys. The idea was to call a unique class whenever an activity had
 the need to launch tasks, but since i have parent activity where all the
 activities extend from, they would call the async task and each one would
 have a method that would used in the doinbackground method of said async
 task. Right now im using no reference to the activity in the doinbackground
 but because of this im extending the asynctask class i've created to
 acomodate the different needs to the different activities, but i thought it
 would be more direct if i had the logic to run in the async tasks right in
 the activities

 regards,


 On Sat, Nov 19, 2011 at 1:19 PM, Kostya Vasilyev kmans...@gmail.comwrote:

  Hi,

 The original code that you posted did contain concurrent (multithreaded)
 reads and writes of the activity member variable. That concurrency was
 causing null pointed exceptions in a *seemingly* impossible place. The
 reason, as far as I can tell, you had concurrent access to the member
 variable was that you wanted to delegate the actual background work to the
 activity, while keeping your async task implementation generic and unaware
 of the exact nature of background work.

 So, with this in mind, I can see two ways of fixing things:

 1) Keeping your way of structuring the code, and adding proper thread
 synchronization.

 Here is one way:

 void detach() {
 synchronized(this) {
 this.activity = null
 }
 }

 ... elsewhere (IIRC)...

 void the_method_where_you_were_getting_a_null_pointer_exception() {
 MyActivityClass checkedActivity;
 synchronized(this) {
 checkedActivity = this.activity;
 }
 if (checkedActivity != null) {
 .
 }
 }

 There are other things to be careful with here, for example, the activity
 may be paused, stopped, or its onDestroy called (on the UI thread) while
 the async task's thread is still in its worker method. Accesses to member
 variables of activity would also need to be synchronized, or preferably
 avoided So don't undertake this unless you've learned at least the
 basics of concurrent programming.

 2) Restructuring the code in a more orthodox way, as described in the
 docs and was already suggested on this thread by Streets of Boston and
 TreKing (IIRC).

 Have your AsyncTask perform the work without delegating to the activity,
 and only reference the activity (if any) on the UI thread, in
 onPostExecute. This way you'll be avoiding concurrent reads/writes of the
 activity member variable, because onPostExecute and detach are both
 executed on the UI thread.

 Hope this helps.

 -- Kostya

 19.11.2011 7:40, Bluemercury пишет:

 Hi there! Sorry for posting here again, but i was hoping if i could try
 this sample, you said to put the synchronized in the detach method here:

  void detach() {
  *activity=null;*
  }

  in the asynctask, is this correct?but detach() is only called in the
 activity and not the in the async task itself, i thought synchronized
 methods assumed that they're both launched from 2 different threadsbut
 in this case the activity(UI thread) calls the detach method like you said,
 but the async task doesnt, only the attach method...
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


 --
 Kostya Vasilyev

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




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

[android-developers] Re: Phone model penetration

2011-11-20 Thread Efi Merdler-Kravitz
Found something cheaper - http://www.appbrain.com/stats/top-android-phones
Although it doesn't contain everything, but it's better than nothing.

On Nov 20, 3:03 pm, Mark Murphy mmur...@commonsware.com wrote:
 Pay for a market survey report from Gartner or similar firms. I hope
 you have a deep wallet.

 On Sun, Nov 20, 2011 at 4:13 AM, Efi Merdler-Kravitz

 efi.merd...@gmail.com wrote:
  Where can I find reliable information on the various Android phone
  model, their latest Android version and their penetration rate in the
  US/Global market, in other words I want to know which phones are the
  most popular.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Remove menu if no camera found?

2011-11-20 Thread limtc
Thank you!

I will try this now! :)

On 11月20日, 下午8时56分, Mark Murphy mmur...@commonsware.com wrote:
 On Sun, Nov 20, 2011 at 12:14 AM, limtc thyech...@gmail.com wrote:
  I have a menu item in menu.xml that allows user to click and use
  camera.

  Since now there are more devices without camera (Kindle Fire, etc),
  would like to remove menu (or disable it) if no camera detected. Has
  anybody done this before?

 What is this?

 If this is detect whether there is a camera, between PackageManager
 and hasSystemFeature() and the Camera class on API Level 9+, you have
 options for detecting it.

 If this is disable or remove a menu item, just find the MenuItem by
 ID from your Menu and call the appropriate setter (e.g.,
 setEnabled()). Until such time as we have to worry about cameras
 coming and going, you could just do this as part of our
 onCreateOptionsMenu() logic.

 If this is something else, use fewer pronouns. :-)

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Where are the XML attributes of the TabHost

2011-11-20 Thread wyo
I'd like to show the tabs at the bottom instead of the top and guess
there must be a layout attribute yet I can't find it.

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


Re: [android-developers] Where are the XML attributes of the TabHost

2011-11-20 Thread Mark Murphy
http://lmgtfy.com/?q=android+tabhost+tabs+bottom

On Sun, Nov 20, 2011 at 8:21 AM, wyo otto.w...@orpatec.ch wrote:
 I'd like to show the tabs at the bottom instead of the top and guess
 there must be a layout attribute yet I can't find it.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Re: Phone model penetration

2011-11-20 Thread Mark Murphy
Sorry, you asked for reliable information in your original request.
I thought that you really meant it. My apologies.

On Sun, Nov 20, 2011 at 8:16 AM, Efi Merdler-Kravitz
efi.merd...@gmail.com wrote:
 Found something cheaper - http://www.appbrain.com/stats/top-android-phones
 Although it doesn't contain everything, but it's better than nothing.

 On Nov 20, 3:03 pm, Mark Murphy mmur...@commonsware.com wrote:
 Pay for a market survey report from Gartner or similar firms. I hope
 you have a deep wallet.

 On Sun, Nov 20, 2011 at 4:13 AM, Efi Merdler-Kravitz

 efi.merd...@gmail.com wrote:
  Where can I find reliable information on the various Android phone
  model, their latest Android version and their penetration rate in the
  US/Global market, in other words I want to know which phones are the
  most popular.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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




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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Remove menu if no camera found?

2011-11-20 Thread limtc
I have a related note - without a camera-less device, how do I test?

Is it able to set up a AVD without a camera?

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

2011-11-20 Thread Efi Merdler-Kravitz
:-)
Why do you think appbrain are not reliable ?

On Nov 20, 3:21 pm, Mark Murphy mmur...@commonsware.com wrote:
 Sorry, you asked for reliable information in your original request.
 I thought that you really meant it. My apologies.

 On Sun, Nov 20, 2011 at 8:16 AM, Efi Merdler-Kravitz









 efi.merd...@gmail.com wrote:
  Found something cheaper -http://www.appbrain.com/stats/top-android-phones
  Although it doesn't contain everything, but it's better than nothing.

  On Nov 20, 3:03 pm, Mark Murphy mmur...@commonsware.com wrote:
  Pay for a market survey report from Gartner or similar firms. I hope
  you have a deep wallet.

  On Sun, Nov 20, 2011 at 4:13 AM, Efi Merdler-Kravitz

  efi.merd...@gmail.com wrote:
   Where can I find reliable information on the various Android phone
   model, their latest Android version and their penetration rate in the
   US/Global market, in other words I want to know which phones are the
   most popular.

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

  _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Layout Question

2011-11-20 Thread Kubilay D . Yılmaz
if i put green diamond to under another child linearlayout, result will not
change, because parent linearlayout fill its height what it has inside it.
so what should be the solution

On 20 November 2011 15:00, Mark Murphy mmur...@commonsware.com wrote:

 You have your green diamond as a child of the LinearLayout. It is not
 a child of the LinearLayout in your desired result.

 On Sun, Nov 20, 2011 at 7:51 AM, Kubilay D. Yılmaz
 kubilayd.yil...@gmail.com wrote:
  Hi Friends;
  I have a problem with layout.
  I have 4 images,
 
  redbackground.png 80px
  triangle.png 80px
  star.png 80px
  green_diamond.png 160px
 
  I want to show these images like attached file as shouldbe.png
  My layout xml is like
   //above layout fit
  LinearLayout
  android:id=@+id/linearLayout1
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:layout_gravity=bottom
  android:background=@drawable/red_background
  android:gravity=center 
  ImageView
  android:id=@+id/imagetriangle
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:layout_weight=1
  android:src=@drawable/triangle
  android:onClick=backClicked
  /
  ImageView
  android:id=@+id/imgb
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:layout_weight=1
  android:src=@drawable/green_diamond /
  ImageView
  android:id=@+id/imageright
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:layout_weight=1
  android:src=@drawable/star
  android:onClick=digerClicked
 
   /
  /LinearLayout
  However it shows as wrong.png. Problem is that I have to put background
  image only for 80px
  thank you for your advice.
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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

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

2011-11-20 Thread Mark Murphy
On Sun, Nov 20, 2011 at 8:52 AM, Efi Merdler-Kravitz
efi.merd...@gmail.com wrote:
 :-)
 Why do you think appbrain are not reliable ?

Well, I suppose it depends on how you define reliable. It is
absolutely reliable as a picture of the most popular devices among
AppBrain users, barring AppBrain screwing up the counts somehow. If
you believe that AppBrain users are representative of your target
audience, then it should be fine for you. I think AppBrain users are
not representative of the general Android user population (most of
whom have probably never heard of AppBrain), and so this data might
skew more towards more-powerful devices, but that's just me.

Any survey, whether free or fancy-paid ones, will have some sort of
bias. The stuff on the Android developer site for API levels, for
example, is only for requests made to the Android Market and therefore
will miss Market-less devices (Kindle Fire, various flavors of Nook,
first-generation ARCHOS tablets, etc.).

My apologies for the attitude I copped on my previous reply -- I'm a
bit short on sleep.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Layout Question

2011-11-20 Thread Mark Murphy
On Sun, Nov 20, 2011 at 8:57 AM, Kubilay D. Yılmaz
kubilayd.yil...@gmail.com wrote:
 if i put green diamond to under another child linearlayout, result will not
 change, because parent linearlayout fill its height what it has inside it.
 so what should be the solution

The green diamond should be *outside* the LinearLayout.

RelativeLayout
  LinearLayout
  green diamond

By having the green diamond appear later in the RelativeLayout parent,
it will float over top of the red LinearLayout. Yet the size of the
red LinearLayout will not be related to the size of the green diamond.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Re: Remove menu if no camera found?

2011-11-20 Thread Mark Murphy
On Sun, Nov 20, 2011 at 8:35 AM, limtc thyech...@gmail.com wrote:
 I have a related note - without a camera-less device, how do I test?

 Is it able to set up a AVD without a camera?

When you create the AVD, in the Hardware area, click the New... button
and choose Camera support. It will then default to no. I haven't
tried this, but it presumably works.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Auto-rotate screen flag

2011-11-20 Thread viktor
Any solutions?

On 17 Лис, 21:56, viktor victor.scherb...@gmail.com wrote:
 Is it possible to check ifAuto-rotatescreen is aloved?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Remove menu if no camera found?

2011-11-20 Thread limtc
Hi,

I actually tried this: I set up a KindleFire AVD with Camera
support=no.

I am doing experiment:
--
 public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);

PackageManager packageManager = getPackageManager();
hasCamera =
packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA);
Log.d(Kids Paint, has camera:  + hasCamera);

return true;
}
--

But the answer is has camera: true.

On 11月20日, 下午10时01分, Mark Murphy mmur...@commonsware.com wrote:

 When you create the AVD, in the Hardware area, click the New... button
 and choose Camera support. It will then default to no. I haven't
 tried this, but it presumably works.

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

2011-11-20 Thread Kubilay D . Yılmaz
Dear Mark,
Thank you for your concern however,
My code is on below and result is same.

RelativeLayout
android:id=@+id/relativeLayout1
android:layout_width=fill_parent
android:layout_height=match_parent
android:layout_gravity=center 

LinearLayout
android:id=@+id/linearLayout1
android:layout_width=match_parent
android:layout_height=match_parent
android:background=@drawable/background 

ImageView
android:id=@+id/imgTriangle
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_weight=1
android:src=@drawable/imgTriangle /

ImageView
android:id=@+id/imgStar
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_weight=1
android:src=@drawable/imgStar /
/LinearLayout

ImageView
android:id=@+id/imgDiamond
android:layout_width=fill_parent
android:layout_height=fill_parent
android:layout_gravity=center_horizontal
android:src=@drawable/imgDiamond /
/RelativeLayout


On 20 November 2011 16:00, Mark Murphy mmur...@commonsware.com wrote:

 On Sun, Nov 20, 2011 at 8:57 AM, Kubilay D. Yılmaz
 kubilayd.yil...@gmail.com wrote:
  if i put green diamond to under another child linearlayout, result will
 not
  change, because parent linearlayout fill its height what it has inside
 it.
  so what should be the solution

 The green diamond should be *outside* the LinearLayout.

 RelativeLayout
  LinearLayout
  green diamond

 By having the green diamond appear later in the RelativeLayout parent,
 it will float over top of the red LinearLayout. Yet the size of the
 red LinearLayout will not be related to the size of the green diamond.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


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

2011-11-20 Thread Efi Merdler-Kravitz
That's fine. Appreciate your response.

On Nov 20, 3:58 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Sun, Nov 20, 2011 at 8:52 AM, Efi Merdler-Kravitz

 efi.merd...@gmail.com wrote:
  :-)
  Why do you think appbrain are not reliable ?

 Well, I suppose it depends on how you define reliable. It is
 absolutely reliable as a picture of the most popular devices among
 AppBrain users, barring AppBrain screwing up the counts somehow. If
 you believe that AppBrain users are representative of your target
 audience, then it should be fine for you. I think AppBrain users are
 not representative of the general Android user population (most of
 whom have probably never heard of AppBrain), and so this data might
 skew more towards more-powerful devices, but that's just me.

 Any survey, whether free or fancy-paid ones, will have some sort of
 bias. The stuff on the Android developer site for API levels, for
 example, is only for requests made to the Android Market and therefore
 will miss Market-less devices (Kindle Fire, various flavors of Nook,
 first-generation ARCHOS tablets, etc.).

 My apologies for the attitude I copped on my previous reply -- I'm a
 bit short on sleep.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Layout Question

2011-11-20 Thread Mark Murphy
On Sun, Nov 20, 2011 at 9:23 AM, Kubilay D. Yılmaz
kubilayd.yil...@gmail.com wrote:
 Dear Mark,
 Thank you for your concern however,
 My code is on below and result is same.

In your original solution, the height of the red LinearLayout is
driven by the height of the green diamond. Now, it is not.

If it is still not giving you what you want, you will have to keep
working. Use Hierarchy View to help you inspect your layout at
runtime, as it may give you some more clues.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Re: Tutorial HelloTabWidget crashes

2011-11-20 Thread Robinns
That is what you missed.

On Sun, Nov 20, 2011 at 6:54 PM, wyo otto.w...@orpatec.ch wrote:

 Well then why isn't it documented in the tutorial?

 I've now simply duplicated the app activitiy and replaced the name
 like

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

 yet I've no idea if this is correct or what all these means. So far it
 seems to work.

 On Nov 20, 12:07 pm, HideCheck hidech...@gmail.com wrote:
  Manifest file must be added to ArtistsActivity, AlbumsActivity, and
  SongsActivity.
 
  http://developer.android.com/resources/tutorials/views/hello-tabwidge...
  -
  Notice that this doesn't use a layout file. Just create a TextView,
  give it some text and set that as the content. Duplicate this for each
  of the three activities, and add the corresponding activity/ tags to
  the Android Manifest file.
 
  -
 
  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




-- 
Robin

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

2011-11-20 Thread HideCheck
for example

http://code.google.com/p/the-best-music-app/source/browse/trunk/+the-best-music-app+--username+sherm.g.c%40gmail.com/HelloTabWidget/AndroidManifest.xml?r=10

2011/11/21 Robinns librain.ro...@gmail.com:
 That is what you missed.

 On Sun, Nov 20, 2011 at 6:54 PM, wyo otto.w...@orpatec.ch wrote:

 Well then why isn't it documented in the tutorial?

 I've now simply duplicated the app activitiy and replaced the name
 like

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

 yet I've no idea if this is correct or what all these means. So far it
 seems to work.

 On Nov 20, 12:07 pm, HideCheck hidech...@gmail.com wrote:
  Manifest file must be added to ArtistsActivity, AlbumsActivity, and
  SongsActivity.
 
  http://developer.android.com/resources/tutorials/views/hello-tabwidge...
  -
  Notice that this doesn't use a layout file. Just create a TextView,
  give it some text and set that as the content. Duplicate this for each
  of the three activities, and add the corresponding activity/ tags to
  the Android Manifest file.
 
  -
 
  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


 --
 Robin

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

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


[android-developers] Re: Remove menu if no camera found?

2011-11-20 Thread limtc
I am still searching around and found this thread:

http://www.mail-archive.com/android-developers@googlegroups.com/msg102196.html

Seems like still need to test on real device?

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


[android-developers] Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread olefevre
So, having upgraded to ADT r15 I am now getting scores of these errors
in the layout editor. Let me emphasize that it used to work fine
before (that is, in r13), that the compilation is clean and the app
runs just fine: it's only when you try to open a layout in the layout
editor that you get these errors; in short they are 100% spurious.
They are rampant: pretty much every layout with an include triggers
one, and ineradicable: no amount of re-building, cleaning or even
deleting and re-creating the project will make them go away.

What happened? This is a very big deal as it makes the layout editor
all but useless and that was the single most valuable bit of the ADT
(for me at any rate).

-- O.L.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread Mark Murphy
FWIW, I have never seen that error. Moreover, if everyone were seeing
those errors, we'd've heard about them by now.

Hence, it is most likely something peculiar to your environment,
projects, or both.

What version of Eclipse are you on?

On Sun, Nov 20, 2011 at 11:09 AM, olefevre lefev...@googlemail.com wrote:
 So, having upgraded to ADT r15 I am now getting scores of these errors
 in the layout editor. Let me emphasize that it used to work fine
 before (that is, in r13), that the compilation is clean and the app
 runs just fine: it's only when you try to open a layout in the layout
 editor that you get these errors; in short they are 100% spurious.
 They are rampant: pretty much every layout with an include triggers
 one, and ineradicable: no amount of re-building, cleaning or even
 deleting and re-creating the project will make them go away.

 What happened? This is a very big deal as it makes the layout editor
 all but useless and that was the single most valuable bit of the ADT
 (for me at any rate).

 -- O.L.

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




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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread B Lyon
is it only when includes are involved?  might be related to this

http://code.google.com/p/android/issues/detail?id=21051

starting eclipse with  -clean worked for me, but I think that might
not have worked for some folks

On Sun, Nov 20, 2011 at 11:09 AM, olefevre lefev...@googlemail.com wrote:
 So, having upgraded to ADT r15 I am now getting scores of these errors
 in the layout editor. Let me emphasize that it used to work fine
 before (that is, in r13), that the compilation is clean and the app
 runs just fine: it's only when you try to open a layout in the layout
 editor that you get these errors; in short they are 100% spurious.
 They are rampant: pretty much every layout with an include triggers
 one, and ineradicable: no amount of re-building, cleaning or even
 deleting and re-creating the project will make them go away.

 What happened? This is a very big deal as it makes the layout editor
 all but useless and that was the single most valuable bit of the ADT
 (for me at any rate).

 -- O.L.

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

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


Re: [android-developers] AsyncTask null exception for the activity reference in the doInBackground method while rotating.

2011-11-20 Thread Streets Of Boston
This will work if you just want to get rid of the null pointer exceptions.

However, you just should never do any background work in an activity, i.e. 
run code in an Activity on the stack of a background thread (in your case, 
calling Activity.doBackgroundRequest()). It will set you up for problems.

It is unlikely, but not impossible, that the UI thread kicks in after a 
phone rotation, between the assignment of checkedActivity and the execution 
of checkedActivity.doBackgroundRequest(), and calls the onDestroy of the 
activity. How would that behave for your app?

The proper way of doing this is to execute code in the background that does 
*not* require an activity (or any UI type of object) to be accessed. If 
this background processing yields a result that needs to be communicated to 
the screen (Activity/View/etc), then you'll implement onPostExecute to do 
so.

*Refactor *your code do move the code in 'doBackgroundRequest' out of your 
activity and put it into your subclass of AsyncTask instead. If you need 
pieces of data from your activity, assign just those pieces to the new 
QuadrosMobileActivityTask object when you construct it.

If you access your activity in the construction of the AsyncTask and in the 
onPreExecute and onPostExecute only, you no longer need to use 
'synchronized' blocks anymore... all access is done on one thread (the main 
UI thread) only. 




-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread Streets Of Boston
Starting *eclipse.exe -clean *got rid of this problem... but only 
temporarily! As soon as I moved from a library project to a sub-project or 
vice-versa, the same problem occurs. Doing the *-clean *again, would get 
rid of it again, but temporarily :-)

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] AsyncTask null exception for the activity reference in the doInBackground method while rotating.

2011-11-20 Thread João Rossa
Hi Streets, yeah currently im using the logic to run in the background
thread out of the activity, but i was yet to try this approach, but it
seems that its unanimously not the best option to take...
I was considering for the sake of creating less classes, in this case im
extending the async task and then implement the doInBackground() method for
each one

regards,

On Sun, Nov 20, 2011 at 5:23 PM, Streets Of Boston
flyingdutc...@gmail.comwrote:

 This will work if you just want to get rid of the null pointer exceptions.

 However, you just should never do any background work in an activity, i.e.
 run code in an Activity on the stack of a background thread (in your case,
 calling Activity.doBackgroundRequest()). It will set you up for problems.

 It is unlikely, but not impossible, that the UI thread kicks in after a
 phone rotation, between the assignment of checkedActivity and the execution
 of checkedActivity.doBackgroundRequest(), and calls the onDestroy of the
 activity. How would that behave for your app?

 The proper way of doing this is to execute code in the background that
 does *not* require an activity (or any UI type of object) to be accessed.
 If this background processing yields a result that needs to be communicated
 to the screen (Activity/View/etc), then you'll implement onPostExecute to
 do so.

 *Refactor *your code do move the code in 'doBackgroundRequest' out of
 your activity and put it into your subclass of AsyncTask instead. If you
 need pieces of data from your activity, assign just those pieces to the new
 QuadrosMobileActivityTask object when you construct it.

 If you access your activity in the construction of the AsyncTask and in
 the onPreExecute and onPostExecute only, you no longer need to use
 'synchronized' blocks anymore... all access is done on one thread (the main
 UI thread) only.




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


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

[android-developers] SDK 4, if I select WXGA resolution, emulator doesn't start.

2011-11-20 Thread sblantipodi
After the latest update it is not possible to start Emulator using
WXGA resolution,
this is an old problem.
Is there someone who succed to use API Level 14 with WXGA res?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Please Help with GPS Provider Switch

2011-11-20 Thread Tommy Hartz
The timer is there to only allow it to check for 30 seconds. Once the 30
seconds are up if it hasn't got a location it cancels the GPS and tries the
Passive, after 30 seconds it stops the passive and goes to network. The
problem is once it gets to the network nothing happens.

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Deepu George Jacob
Sent: Saturday, November 19, 2011 11:07 AM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Re: Please Help with GPS Provider Switch

 

GPS never use timer it will automatically update At first check your is
GPS enabled..It also done by programatically ... To check the location
changed by using location.getSpeed(); location.getLatitude() some thing like
that 

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

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Is Spinner.setOnItemClickListener() supposed to work, or not?

2011-11-20 Thread Kostya Vasilyev
Have you tried setOnItemSelectedListener instead?

2011/11/20 David Karr davidmichaelk...@gmail.com

 I'm looking at the 3.2 API for android.widget.Spinner.  The
 documentation for public void setOnItemClickListener
 (AdapterView.OnItemClickListener l) says this:

 A spinner does not support item click events. Calling this method will
 raise an exception.

 I'm also looking at the sample code from an Android book, which uses this
 method, and this works perfectly fine.

 What's up with this?

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

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

[android-developers] Is Spinner.setOnItemClickListener() supposed to work, or not?

2011-11-20 Thread David Karr
I'm looking at the 3.2 API for android.widget.Spinner.  The documentation 
for public void setOnItemClickListener (AdapterView.OnItemClickListener 
l) says this:

A spinner does not support item click events. Calling this method will 
raise an exception.

I'm also looking at the sample code from an Android book, which uses this 
method, and this works perfectly fine.

What's up with this?

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

Re: [android-developers] Layout Question

2011-11-20 Thread David Karr
I would think that changing the layout_height of the LinearLayout to 
wrap_content would help. With what you have, both children of the 
RelativeLayout are set to fill_parent, so they'll have the same height.

Also, I would recommend you make up your mind whether you're going to use 
fill_parent or match_parent. It's annoying to use both of them.

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

Re: [android-developers] Is Spinner.setOnItemClickListener() supposed to work, or not?

2011-11-20 Thread David Karr
Oh, duh.  That was actually the one I was using. I didn't notice the 
difference.

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

2011-11-20 Thread Kristopher Micinski
And be sure to put the code somewhere public when you finish, it seems
like you should be able to do this :-)

kris

On Sun, Nov 20, 2011 at 4:09 AM, Kostya Vasilyev kmans...@gmail.com wrote:
 You should be able to do it by subclassing ReplacementSpan:

 http://developer.android.com/reference/android/text/style/ReplacementSpan.html

 ... which lets you do the drawing yourself, rather than modifying a
 TextPaint.

 -- Kostya

 20.11.2011 8:24, Jay пишет:

 I have actually already considered that. The StrikethruSpan class just
 sets the strikethru bit on the Paint that is passed through it; there
 does not seem to be a separate field for strikethru color.
 Unfortunately, I cannot find any documentation of the entry points
 that custom Spans have available to modify the drawing process, so I
 don't know how to implement custom-colored strikethru by hand. I
 will continue to chase through the source, but would appreciate any
 insight anyone can provide as to how the Span classes interact with
 the text.

 Jay

 On Nov 19, 9:41 pm, Zsolt Vasvarizvasv...@gmail.com  wrote:

 Get the source code for the class that implements strikethru and
 modiify it to your liking.

 On Nov 20, 4:43 am, Jayjohnabloodwor...@gmail.com  wrote:







 Is it possible to to create a span of text in a textview in which the
 strikethru line is a different color than the text. I cannot find much
 documentation on the SpannableString interface.
 Thanks,
 Jay

 --
 Kostya Vasilyev

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

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


Re: [android-developers] Is Spinner.setOnItemClickListener() supposed to work, or not?

2011-11-20 Thread Kostya Vasilyev
That comment about Calling this method will raise an exception only
appears under Spinner.setOnItemClickListener.

The setOnItemSelectedListener is inherited from AdapterView, there is
no warning about it being unsupported, and it definitely works on 3.2.

So I'm not clear as to which one you're actually using and having trouble with.

-- Kostya

2011/11/20 David Karr davidmichaelk...@gmail.com

 Oh, duh.  That was actually the one I was using. I didn't notice the 
 difference.

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

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


Re: [android-developers] Is Spinner.setOnItemClickListener() supposed to work, or not?

2011-11-20 Thread David Karr
When someone says Oh, duh, that's an idiom for I understand now.

I was using Selected, but I read the advice on Click, and I didn't 
notice the difference in method names. I don't have an issue anymore.

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

Re: [android-developers] Is Spinner.setOnItemClickListener() supposed to work, or not?

2011-11-20 Thread Kostya Vasilyev
2011/11/21 David Karr davidmichaelk...@gmail.com:
 When someone says Oh, duh, that's an idiom for I understand now.

I know :)

 I was using Selected, but I read the advice on Click, and I didn't

It just seemed like you maybe kept using the wrong one, despite the
oh duh moment. Sorry if I misunderstood.

 notice the difference in method names. I don't have an issue anymore.

Ok, great.


 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

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

2011-11-20 Thread Royston
Mark,
It appears you are correct. If i run up a large emulator at 3.2 I
get the menu option but not at 3.1 or 3.0. I am not quite sure what
one should do to manage this situation. If there exists a 3.1 or 3.0
Large device, there would be no access to menus. Any advice on how to
deal with this would be much appreciated.

Regards

Roy


On Nov 19, 1:03 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Nov 19, 2011 at 6:19 AM, Royston roystonpcar...@gmail.com wrote:
  But on a Large emulator I still get this behavior i.e. no menu
  overflow icon so no obvious access to menus!

 Which SDK are you using? IIRC, -large support was not added until 3.1
 or 3.2. -xlargewas there from 3.0, and I have several examples
 demonstrating it working. The only times I have not seen the overflow
 menu is if either there is no options menu or you do not have
 targetSdkVersion=11 or higher.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Action Bar

2011-11-20 Thread Royston
Mark,
It appears you are correct. If i run up a large emulator at 3.2 I
get the menu option but not at 3.1 or 3.0. I am not quite sure what
one should do to manage this situation. If there exists a 3.1 or 3.0
Large device, there would be no access to menus. Any advice on how to
deal with this would be much appreciated.

Regards

Roy


On Nov 19, 1:03 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Nov 19, 2011 at 6:19 AM, Royston roystonpcar...@gmail.com wrote:
  But on a Large emulator I still get this behavior i.e. no menu
  overflow icon so no obvious access to menus!

 Which SDK are you using? IIRC, -large support was not added until 3.1
 or 3.2. -xlargewas there from 3.0, and I have several examples
 demonstrating it working. The only times I have not seen the overflow
 menu is if either there is no options menu or you do not have
 targetSdkVersion=11 or higher.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


Re: [android-developers] Re: Action Bar

2011-11-20 Thread Mark Murphy
On Sun, Nov 20, 2011 at 4:24 PM, Royston roystonpcar...@gmail.com wrote:
 It appears you are correct. If i run up a large emulator at 3.2 I
 get the menu option but not at 3.1 or 3.0. I am not quite sure what
 one should do to manage this situation. If there exists a 3.1 or 3.0
 Large device, there would be no access to menus. Any advice on how to
 deal with this would be much appreciated.

There are no 3.0/3.1 -large devices. The ~7 tablet size was not
supported until Android 3.2.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread olefevre
On Nov 20, 5:38 pm, Mark Murphy mmur...@commonsware.com wrote:
 FWIW, I have never seen that error. Moreover, if everyone were seeing
 those errors, we'd've heard about them by now.

Mark, with all dues respect, you write example code for a manual; that
is not real-world code. According to the bug entry obligingly pointed
to by B Lyon I am hardly alone in my predicament.

 What version of Eclipse are you on?

Indigo on Windows XP 32bit.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread olefevre
On Nov 20, 6:12 pm, B Lyon bradfl...@gmail.com wrote:
 is it only when includes are involved?  might be related to this
 http://code.google.com/p/android/issues/detail?id=21051

That totally looks like my problem indeed; my project even reference a
library, too. Since the handling of libraries has changed in r14/15
they might indeed be involved in this somehow.

 starting eclipse with  -clean worked for me, but I think that might
 not have worked for some folks

Yes, if one thing is sure with Eclipse it is that whatever problem you
have will recur. I hate the thing and wouldn't use it if the layout
editor wasn't such a life saver.

Now, I looked at the shortcut I am using to start Eclipse and the bad
news is that I am already starting it with -clean.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread Kostya Vasilyev
Have you tried making a fresh workspace and importing a fresh copy of your
sources?

--
Kostya Vasilyev
21.11.2011 2:11 пользователь olefevre lefev...@googlemail.com написал:

 On Nov 20, 6:12 pm, B Lyon bradfl...@gmail.com wrote:
  is it only when includes are involved?  might be related to this
  http://code.google.com/p/android/issues/detail?id=21051

 That totally looks like my problem indeed; my project even reference a
 library, too. Since the handling of libraries has changed in r14/15
 they might indeed be involved in this somehow.

  starting eclipse with  -clean worked for me, but I think that might
  not have worked for some folks

 Yes, if one thing is sure with Eclipse it is that whatever problem you
 have will recur. I hate the thing and wouldn't use it if the layout
 editor wasn't such a life saver.

 Now, I looked at the shortcut I am using to start Eclipse and the bad
 news is that I am already starting it with -clean.

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

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

Re: [android-developers] Re: Lots of the layout ID xyz is not valid errors in ADT r15

2011-11-20 Thread Mark Murphy
On Sun, Nov 20, 2011 at 5:08 PM, olefevre lefev...@googlemail.com wrote:
 On Nov 20, 5:38 pm, Mark Murphy mmur...@commonsware.com wrote:
 FWIW, I have never seen that error. Moreover, if everyone were seeing
 those errors, we'd've heard about them by now.

 Mark, with all dues respect, you write example code for a manual; that
 is not real-world code.

You don't know all of what I do. Not all of my work is for public display.

 According to the bug entry obligingly pointed
 to by B Lyon I am hardly alone in my predicament.

Sorry, I missed the reference to include in your original complaint.
That certainly narrows the scope -- my original take was that you were
indicating that everyone would be experiencing this problem on all
layouts in all projects.

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

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] How to set submenu header icon in XML?

2011-11-20 Thread limtc
I used to use program menu using Java and I can add icon to submenu.

http://developer.android.com/reference/android/view/SubMenu.html#setHeaderIcon(int)

As I am switching to XML format for menu, I am wondering how do I add
icon to submenu? It does not seem to have an icon attribute for
menu.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 apply preference style in user-defined theme

2011-11-20 Thread Bacon021
My god, Does Google can't give any advice?

On 11月16日, 下午7时54分, Bacon021 wei.pg...@gmail.com wrote:
 I defined a theme with an item named android:preferenceStyle, how
 ever when I apply this theme to some activity, the related preference
 items' style are still not what I defined.
 The following is my style I defined and the usage.

 frameworks\base\core\res\res\values\themes.xml:

 style name=CustomActivityTheme
 item name=android:windowBackground@drawable/bg_color/
 item
 item name=android:preferenceStyle@android:style/MyPreference/
 item
 item name=android:windowTitleSize54dip/item
 /style

 frameworks\base\core\res\res\values\styles.xml:

 style name=MyPreference
 item name=android:layout@android:layout/my_preference_layout/
 item
 /style

 in CustomActivityTheme, the windowBackground has effect I can change
 the color what I need, but MyPreference won't work, that means the
 layout does't work.

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


[android-developers] Is the ICS emulator calendar sync broken?

2011-11-20 Thread GJTorikian
I created a new emulator with the Level 14 Google APIs. I can add my
Google account, but sync is off, with no discernable way to turn it
back on.

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


[android-developers] Re: Is the ICS emulator calendar sync broken?

2011-11-20 Thread Zsolt Vasvari
Yes, this has been discussed extensively.  You cannot use a Google
account for syncing calendars on the emulator.  You can use an
Exchange account, though, with a gmail address and a blank domain.

On Nov 21, 11:01 am, GJTorikian gjtorik...@gmail.com wrote:
 I created a new emulator with the Level 14 Google APIs. I can add my
 Google account, but sync is off, with no discernable way to turn it
 back on.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 apply preference style in user-defined theme

2011-11-20 Thread William Ferguson
I'm pretty certain there is no such style property as
android:layout. Layout is NOT style.
What are you trying to do?

William


On Nov 21, 12:13 pm, Bacon021 wei.pg...@gmail.com wrote:
 My god, Does Google can't give any advice?

 On 11月16日, 下午7时54分, Bacon021 wei.pg...@gmail.com wrote:







  I defined a theme with an item named android:preferenceStyle, how
  ever when I apply this theme to some activity, the related preference
  items' style are still not what I defined.
  The following is my style I defined and the usage.

  frameworks\base\core\res\res\values\themes.xml:

  style name=CustomActivityTheme
  item name=android:windowBackground@drawable/bg_color/
  item
  item name=android:preferenceStyle@android:style/MyPreference/
  item
  item name=android:windowTitleSize54dip/item
  /style

  frameworks\base\core\res\res\values\styles.xml:

  style name=MyPreference
  item name=android:layout@android:layout/my_preference_layout/
  item
  /style

  in CustomActivityTheme, the windowBackground has effect I can change
  the color what I need, but MyPreference won't work, that means the
  layout does't work.

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


[android-developers] Re: Is the ICS emulator calendar sync broken?

2011-11-20 Thread GJTorikian
And how would I go about adding contacts, to test viewing/manipulating
contact data? There doesn't seem to be a way to do that.

On Nov 20, 7:13 pm, Zsolt Vasvari zvasv...@gmail.com wrote:
 Yes, this has been discussed extensively.  You cannot use a Google
 account for syncing calendars on the emulator.  You can use an
 Exchange account, though, with a gmail address and a blank domain.

 On Nov 21, 11:01 am, GJTorikian gjtorik...@gmail.com wrote:







  I created a new emulator with the Level 14 Google APIs. I can add my
  Google account, but sync is off, with no discernable way to turn it
  back on.

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


[android-developers] Re: Is the ICS emulator calendar sync broken?

2011-11-20 Thread Zsolt Vasvari
I thought you asked about Calendars, not Contacts

On Nov 21, 12:14 pm, GJTorikian gjtorik...@gmail.com wrote:
 And how would I go about adding contacts, to test viewing/manipulating
 contact data? There doesn't seem to be a way to do that.

 On Nov 20, 7:13 pm, Zsolt Vasvari zvasv...@gmail.com wrote:



  Yes, this has been discussed extensively.  You cannot use a Google
  account for syncing calendars on the emulator.  You can use an
  Exchange account, though, with a gmail address and a blank domain.

  On Nov 21, 11:01 am, GJTorikian gjtorik...@gmail.com wrote:

   I created a new emulator with the Level 14 Google APIs. I can add my
   Google account, but sync is off, with no discernable way to turn it
   back on.- Hide quoted text -

 - Show quoted text -

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


[android-developers] Re: Is the ICS emulator calendar sync broken?

2011-11-20 Thread GJTorikian
I can ask two different questions in one thread

The issue is synching. If I add my Gmail address as an Exchange
account, I get a half-assed way to manipulate the calendar. Fine. But
what if I want to test the way I manipulate contacts in my app? What
if I want to test market licensing on an ICS app?

On Nov 20, 8:32 pm, Zsolt Vasvari zvasv...@gmail.com wrote:
 I thought you asked about Calendars, not Contacts

 On Nov 21, 12:14 pm, GJTorikian gjtorik...@gmail.com wrote:







  And how would I go about adding contacts, to test viewing/manipulating
  contact data? There doesn't seem to be a way to do that.

  On Nov 20, 7:13 pm, Zsolt Vasvari zvasv...@gmail.com wrote:

   Yes, this has been discussed extensively.  You cannot use a Google
   account for syncing calendars on the emulator.  You can use an
   Exchange account, though, with a gmail address and a blank domain.

   On Nov 21, 11:01 am, GJTorikian gjtorik...@gmail.com wrote:

I created a new emulator with the Level 14 Google APIs. I can add my
Google account, but sync is off, with no discernable way to turn it
back on.- Hide quoted text -

  - Show quoted text -

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


[android-developers] No AVDs from Emulator since last update

2011-11-20 Thread gus
I can no longer get any avds to launch.
I can create them, but they will not start (from targets 2.2 up to
4.0)
I am running Windows XP and have the latest updates for eclipse and
android addons.

Problems occurred after updates for both eclipse and android were
installed 3 weeks ago (approx Oct 26th, 2011)
Now I cannot get avds to load.
I have installed and uninstalled the avds.
I have run the emulator from the command line.
I have re-installed sdk tools 15
I have installed latest android and eclipse updates today (Nov21st,
2011)
All to no avail.

The error is ALWAYS the same and the debugger ALWAYS flags the SAME
offset (see below).

I have looked through, and tried, all the 'helps' that I can find
including no snapshot, different resolutions, etc, etc, etc.

I would have hoped the latest updates would fix it -  - but I have now
been without an avd for more than 3 weeks and it is seriously
restricting my work.

Please - Can Anyone Help?!?

Details of problem:

1. Black Screen pops up, titled:
SDL_app

2. then error message:
emulator-arm.exe has encountered a problem and needs to close.  We are
sorry for the inconvenience.

3. and clicking 'further details' gives:
AppName: emulator-arm.exeAppVer: 0.0.0.0 ModName: 
emulator-arm.exe
ModVer: 0.0.0.0  Offset: 00078334

4. and clicking debug gives:
C++ debugger
unhandled exception in emulator-arm.exe: 0xC005: Access Violation
7C901230 int 3
7C901231ret
7C901232mov edi,edi
7C901234nop
7C901235nop
.
.
00478327   mov cl,byte ptr [ebp+8]
0047832A   shl ebx,cl
0047832C   jmp 0047837D
0047832E   ???
0047832F   nop
00478330   mov edx,dword ptr [esp+24h]
00478334   mov eax,dword ptr [edx]
00478336   mov ecx,dword ptr [ebp+10h]
00478339   mov ebx,dword ptr [ebp+14h]
0047833C   and ecx,eax
0047833E   mov edi,eax
00478340   mov dword ptr [esp+4Ch],ecx
00478344   xor ecx,ecx

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 database problem while refering .sql file

2011-11-20 Thread Shajahan
If there are SQLite create/insert statements in .sql (eg.;
createtablestmt.sql) file  .then how it is called from Android Project

Am getting the error that no such table exits in the database ... and
also I dont see any CREATE table statements in the project.

Note :  am refering to some old project to get hold of this concept.

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

2011-11-20 Thread Dav
I was trying to go through the code of android listview . core/java/
android/widget/HeaderViewListAdapter.java core/java/android/widget/
ListView.java

Its bit difficult to figure out how exactly the items go below the
header when you are scrolling,how exactly the headerview remains
fixed . Can anyone give a brief explanation of it ?

I am trying to build fixed headers both vertically and horizontally
for a custom listview.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: second call to setListAdapter() ignored

2011-11-20 Thread eehouse
On Nov 18, 4:15 am, Mark Murphy mmur...@commonsware.com wrote:
 On Thu, Nov 17, 2011 at 10:01 PM, eehouse ho...@gmail.com wrote:
  As far as I can tell, a second call tosetListAdapter( new
  MyCustomAdapter() ) has no effect: the adapter I originally installed
  in my ListActivity subclass's onCreate() method continues to get
  called.  Is this a known problem/feature?

 No.

 Here is an example of an application that successfully callssetListAdapter() 
 multiple times, based on the user choosing a Reset
 option menu choice:

 https://github.com/commonsguy/cw-android/tree/master/Menus/Inflation

Thanks Mark.  I took a look at your code, then modified it to
duplicate the situation I described: added a custom Adapter extending
BaseAdapter and implementing SectionIndexer.  As you said, when I
create a new instance of the Adapter and pass it into setListAdapter()
the new instance is used.  So the problem I described does not exist.

However, the problem that led to my mistaken assumption is duplicated
in your code (as I've modified it): only the first instance of my
custom Adapter ever gets its getSections() method called.  So though
the new Adapter has replaced the original, the Object[] of sections
returned by the original continues to be used.

Does anybody know if there's a way to force the framework to call
getSections() when a new Adapter replaces the one that was called
originally?

I've worked around this problem by creating a new ListActivity
instance each time my data set changes.  It's a bit heavy handed but
does the trick.

Thanks,

--Eric

PS I'll append my diffs below for the sake of completeness.  The
reset menu is what triggers new data.

diff --git a/Menus/Inflation/src/com/commonsware/android/inflation/
InflationDemo.java b/Menus/Inflation/src/com/commonsware/android/
inflation/InflationDemo.java
index 0e182ba..b55a84f 100644
--- a/Menus/Inflation/src/com/commonsware/android/inflation/
InflationDemo.java
+++ b/Menus/Inflation/src/com/commonsware/android/inflation/
InflationDemo.java
@@ -1,3 +1,5 @@
+/* -*- compile-command: cd ../../../../../; ant debug install; -*-
*/
+
 /***
   Copyright (c) 2008-2011 CommonsWare, LLC

@@ -24,23 +26,73 @@ import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.SectionIndexer;
+
+import android.widget.BaseAdapter;

 public class InflationDemo extends ListActivity {
-  private static final String[] items={lorem, ipsum, dolor,
-  sit, amet, consectetuer, adipiscing, elit,
-  morbi, vel, ligula, vitae, arcu, aliquet,
-  mollis, etiam, vel, erat, placerat, ante,
-  porttitor, sodales, pellentesque, augue, purus};
-  private ArrayListString words=null;
+private static final int NUM_WORDS = 1000;
+private static final int NUM_INDICES = 10;
+private int m_counter = 1;
+
+  private class MyListAdapter extends BaseAdapter
+  implements SectionIndexer {
+  private ArrayListString m_words;
+
+  public MyListAdapter() {
+  super();
+  }
+
+  public int getCount() { return NUM_WORDS; }
+
+  public Object getItem( int position )
+  {
+  TextView text = new TextView( InflationDemo.this );
+  text.setText( String.format( %d,
+   position + (NUM_WORDS *
m_counter) ) );
+  return text;
+  }
+
+  public View getView( int position, View convertView, ViewGroup
parent ) {
+  return (View)getItem( position );
+  }
+
+  public long getItemId( int position ) { return position; }
+
+  public int getPositionForSection( int section )
+  {
+  return section * NUM_WORDS / NUM_INDICES;
+  }
+
+  public int getSectionForPosition( int position )
+  {
+  return position * NUM_INDICES / NUM_WORDS;
+  }
+
+  public Object[] getSections()
+  {
+  String[] sections = new String[NUM_INDICES];
+  for ( int ii = 0; ii  NUM_INDICES; ++ii ) {
+  int section = (NUM_WORDS * m_counter)
+  + (ii * (NUM_WORDS/NUM_INDICES));
+  sections[ii] = String.format( %d, section );
+  }
+  return sections;
+  }
+
+  }

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

 initAdapter();
+getListView().setFastScrollEnabled( true );
 registerForContextMenu(getListView());
   }

@@ -59,55 +111,22 @@ public class InflationDemo extends ListActivity {

   @Override
   public boolean onOptionsItemSelected(MenuItem item) {
-switch (item.getItemId()) {
+  switch (item.getItemId()) {
   case R.id.add:
-add();
-return(true);
+  add();
+  return(true);

   case R.id.reset:
-initAdapter();
-   

[android-developers] Re: How to set WebView to follow 302 redirects

2011-11-20 Thread DoubleCheese
Hi,

Some more additional info:
When I use a URLConnection to GET the request it, works and follows
the redirect properly. What I do next is to use this reponse and load
the html to the web view using
webView.loadDataWithBaseURL() - in here I set the baseUrl to the host
I expect.

I also tried to set the following:

webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);

As it seems the pages I load uses javascript to change the
window.location, but when this happens, it doesn't seem to go through
the WebViewClient.

On Nov 20, 1:23 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Nov 19, 2011 at 7:14 PM, DoubleCheese dennis.ang...@gmail.com wrote:
  Thanks for the reply, I am already using a WebViewClient here
  (ThisWebViewClient).

 I noticed that about five seconds after pressing Send... :-)

  However, what I've noticed is that the shouldOverrideUrlLoading()
  seems to be not getting the right hostname and my theory is that the
  302 processing has already happened before the
  shouldOverrideUrlLoading() is called.

  Basically this is what happens:
  1) I callwebView.loadUrl(http://host1/somePath/?param=eg;);  - this
  shouldredirectto http://host2/path2/?otherparam=eg;
  2) When shouldOverrideUrlLoading() is called the url parameter passed
  is not correct and it seems to change it to http://host2/somePath/?
  param=eg

 Can you check the server logs and see what is happening from that side?

 I'm not aware of much else for tailoringredirectbehavior. You might
 dump getOriginalUrl() on theWebViewto see what it reports.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Please Help with GPS Provider Switch

2011-11-20 Thread gjs
Hi,

What's the problem if you start all 3 at once ? Then stop them once
they are not needed. I use GPS  NETWORK providers at the same time 
they work ok.

Regards

On Nov 21, 5:55 am, Tommy Hartz droi...@gmail.com wrote:
 The timer is there to only allow it to check for 30 seconds. Once the 30
 seconds are up if it hasn't got a location it cancels the GPS and tries the
 Passive, after 30 seconds it stops the passive and goes to network. The
 problem is once it gets to the network nothing happens.

 From: android-developers@googlegroups.com
 [mailto:android-developers@googlegroups.com] On Behalf Of Deepu George Jacob
 Sent: Saturday, November 19, 2011 11:07 AM
 To: android-developers@googlegroups.com
 Subject: Re: [android-developers] Re: Please Help with GPS Provider Switch

 GPS never use timer it will automatically update At first check your is
 GPS enabled..It also done by programatically ... To check the location
 changed by using location.getSpeed(); location.getLatitude() some thing like
 that

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

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


Re: [android-developers] Re: second call to setListAdapter() ignored

2011-11-20 Thread Kostya Vasilyev
It seems that the only way to rebuild the fast scroll section data is
to toggle fast scrolling off and on again.

-- Kostya

2011/11/21 eehouse ho...@gmail.com:
 On Nov 18, 4:15 am, Mark Murphy mmur...@commonsware.com wrote:
 On Thu, Nov 17, 2011 at 10:01 PM, eehouse ho...@gmail.com wrote:
  As far as I can tell, a second call tosetListAdapter( new
  MyCustomAdapter() ) has no effect: the adapter I originally installed
  in my ListActivity subclass's onCreate() method continues to get
  called.  Is this a known problem/feature?

 No.

 Here is an example of an application that successfully callssetListAdapter() 
 multiple times, based on the user choosing a Reset
 option menu choice:

 https://github.com/commonsguy/cw-android/tree/master/Menus/Inflation

 Thanks Mark.  I took a look at your code, then modified it to
 duplicate the situation I described: added a custom Adapter extending
 BaseAdapter and implementing SectionIndexer.  As you said, when I
 create a new instance of the Adapter and pass it into setListAdapter()
 the new instance is used.  So the problem I described does not exist.

 However, the problem that led to my mistaken assumption is duplicated
 in your code (as I've modified it): only the first instance of my
 custom Adapter ever gets its getSections() method called.  So though
 the new Adapter has replaced the original, the Object[] of sections
 returned by the original continues to be used.

 Does anybody know if there's a way to force the framework to call
 getSections() when a new Adapter replaces the one that was called
 originally?

 I've worked around this problem by creating a new ListActivity
 instance each time my data set changes.  It's a bit heavy handed but
 does the trick.

 Thanks,

 --Eric

 PS I'll append my diffs below for the sake of completeness.  The
 reset menu is what triggers new data.

 diff --git a/Menus/Inflation/src/com/commonsware/android/inflation/
 InflationDemo.java b/Menus/Inflation/src/com/commonsware/android/
 inflation/InflationDemo.java
 index 0e182ba..b55a84f 100644
 --- a/Menus/Inflation/src/com/commonsware/android/inflation/
 InflationDemo.java
 +++ b/Menus/Inflation/src/com/commonsware/android/inflation/
 InflationDemo.java
 @@ -1,3 +1,5 @@
 +/* -*- compile-command: cd ../../../../../; ant debug install; -*-
 */
 +
  /***
   Copyright (c) 2008-2011 CommonsWare, LLC

 @@ -24,23 +26,73 @@ import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
 +import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.EditText;
 +import android.widget.TextView;
 +import android.widget.SectionIndexer;
 +
 +import android.widget.BaseAdapter;

  public class InflationDemo extends ListActivity {
 -  private static final String[] items={lorem, ipsum, dolor,
 -          sit, amet, consectetuer, adipiscing, elit,
 -          morbi, vel, ligula, vitae, arcu, aliquet,
 -          mollis, etiam, vel, erat, placerat, ante,
 -          porttitor, sodales, pellentesque, augue, purus};
 -  private ArrayListString words=null;
 +    private static final int NUM_WORDS = 1000;
 +    private static final int NUM_INDICES = 10;
 +    private int m_counter = 1;
 +
 +  private class MyListAdapter extends BaseAdapter
 +      implements SectionIndexer {
 +      private ArrayListString m_words;
 +
 +      public MyListAdapter() {
 +          super();
 +      }
 +
 +      public int getCount() { return NUM_WORDS; }
 +
 +      public Object getItem( int position )
 +      {
 +          TextView text = new TextView( InflationDemo.this );
 +          text.setText( String.format( %d,
 +                                       position + (NUM_WORDS *
 m_counter) ) );
 +          return text;
 +      }
 +
 +      public View getView( int position, View convertView, ViewGroup
 parent ) {
 +          return (View)getItem( position );
 +      }
 +
 +      public long getItemId( int position ) { return position; }
 +
 +      public int getPositionForSection( int section )
 +      {
 +          return section * NUM_WORDS / NUM_INDICES;
 +      }
 +
 +      public int getSectionForPosition( int position )
 +      {
 +          return position * NUM_INDICES / NUM_WORDS;
 +      }
 +
 +      public Object[] getSections()
 +      {
 +          String[] sections = new String[NUM_INDICES];
 +          for ( int ii = 0; ii  NUM_INDICES; ++ii ) {
 +              int section = (NUM_WORDS * m_counter)
 +                  + (ii * (NUM_WORDS/NUM_INDICES));
 +              sections[ii] = String.format( %d, section );
 +          }
 +          return sections;
 +      }
 +
 +  }

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

     initAdapter();
 +    getListView().setFastScrollEnabled( true );
     registerForContextMenu(getListView());
   }

 @@ -59,55 +111,22 @@ public class InflationDemo extends ListActivity {

   @Override
   public 

[android-developers] Re: Action Bar

2011-11-20 Thread Zsolt Vasvari
I ran into the same problem, but not until 3.2 as Mark is saying.  I
believe the first (and only?) Large 3.2 device is the Galaxy Tablet 7
Plus.  There have been many other 7 tablets, but they were running
Gingerbread or earlier.



On Nov 21, 5:28 am, Mark Murphy mmur...@commonsware.com wrote:
 On Sun, Nov 20, 2011 at 4:24 PM, Royston roystonpcar...@gmail.com wrote:
  It appears you are correct. If i run up a large emulator at 3.2 I
  get the menu option but not at 3.1 or 3.0. I am not quite sure what
  one should do to manage this situation. If there exists a 3.1 or 3.0
  Large device, there would be no access to menus. Any advice on how to
  deal with this would be much appreciated.

 There are no 3.0/3.1 -large devices. The ~7 tablet size was not
 supported until Android 3.2.

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

 _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

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


[android-developers] Re: Is the ICS emulator calendar sync broken?

2011-11-20 Thread Zsolt Vasvari
 I can ask two different questions in one thread

Sure you can, this is a free country -- just don't expect an
answer

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