[android-developers] Re: Regarding retrieving date and time from cell tower

2011-10-09 Thread gjs
Hi,

You can use time from GPS Location or GPS NEMA strings

regards

On Oct 9, 9:19 pm, sourabh sahu  wrote:
> This is the problem, case is there is no internet and data connectivity,
> only gsm network is available,I dont want to use any internet services.
>
> Please provide any suggestion.
>
> Thanks & Regards,
> Sourabh
>
>
>
>
>
>
>
> On Sun, Oct 9, 2011 at 3:10 AM, Kostya Vasilyev  wrote:
> > Not every cellular network provides date and time.
>
> > I believe it's mandatory for CDMA (because of the nature of the protocol),
> > but some GSM networks don't provide this info.
>
> > If you need an independent time source, consider using NTP to obtain time
> > from the Internet.
>
> > -- Kostya
>
> > 09.10.2011 14:00, sourabh sahu пишет:
>
> >  In my application,I need current date and time, but as of now if user
> >> changes the date of a device.the previous dates are coming.I want it to be
> >> exact current date and time.
> >> Thanks,
> >> sourabh
>
> > --
> > 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 > bscr...@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] close application

2011-10-09 Thread venugopal reddy
Hi friends,

My requirement is , If I close the Emulator browser , automatically
that application should be close..

How can I?

Please help me

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Help: Nexus can't boot - OutOfMemory

2011-10-09 Thread Eric Wong (hdmp4.com)
LOL, sounds like the only way is to do a factory reset
Seems like you already tried everything possible.

On Oct 9, 3:23 pm, David Goldfarb  wrote:
> Ok, I was stupid... My phone repeatedly warned me that I was low on
> memory and I not only ignored the warnings, I installed a game that
> seems to slowly grow its memory usage.
>
> Anyway, my poor phone, a stock Nexus One, finally gave up today. It
> won't reboot.  When it tries it repeatedly crashes with an
> OutOfMemoryError in the ActivityManagerService and other critical
> locations.
>
> So, I'd like to clear out some memory.
>
> But...
> - I can't boot the phone to get the full GUI
> - adb uninstall  (for any app) fails with "Error: Could not
> access the Package Manager.  Is the system running?"
>
> adb logcat and adb shell are working, so I can see what the phone is
> doing and I should be able to delete extraneous rw files.
>
> I don't currently have root.
> I'd really like not to factory reset the phone or lose my current
> configuration.
>
> What's the best way to free up enough space to get the phone to boot?
>
> Thanks, and feeling foolish,
> David

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


[android-developers] Get GPS Location in a Broadcast Receiver.

2011-10-09 Thread shihab Shuvro
hi, i m new in android.

i want to get GPS  Loction  in a broadcast receiver .

but it shows error .my code is here.

public void onReceive(Context context, Intent intent) {

  LocationManager locManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
// erros in getSystemService method
LocationListener locListener = new MyLocationListener();
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
locListener);

Location loc=
locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
  Log.d(" **location**", " location"+loc.getLatitude());

}

question 1. Is it possible to get GPS Location data in Broadcast
receiver.?
2.  Another alternative way i tried so far, use a service which
invokes in Broadcast receiver. the service can get GPS data .but how i
get it in Broadcast receiver ??

Plz help me.

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


[android-developers] Problem with PagerAdapter using various Views

2011-10-09 Thread Dominik Erbsland
I used this tutorial to make a little sample app with the PagerAdapter
to swipe through views smoothly.
http://code.google.com/p/viewpagerexample/source/browse/trunk/AwesomePager/src/com/geekyouup/paug/awesomepager/AwesomePagerActivity.java

But the problem there is that they only use one TextView to swipe
through. What I wanted to do is using three different views through
which the user can slide smoothly. However, I could not figure out how
I have to alter the example code mentioned above. It would be perfect
if I even could use (three different) layout xml files for that but
it's also ok if I have to build the views in the code.

Especially this code part is kind of unclear to me and how I have to
alter it.

public Object instantiateItem(View collection, int position) {
TextView tv = new TextView(cxt);
tv.setText("Bonjour PAUG " + position);
tv.setTextColor(Color.WHITE);
tv.setTextSize(30);

((ViewPager) collection).addView(tv, 0);

return tv;
}

Any help is greatly appreciated.

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


[android-developers] Why dither a bitmap

2011-10-09 Thread dara kok
Can somebody here explain me why dithering is needed in Android?


Thanks
dara kok

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: HTC and LG haven't implemented Android in the right way

2011-10-09 Thread Nightwolf
Probably your source texture image has no any transparency. That's why
black squares are visible. Setting alpha to 0.25f makes your stars
look faded. You should not change the alpha value in glColor4f. You
should prepare star image with transparency.
Anyway I still think that it's possible to get away with point
sprites.

BTW glDrawArrays works fine with other primitive type. Not just
GL_TRIANGLE_STRIP.

On 8 окт, 13:08, MobileVisuals  wrote:
> How do you mean that I should put brightness level in the textures? I
> have already enabled transparency with
>
> gl.glEnable(GL10.GL_BLEND);
> gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
> gl.glColor4f(1f, 1f, 1f, 0.25f);
>
> I see that the transparency have effect, but it doesn't work as well
> as it should. I have also noticed that the black square quads are
> visible. Do you know what I can do to get rid of the black square
> quads? Is there any way to make it as shiny and smooth as it was with
> point sprites?
>
> I use this call to draw the quads:
>
> gl.glDrawElements(GL10.GL_TRIANGLES, vertices*2,
> GL10.GL_UNSIGNED_SHORT,indiceBuffer);
>
> I don't think that I can use glDrawArrays,because that is for
> TriangleStripArrays. I have 1200 particles, which makes it 4800
> vertices in the array for the quads. The positions are morphed for
> each repaint. Maybe that is what is making it slow,but it was fast
> with point sprites.
>
> Each star particle consists of 2 quads. The star particle in the
> middle is smaller quad.  The transparent blueish blur around that
> particle is another quad. These are drawn with 2  arrays. I draw the
> most opaque array first (the star particle in the middle) and then the
> more transparent array later. This approach worked very well with
> point sprites and size attenuation, but maybe this doesn't work with
> texture mapped quads. Maye there are simply too much quads for the
> system to take care off, which messes up the Depth Testing and the z
> buffer. Maybe this is the reason that the transparency is not working
> like it should, which causes the visible black square quads?
>
> On Oct 7, 4:58 pm, Kostya Vasilyev  wrote:
>
>
>
> > Looking at the "dull" screenshot, I can see that your sprites are wrong
> > - they don't have transparency around the "point" itself.
>
> > The black square quads are clearly visible, and they shouldn't be.
>
> > The brightness level is what you put in the textures, you should be able
> > to make them as bright as you want.
>
> > As for performance, I haven't done any 3D work specifically on Android
> > devices, so can't say for sure. Using glDrawArrays should help, does it not?
>
> > -- Kostya
>
> > 07.10.2011 17:44, MobileVisuals пишет:
>
> > > I have implemented this according to your approach now. I replaced
> > > attenuated points with texture mapped quads.  I implemented bilinear
> > > filtering and alpha test.
> > > It works, but the visual quality is not good. It doesn't look at all
> > > as good as with Point sprites and size attenuation. It looked shiny
> > > and smooth when I used Point sprites and size attenuation and it was
> > > fast:
> > >http://www.mobile-visuals.com/mgw.php
>
> > > Now it is just rough and dull and it is slow:
> > >http://www.mobile-visuals.com/dull.png
>
> > > Are you really sure that is possible to get good visual quality with
> > > your approach?
>
> > > On Sep 29, 9:26 pm, Kostya Vasilyev  wrote:
> > >> 29.09.2011 23:01, MobileVisuals ?:
>
> > >>> I claim that HTC HD doesn't support OpenGL ES 2.0, because size
> > >>> attenuation is a part of OpenGL ES 1.1 and it is not supported.
> > >> Quite possibly, you're right...
>
> > >>> So HTC hasn't implemented the things that they say in the
> > >>> specification, but why not?
> > >> Who knows?
>
> > >> You could contact their support, but even if they provide a plausible
> > >> answer (and that's a big "if"), it's not going to magically fix all the
> > >> HTC devices out there...
>
> > >>> Thanks for the idea, do you mean like this?
> > >>> Scale to small size if the sprite is far away.
> > >>> Scale to medium size if the sprite is medium distance.
> > >>> Scale to big size if the sprite is close.
> > >> More or less - you are currently doing continuous range scaling of your
> > >> sprites (I presume). If you replace them with texture mapped quads, you
> > >> could always use the same image, or pick one of the ones predefined at
> > >> various scale factors, to improve the image quality and performance.
> > >> Sort of like mip-mapping.
>
> > >> But that's not the core idea - the main thing is to replace attenuated
> > >> points with texture mapped quads.
>
> > >>> That could work for other animations, but it would be very slow for my
> > >>> star cluster animations. There are hundreds of stars in each cluster.
> > >>> As it is now, I draw each star cluster in one single glDrawArrays
> > >>> call. That makes it fast.
> > >> Hundreds doesn't sound too bad - at those poly counts, it's the fill
> > 

[android-developers] how to make a url get fitted to an android device screen

2011-10-09 Thread Sivasankar K
i want to load an url either in browser or webview, but i need the entire
page to be fitted inside the device screen. There should not be any scroll
bars either in horizontal or vertical.
I cant make any changes in the web side.

In that particular webpage i have a image of width960 and height640, placed
with some buttons over it to go to some other pages. Whenever i loaded the
page i gets loaded in a enlarged way. I am able to reduce the page by
zooming in manually. I want the entire page to get fitted to the screen by
its own. How to do this pls help me friends

-- 
K Siva Sankar

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

[android-developers] A noob question about MultipartEntity

2011-10-09 Thread routis
Hi I guess this is a stupid noob question but I want to know why
Android framework does not provide with MultipartEntity class and if
there is future plan to support this.

Thank you for your reading.

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


[android-developers] Duplicate Media Files

2011-10-09 Thread perumal316
Hi All,

I am using the below mentioned intent to start the native camera app
for taking picture.

Intent intent = new
Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, 1);

Now the issue is, the picture is saved in both the default location (/
sdcard/DCIM/Camera) and the uri specified by me in putExtra.

Is there any way to prevent this? I either want to save it to a
location only once or get the full pathname of the stored image.

I am trying to get the pathname through the protected void onActivity
(int
requestcode ) using intent.getdata() but I am receiving blank.

Anyway to issue this issue?

Thanks In Advance,
Perumal

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

2011-10-09 Thread TreKing
On Sun, Oct 9, 2011 at 8:06 PM, erik wagner  wrote:

>  If not, can anyone provide some advice on how to get a value from a
> calling activity to the called activity?
>

Put data in the intent you send to the second activity.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

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

[android-developers] Re: Bitmap 32 bitperpixel image to Bitmap 8 bitperpixe image

2011-10-09 Thread gjs
Hi,

You can implements the method yourself -

Read each 32 or 24bit RGB value, take some sort of average value from
each of the R, G & B bytes, then store this averaged value in your
single grayscale byte.

Usually some weighting is applied to the RGB values see
http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale

Regards

On Oct 7, 8:48 pm, Ravijadhav  wrote:
> Thanks a lot gjs,
> The only query now i have is that will the same code work in android??
> does android
> support awt and other java 2 classes???
>
> On Oct 7, 10:30 am, gjs 
>
>
>
>
>
>
>
> > Hi,
>
> > try 
> > thishttp://stackoverflow.com/questions/3922172/java-awt-image-bufferedima...
>
> > Regards
>
> > On Oct 6, 9:35 pm, Ravijadhav  wrote:> Helllo Everyone,
>
> > > I am quite stuck at this..
> > > What is the best way to convert an RGB  24 or 32 bit per pixel image
> > > to a grayscale 8 bit per pixel image?
> > > A working code of the same in android will be much helpful for me
> > > Thank you...

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


[android-developers] Re: USB Bluetooth

2011-10-09 Thread gjs
Hi

Did you pair the Usb Bluetooth with your Android device ?

Regards

On Oct 7, 6:33 pm, tushar  wrote:
> Hi,
> I am enabling USB Bluetooth on Set top box.I am able to send the files
> to various phones but not able to reveive any.below erros it shows
> while connecting:
>
> 1.Authorization Rejected.Also the UUDI is not of OPP
> 2.mBtClass is NULL.
> 3.GetServiceAttribute Failed
> What does these errors mean?
> below is the log.
>
> Please help.
>
> I/power   ( 1097): *** set_screen_state 1
> I/power   ( 1097): *** set_screen_state 1
> I/ActivityManager( 1097): Starting: Intent
> { act=android.intent.action.MAIN
> cmp=com.android.settings/.bluetooth.BluetoothSettings } from pid 1361
> I/BluetoothAdapter( 1361): startDiscovery
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: Discovery session
> 0x52d08 with :1.0 activated
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: external/bluetooth/
> bluez/src/adapter.c:session_ref() 0x52d08: ref=1
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: io_security_event
> E/BluetoothEventLoop.cpp( 1097): event_filter: Received signal
> org.bluez.Adapter:PropertyChanged from /org/bluez/1914/hci0
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]:
> emit_property_changed..
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]:  append_variant..
> D/BTDEBUG ( 1369): a.b.adapter.a.DISCOVERY_STARTED
> V/BluetoothEventRedirector( 1361): Received
> android.bluetooth.adapter.action.DISCOVERY_STARTED
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/CachedBluetoothDevice( 1361): mBtClass is null
> I/ActivityManager( 1097): Displayed
> com.android.settings/.bluetooth.BluetoothSettings: +539ms
> I/power   ( 1097): *** set_screen_state 1
> I/power   ( 1097): *** set_screen_state 1
> E/BluetoothEventLoop.cpp( 1097): event_filter: Received signal
> org.bluez.Adapter:PropertyChanged from /org/bluez/1914/hci0
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]:
> emit_property_changed..
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]:  append_variant..
> D/BluetoothService( 1097): BT Discoverable for 120 seconds
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: external/bluetooth/
> bluez/src/adapter.c:set_mode() discoverable
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: external/bluetooth/
> bluez/src/adapter.c:session_ref() 0x542f8: ref=1
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: io_security_event
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]:
> emit_property_changed..
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: append_variant..
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: external/bluetooth/
> bluez/src/adapter.c:set_mode_complete() discoverable
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: external/bluetooth/
> bluez/src/adapter.c:session_unref() 0x542f8: ref=0
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: io_security_event
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/CachedBluetoothDevice( 1361): mBtClass is null
> D/dalvikvm( 1361): GC_CONCURRENT freed 404K, 48% free 3210K/6151K,
> external 1157K/1619K, paused 2ms+3ms
> E/BluetoothEventLoop.cpp( 1097): event_filter: Received signal
> org.bluez.Adapter:PropertyChanged from /org/bluez/1914/hci0
> E/BluetoothEventLoop.cpp( 1097): event_filter: Received signal
> org.bluez.Adapter:DeviceFound from /org/bluez/1914/hci0
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: io_security_event
> I//system/bin/bluetoothd( 1913):
> bluetoothd[1914]:  .dict_append_entry..
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]:  append_variant..
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]:
> dict_append_entry..
> D/BTDEBUG ( 1369): a.b.adapter.a.SCAN_MODE_CHANGED
> D/BTDEBUG ( 1369):      a.b.adapter.e.SCAN_MODE = 23
> D/BluetoothService( 1097):
> updateDeviceServiceChannelCache(00:1D:FD:F6:A2:85)
> I//system/bin/bluetoothd( 1913): bluetoothd[1914]: rec is NULL
> E/bluetooth_common.cpp( 1097): dbus_func_args_timeout_valist: D-Bus
> error in GetServiceAttributeValue: org.bluez.Error.Failed
> (GetServiceAttribute Failed)
> D/BluetoothService( 1097):      uuid(system):
> 1108--1000-8000-00805f9b34fb -1
> D/BluetoothService( 1097):      uuid(system):
> 1105--1000-8000-00805f9b34fb 9
> D/BTDEBUG ( 1369): a.b.device.a.FOUND
> D/BTDEBUG ( 1369):      a.b.device.e.DEVICE = 00:1D:FD:F6:A2:85
> D/BTDEBUG ( 1369):      a.b.device.e.CLASS = 5a020c
> D/BTDEBUG ( 1369):      a.b.device.e.RSSI = 0
> D/BTDEBUG ( 1369):      a.b.device.e.NAME = Tushar
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/CachedBluetoothDevice( 1361): mBtClass is null
> V/BluetoothEventRedirector( 1361): Received
> android.bluetooth.device.action.FOUND
> I/BluetoothClass( 1361): Failed to connect tushar 5898764
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/CachedBluetoothDevice( 1361): mBtClass is null
> W/Cache

[android-developers] Re: scrollview can't work programmatically

2011-10-09 Thread Studio LFP
I think it has to do with you are extending ViewGroup. Try this redone code 
where it is extending LinearLayout instead and see if it does what you need 
it to.

public class MyView extends LinearLayout
{
ScrollView myScrollView;
TextView tv;

public MyView( Context context )
{
super(context);
myScrollView = new ScrollView(context);
myScrollView.setBackgroundColor(0xfff00fff);
tv = new TextView(context);
tv.setTextColor( Color.BLACK );

tv.setText("sadfasdfasdfasdfasdfasdfasdfsadfsadf");
tv.setHeight(5000);
tv.setWidth(3200);

myScrollView.addView( tv, new LayoutParams( 
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT ) );
addView( myScrollView, new LayoutParams( 
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT ) );
}

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
int width = r-l;
int height =b-t;
myScrollView .layout(0, 0, width, height-100);
}
}

It works in a test situation, but not sure it will do what you want in your 
application, so give it a shot and let us know.

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 9, 2011 1:08:22 PM UTC-5, billconan wrote:
>
> Hello guys, 
>
> I want to use scrollview in my app. I tried to add a text view into 
> the scrollview, but I can't see anything rendered, except the 
> background color of the scroll view. 
>
> here is how I did it: 
> public class MyView extends ViewGroup 
> { 
> ScrollView myScrollview; 
> Textview tv; 
>
> public MyView(Context context) { 
> myScrollView = new ScrollView(context); 
> myScrollView.setBackgroundColor(0xfff00fff); 
>
> textview=new TextView(context); 
>
> textview.setLayoutParams(new 
> LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); 
> textview.setLayoutParams(params) 
> textview.setText("sadfasdfasdfasdfasdfasdfasdfsadfsadf"); 
>
> textview.layout(0, 0, 1000, 2000); 
> textview.setHeight(5000); 
> textview.setWidth(3200); 
> myScrollView .addView(tv); 
> addView(myScrollview); 
> } 
>
> @Override 
> protected void onLayout(boolean changed, int l, int t, int r, int b) 
> { 
> // TODO Auto-generated method stub 
>
> int width = r-l; 
> int height =b-t; 
>
> myScrollView .layout(0, 0, width, height-100); 
> } 
> } 
>
>
> I found almost all the scrollview tutorial are using xml to define the 
> view. But I want to do it in a programmatic way. But anyway, I also 
> tried xml. 
>
> I copied Romain Guy's xml from here for testing :http://www.curious- 
> creature.org/2010/08/15/scrollviews-handy-trick/ 
>
> The xml scrollview by itself is correct, if I create this scrollview 
> and add it to the activity, using 
>
> scrollview= (ScrollView) 
> getLayoutInflater().inflate(R.layout.scrollviewid,null); 
> setContentView(scrollview); 
>
> or setContentView(R.layout.scrollviewid); 
>
> it worked. However, if I want to make the scrollview a child view of 
> some other view, again I could only see the background of the 
> scrollview. nothing inside is rendered: 
>
> public class MyView extends ViewGroup 
> { 
>ScrollView myScrollview; 
>
> public MyView(Activity activity,Context context) 
> { 
> super(context); 
>
> myScrollview= (ScrollView) 
> activity.getLayoutInflater().inflate(R.layout.restaurantcategoryselectorviewlayout,null);
>  
>
> myScrollview.setBackgroundColor(0xfff00fff); 
>
> addView(myScrollview); 
> } 
>
> @Override 
> protected void onLayout(boolean changed, int l, int t, int r, int b) 
> { 
> // TODO Auto-generated method stub 
>
> int width = r-l; 
> int height =b-t; 
>
> myScrollview.layout(0, 0, width, height-100); 
> } 
> } 
>
>
>
> What's wrong with my code? Is there any example of creating scrollview 
> with program not xml? 
>
> Also, are those java source code of android also at kernel.org? since 
> the git service is down, where can I download android source code? 
>
> Thanks you!

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

[android-developers] Re: Scenario where initLoader() does not call onLoadFinished()

2011-10-09 Thread aleksej
I have the same issue. It looks like the bug in CurorLoader. Any ideas
of workaround fix for that?

On Oct 8, 12:29 am, kaciula  wrote:
> I have a simple activity with one fragment. The fragment uses a CursorLoader
> to load some data from a ContentProvider. I just call initLoader() inside
> onActivityCreated() and I populate the UI in onLoadFinished(). If I switch
> orientations, everything works as expected (onLoadFinished() is called
> again).
>
> Now, if I move to a new activity, press BACK to get back to my first
> activity and then switch orientations, I see that onLoaderReset() is called
> and then, in onActivityCreated(), although initLoader() is called,
> onLoadFinished() is never called after that. And as a consequence, my UI
> shows no data.
>
> After doing some testing, I see that this problem appears only if I use
> setRetainInstance(true) in my fragment. So what's the deal? And how can I
> fix this without removing setRetainInstance(true)? Do I have to do something
> in onLoaderReset()? Do I have to somehow give the loader the new activity as
> the context?
>
> Thanks.

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


[android-developers] Getting info from a calling activity advice

2011-10-09 Thread erik wagner
Hi,
I'm trying to do something where I have an activity that needs to call
another activity.  I use the startActivityForResult and pass it a
integer as the second parameter.  I know I can check for that
information after the second activity is done but my question is; is
there a way I can know what the integer value is when starting the
second activity?
So, I have
startActivityForResult(myIntent, 1);
When the activity described by myIntent is started is there a way I
can grab the 1 value and do something with it?  If not, can anyone
provide some advice on how to get a value from a calling activity to
the called activity?
Thanks in advance.
Erik

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

2011-10-09 Thread rahul verma
What is SMTP?

On 10 Oct 2011 06:16, "rahul verma"  wrote:

Yeah i too need to know that. .whenever we try to send a mail a gmail app
screen comes ,what is the way to omit that i mean send the mail
automatically

>
> On 8 Oct 2011 22:43, "Palike"  wrote:
>
> Hi, at first sorry for my English

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

2011-10-09 Thread rahul verma
Yeah i too need to know that. .whenever we try to send a mail a gmail app
screen comes ,what is the way to omit that i mean send the mail
automatically

On 8 Oct 2011 22:43, "Palike"  wrote:

Hi, at first sorry for my English. I need to make app that will
automatically send a file from the SD card. I thought that I will do
it through email. I write the code to send email

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class EmailActivity extends Activity {

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

   public void poslat(View button) {

   Intent i = new Intent(android.content.Intent.ACTION_SEND);
   String Email[] = { "a...@aa.aa" };
   i.putExtra(android.content.Intent.EXTRA_EMAIL, Email);
   i.putExtra(android.content.Intent.EXTRA_SUBJECT, "Tu bude
datum");
   i.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file:///sdcard/lala/
lala.txt"));
   i.setType("plain/text");
   startActivity(i);
   }
}

works well, but I feel that it cannot be configured to be sending
automatically. How can I start? or do you have any idea how to
automatically send a file from the SD card? eg. via FTP or something
else? .. Thank you very much

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

2011-10-09 Thread Doug
Do you have the same app with the same package name on Amazon with DRM
enabled?  If so, that may be a problem.

When someone downloads an app from Amazon, the Android Market app will
still check it for updates on the Android Market.  When Amazon DRM is
enabled, they mangle the signature of your apk and repackage it after
they inject their DRM into it.  So if the user sees the update on the
Android Market prior to getting the update from Amazon, the
installation will fail with that message.  Is especially sucks when
Amazon takes their sweet time authorizing your update but Market
updates happen almost instantly.

Doug

On Oct 8, 6:29 am, Jean-François Geyelin  wrote:
> Some users are reporting me that they can't update the application because
> the application is not signed appropriately.
>
> 1/ I tried jarsigner on the new apk, and it returns "jar verified".
> 2/ I installed a old version of my apk with adb, and successfully updated to
> the latest version using the android market.
>
> My questions are:
> When you upload an update to the android market, does it check if the update
> is correctly signed ?
> If not, how can I check if the application is signed the same way as a
> previous version?

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


[android-developers] Re: sending email automatically

2011-10-09 Thread lbendlin
If you didn't understand what he/she wanted, then why bother replying?  The 
usage of a service is not relevant to the stated problem.

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

Re: [android-developers] How to display search button in actionbar on tablet (app minSdk = 8)

2011-10-09 Thread Ralph Bergmann | the4thFloor.eu
take a look at

http://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget

and

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewActionBar.html


Am 09.10.11 22:58, schrieb Jean-Michel:
> Hi guys,
> I just (late and fairly stupidly) realised that one of the big
> differences of Honeycomb is the lack of "always there standard
> buttons" (home, back, search, menu).
> 
> Home seems to be there all the time, as well as back (at least it is
> for my app).
> 
> I found out how to get my menu back (target a SDK below 11), but I
> have been Googling for last 3 hours in order to discover how to get a
> search button in the action bar and I failed...
> 
> So to make sure things are in perspective:
> - my app min SDK is 8;
> - I'd like to have the same code accross the board
> - I am using search to trigger a custom  action in a custom activity
> (still like a search, but not really a search).
> - furthermore I am using long press on serach as well.
> 
> How can I have that on tablets whithout ruining the "other users"
> experience or write a specific  SDK 11+ version.
> 
> Many thanks,
> JM
> 

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


Re: [android-developers] How to display search button in actionbar on tablet (app minSdk = 8)

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 4:58 PM, Jean-Michel  wrote:
> I found out how to get my menu back (target a SDK below 11)

Your options menu, with targetSdkVersion="11" or higher, will be in
the action bar, on the right.

> but I
> have been Googling for last 3 hours in order to discover how to get a
> search button in the action bar and I failed...

You have two choices. One says you use android:showAsAction and
android:actionLayout in your options menu XML, so on tablets you can
have a search field in the action bar itself and on phones it will
appear as a regular options menu item. Or, use setCustomView() on
ActionBar to add a search field when you are on API Level 11 or
higher, and do something else for older devices.

> So to make sure things are in perspective:
> - I'd like to have the same code accross the board

By definition, that's not strictly possible. You can have one code
base that supports both search-in-action-bar and other affordances,
but you will need to have some action bar-specific stuff somewhere.

> - I am using search to trigger a custom  action in a custom activity
> (still like a search, but not really a search).

Huh?

> - furthermore I am using long press on serach as well.

Huh?

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

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

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


[android-developers] How to display search button in actionbar on tablet (app minSdk = 8)

2011-10-09 Thread Jean-Michel
Hi guys,
I just (late and fairly stupidly) realised that one of the big
differences of Honeycomb is the lack of "always there standard
buttons" (home, back, search, menu).

Home seems to be there all the time, as well as back (at least it is
for my app).

I found out how to get my menu back (target a SDK below 11), but I
have been Googling for last 3 hours in order to discover how to get a
search button in the action bar and I failed...

So to make sure things are in perspective:
- my app min SDK is 8;
- I'd like to have the same code accross the board
- I am using search to trigger a custom  action in a custom activity
(still like a search, but not really a search).
- furthermore I am using long press on serach as well.

How can I have that on tablets whithout ruining the "other users"
experience or write a specific  SDK 11+ version.

Many thanks,
JM

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Compilation error on my if else statement

2011-10-09 Thread scame
Wow. http://download.oracle.com/javase/tutorial/java/nutsandbolts/if.html

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

[android-developers] Re: sending email automatically

2011-10-09 Thread scame
Не совсем понял, что ты именно хочешь. Чтобы тебе автоматически письмо 
отсылалось по какому-то интервалу? Создай сервис, запусти в нём поток и по 
таймеру хреначь. Или я не понял.

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

[android-developers] Help: Nexus can't boot - OutOfMemory

2011-10-09 Thread David Goldfarb
Ok, I was stupid... My phone repeatedly warned me that I was low on
memory and I not only ignored the warnings, I installed a game that
seems to slowly grow its memory usage.

Anyway, my poor phone, a stock Nexus One, finally gave up today. It
won't reboot.  When it tries it repeatedly crashes with an
OutOfMemoryError in the ActivityManagerService and other critical
locations.

So, I'd like to clear out some memory.

But...
- I can't boot the phone to get the full GUI
- adb uninstall  (for any app) fails with "Error: Could not
access the Package Manager.  Is the system running?"

adb logcat and adb shell are working, so I can see what the phone is
doing and I should be able to delete extraneous rw files.

I don't currently have root.
I'd really like not to factory reset the phone or lose my current
configuration.

What's the best way to free up enough space to get the phone to boot?

Thanks, and feeling foolish,
David


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

2011-10-09 Thread Romain Guy
9-patches on Android are actually n-patches. You can have more than one
stretching region. The draw9patch tool from the SDK will show you what
happens if you draw several stretch regions.

On Sun, Oct 9, 2011 at 9:49 AM, Mark Murphy  wrote:

> On Sun, Oct 9, 2011 at 12:36 PM, Romain Guy  wrote:
> > Thanks for sharing! This UI is indeed a little better but I noticed you
> seem
> > to support only 9-patches, not n-patches. Did I miss something?
>
> Um, what's an n-patch?
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
> Available!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

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

[android-developers] Re: BitmapFactory.decodeStream() returning null when trying to load image from SD card

2011-10-09 Thread clark
BitmapFactory.decodeFile() works, so I guess I'll use that for files
and decodeStream() for images included in my assets.


On Oct 8, 4:08 pm, clark  wrote:
> I'm currently working on a Live Wallpaper that uses OpenGL and ran
> into a problem with decodeStream() always returning null.  I've had no
> problem when working with images in my assets folder, but I am adding
> an option to load an image from the SD card.  I get file information
> from the gallery and turn that into an absolute path, which I have
> verified is correct. Here is the snippet of code which loads the
> image:
>
>                 Texture tex = new Texture();
>                 BitmapFactory.Options opts = new BitmapFactory.Options();
>                 // first lets check the dimensions of the image without 
> loading it
>                 opts.inJustDecodeBounds = true;
>                 BitmapFactory.decodeStream(is, null, opts);
>
>                 tex.mBmpWidth = opts.outWidth;
>                 tex.mBmpHeight = opts.outHeight;
>                 tex.mTexWidth = Utils.nextPowerOf2(opts.outWidth);
>                 tex.mTexHeight = Utils.nextPowerOf2(opts.outHeight);
>
>                 Log.i("LWP", "Image size = (" + tex.mBmpWidth + "," + 
> tex.mBmpHeight
> +
>                                 ")  Texture size = (" + tex.mTexWidth + "," + 
> tex.mTexHeight +
> ")");
>
>                 opts = new BitmapFactory.Options();
>
>         try {
>                 tex.mBitmap = BitmapFactory.decodeStream(is);
>         } catch (OutOfMemoryError e) {
>         }
>
> Texture is just a static class which has the members shown above.  The
> first call to decodeStream() where I get the outWidth and outHeigt
> works but when I try to decode the image to a bitmap it returns null.
>
> I've tried using a BufferedInputStream and still get the same
> results.  I've read several entries on SO and here about this
> returning null but nothing has offered a remedy to this.
>
> Any Ideas?

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


[android-developers] scrollview can't work programmatically

2011-10-09 Thread billconan
Hello guys,

I want to use scrollview in my app. I tried to add a text view into
the scrollview, but I can't see anything rendered, except the
background color of the scroll view.

here is how I did it:
public class MyView extends ViewGroup
{
ScrollView myScrollview;
Textview tv;

public MyView(Context context) {
myScrollView = new ScrollView(context);
myScrollView.setBackgroundColor(0xfff00fff);

textview=new TextView(context);

textview.setLayoutParams(new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
textview.setLayoutParams(params)
textview.setText("sadfasdfasdfasdfasdfasdfasdfsadfsadf");

textview.layout(0, 0, 1000, 2000);
textview.setHeight(5000);
textview.setWidth(3200);
myScrollView .addView(tv);
addView(myScrollview);
}

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
// TODO Auto-generated method stub

int width = r-l;
int height =b-t;

myScrollView .layout(0, 0, width, height-100);
}
}


I found almost all the scrollview tutorial are using xml to define the
view. But I want to do it in a programmatic way. But anyway, I also
tried xml.

I copied Romain Guy's xml from here for testing :http://www.curious-
creature.org/2010/08/15/scrollviews-handy-trick/

The xml scrollview by itself is correct, if I create this scrollview
and add it to the activity, using

scrollview= (ScrollView)
getLayoutInflater().inflate(R.layout.scrollviewid,null);
setContentView(scrollview);

or setContentView(R.layout.scrollviewid);

it worked. However, if I want to make the scrollview a child view of
some other view, again I could only see the background of the
scrollview. nothing inside is rendered:

public class MyView extends ViewGroup
{
   ScrollView myScrollview;

public MyView(Activity activity,Context context)
{
super(context);

myScrollview= (ScrollView)
activity.getLayoutInflater().inflate(R.layout.restaurantcategoryselectorviewlayout,null);
myScrollview.setBackgroundColor(0xfff00fff);

addView(myScrollview);
}

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
// TODO Auto-generated method stub

int width = r-l;
int height =b-t;

myScrollview.layout(0, 0, width, height-100);
}
}



What's wrong with my code? Is there any example of creating scrollview
with program not xml?

Also, are those java source code of android also at kernel.org? since
the git service is down, where can I download android source code?

Thanks you!

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


[android-developers] Re: Alternative 9-patch image creator - Patchworker

2011-10-09 Thread Will Shackleton
n-patches are (I think!) images which have multiple expanding
sections. This would be useful if there was detail in the middle of a
graphic, with 2 blank regions to be expanded.

On Oct 9, 5:49 pm, Mark Murphy  wrote:
> On Sun, Oct 9, 2011 at 12:36 PM, Romain Guy  wrote:
> > Thanks for sharing! This UI is indeed a little better but I noticed you seem
> > to support only 9-patches, not n-patches. Did I miss something?
>
> Um, what's an n-patch?
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
> Available!

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


Re: [android-developers] Re: layout changes when on-screen keyboard shows/hides suggestions

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 12:36 PM, Alexander Bürger
 wrote:
> That makes them same height, but this height is still changing, which looks
> weird.
>
> Why is the LinearLayout containing text field and button changing its height
> at all? This does not make sense to me. The only way I found to avoid it is
> to set a fixed size, like 44dp, for topcontainer.

If you have resize set for android:windowSoftInputMode, and you do not
have your form wrapped in a ScrollView or something, I can see the
behavior you describe occurring.

http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

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

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
Available!

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


[android-developers] Re: Alternative 9-patch image creator - Patchworker

2011-10-09 Thread Will Shackleton
Hi

It currently only does 9-patches; I can add n-patch support, although
I just hadn't thought to while writing the program.
I'd imagine most images would be 9patches (rather than n-patches), so
it would probably be an optional feature.

Will

On Oct 9, 5:36 pm, Romain Guy  wrote:
> Hi Will,
>
> Thanks for sharing! This UI is indeed a little better but I noticed you seem
> to support only 9-patches, not n-patches. Did I miss something?
>
> On Sun, Oct 9, 2011 at 9:29 AM, Will Shackleton wrote:
>
>
>
>
>
>
>
>
>
> > Hi
>
> > I recently made a desktop application which simplifies the process of
> > creating and exporting 9-patch images - Patchworker -
> >http://digitalsquid.co.uk/patchworker/
> > Once an image is loaded (including SVG images), the 9patch areas can
> > be manipulated with simple handles around the image. The application
> > then exports correctly sized images at multiple densities into the
> > corresponding folders in an application.
>
> > Patchworker can also be used to export SVGs at multiple densities
> > without 9patch areas.
> > The program can be downloaded athttp://digitalsquid.co.uk/patchworker/
> > , and is available on Launchpad athttps://launchpad.net/patchworker
>
> > Just thought I'd let you all know about this,
> > Will Shackleton
> > digitalsquid.co.uk
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com

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


Re: [android-developers] Alternative 9-patch image creator - Patchworker

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 12:36 PM, Romain Guy  wrote:
> Thanks for sharing! This UI is indeed a little better but I noticed you seem
> to support only 9-patches, not n-patches. Did I miss something?

Um, what's an n-patch?

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

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
Available!

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


[android-developers] ListFragment addHeaderView and addFooterView issue

2011-10-09 Thread emanuele
hello there,

I ve two ListFragments maganed by a tabhost. Firt time I switch
between tab all is alright. The headerView is correctly added. The
second time I switch between fragment I get this execption:

10-05 15:15:01.585: ERROR/AndroidRuntime(23263):
java.lang.IllegalStateException: Cannot add header view to list --
setAdapter has already been called. 10-05 15:15:01.585: ERROR/
AndroidRuntime(23263): at
android.widget.ListView.addHeaderView(ListView.java:261) 10-05
15:15:01.585: ERROR/AndroidRuntime(23263): at
android.widget.ListView.addHeaderView(ListView.java:284) 10-05
15:15:01.585: ERROR/AndroidRuntime(23263): at
it.mypackage.archive.ArchiveFragment.onActivityCreated(ArchiveFragment.java:
199) 10-05 15:15:01.585: ERROR/AndroidRuntime(23263): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:
858) 10-05 15:15:01.585: ERROR/AndroidRuntime(23263): at
android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:
1183)

and the app crashes. The code I use to add the header view follows:


   @Override
public void onActivityCreated(Bundle arg0) {
super.onActivityCreated(arg0);
getListView().setOnScrollListener(this);
getListView().addHeaderView(searchBox);
setListAdapter(mAdapter);
}


I manage to fix (??) setting the list adapter to null befor adding the
header view but it does not seems a good thing to me.


   @Override
public void onActivityCreated(Bundle arg0) {
super.onActivityCreated(arg0);
 setListAdapter(null);
   getListView().setOnScrollListener(this);
getListView().addHeaderView(searchBox);
setListAdapter(mAdapter);
}



Adding footer instead I have the following crash:


10-09 18:45:13.866: ERROR/AndroidRuntime(18191):
java.lang.NullPointerException
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.widget.AdapterView
$AdapterDataSetObserver.onChanged(AdapterView.java:778)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.widget.ListView.addFooterView(ListView.java:346)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.widget.ListView.addFooterView(ListView.java:361)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
it.mypackage.category.CategorySearchFragment.onActivityCreated(CategorySearchFragment.java:
131)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:
858)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:
1041)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.support.v4.app.BackStackRecord.popFromBackStack(BackStackRecord.java:
687)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.support.v4.app.FragmentManagerImpl.popBackStackState(FragmentManager.java:
1392)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:
438)
10-09 18:45:13.866: ERROR/AndroidRuntime(18191): at
android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:
156)


in order to add the footer I run the following snippet

 @Override
public void onActivityCreated(Bundle arg0) {
super.onActivityCreated(arg0);
 setListAdapter(null);
   getListView().setOnScrollListener(this);
getListView().addHeaderView(searchBox);
if (footer != null) {

getListView().addFooterView(footer);
}
setListAdapter(mAdapter);
}


What am I doing wrong?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: layout changes when on-screen keyboard shows/hides suggestions

2011-10-09 Thread Alexander Bürger

Hi,

Try making the Button and the EditText height "match_parent" (or 
"fill_parent") instead of "wrap_content".
That makes them same height, but this height is still changing, which 
looks weird.


Why is the LinearLayout containing text field and button changing its 
height at all? This does not make sense to me. The only way I found to 
avoid it is to set a fixed size, like 44dp, for topcontainer.


Cheers,

Alexander

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

2011-10-09 Thread Romain Guy
Hi Will,

Thanks for sharing! This UI is indeed a little better but I noticed you seem
to support only 9-patches, not n-patches. Did I miss something?

On Sun, Oct 9, 2011 at 9:29 AM, Will Shackleton wrote:

> Hi
>
> I recently made a desktop application which simplifies the process of
> creating and exporting 9-patch images - Patchworker -
> http://digitalsquid.co.uk/patchworker/
> Once an image is loaded (including SVG images), the 9patch areas can
> be manipulated with simple handles around the image. The application
> then exports correctly sized images at multiple densities into the
> corresponding folders in an application.
>
> Patchworker can also be used to export SVGs at multiple densities
> without 9patch areas.
> The program can be downloaded at http://digitalsquid.co.uk/patchworker/
> , and is available on Launchpad at https://launchpad.net/patchworker
>
> Just thought I'd let you all know about this,
> Will Shackleton
> digitalsquid.co.uk
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

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

[android-developers] Alternative 9-patch image creator - Patchworker

2011-10-09 Thread Will Shackleton
Hi

I recently made a desktop application which simplifies the process of
creating and exporting 9-patch images - Patchworker -
http://digitalsquid.co.uk/patchworker/
Once an image is loaded (including SVG images), the 9patch areas can
be manipulated with simple handles around the image. The application
then exports correctly sized images at multiple densities into the
corresponding folders in an application.

Patchworker can also be used to export SVGs at multiple densities
without 9patch areas.
The program can be downloaded at http://digitalsquid.co.uk/patchworker/
, and is available on Launchpad at https://launchpad.net/patchworker

Just thought I'd let you all know about this,
Will Shackleton
digitalsquid.co.uk

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: layout changes when on-screen keyboard shows/hides suggestions

2011-10-09 Thread Studio LFP
Try making the Button and the EditText height "match_parent" (or 
"fill_parent") instead of "wrap_content".

I've run into this before and I think the Button and EditText aren't quite 
the same initial height when using "wrap_content". When the keyboard pops 
up, it might be pushing the Button up to the top of your LinearLayout 
because the Button is just a slight bit smaller than the EditText.

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 9, 2011 5:33:57 AM UTC-5, Alexander Bürger wrote:
>
> Dear Android experts,
>
> I have a little problem with a layout of an activity. Some elements are 
> moving in a strange way depending on the state of the on-screen keyboard.
>
> For testing, I made an Activity that only calls setContentView with this 
> layout:
>
> http://schemas.android.com/apk/res/android";
>  android:orientation="vertical" android:layout_width="fill_parent"
>  android:layout_height="fill_parent">
>   android:layout_width="match_parent" 
> android:id="@+id/topcontainer">
>   android:layout_height="wrap_content" 
> android:layout_width="1dp"
>  android:layout_weight="1"/>
>   android:text="XY" android:layout_height="wrap_content"
>  android:layout_width="wrap_content"/>
> 
> 
>
> The problem is this: when starting to type in the EditText, the 
> on-screen keyboard pops up a "suggestion bar" with some possible 
> completions for the text typed in so far. When this suggestion bar is 
> showing, the Button is moving up by about one pixel on my device (Xperia 
> neo, 2.3.4), and when the suggestion bar is hidden again, the button 
> moves back into the original position.I have no idea why this happens. 
> To my eyes, the layout seems correct. I would be happy about any 
> suggestions on how to get rid of this problem.
>
> Thanks for your help,
>
> Alexander
>
>

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

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 10:59 AM, Studio LFP  wrote:
> 3. Special consideration now has to be taken with AsyncTasks since they are
> linked to the UI and need to be stopped, location of processing saved and
> restarted

False. "Special consideration" may be required but they do not need to
be stopped and restarted.

http://stackoverflow.com/questions/3821423/background-task-progress-dialog-orientation-change-is-there-any-100-working/3821998#3821998

> 4. Special consideration for threading, but not quite as much as AsyncTasks

False.

If the thread has interaction with the UI, you need to deal with the
thread the same way you deal with the AsyncTask. If the thread has no
interaction with the UI, an equivalent AsyncTask would also not
require any additional work.

> 5. Special consideration needs to be taken for the things saved in the
> bundle so you don't leak the previous context.

False.

There is nothing you can put in a Bundle that can leak a Context. This
is by definition -- a Bundle has to be able to be passed across
process boundaries, and a Context cannot be passed across process
boundaries.

Now, had you written "things returned by
onRetainNonConfigurationInstance()", that *is* an issue.

> With configChanges:
>
> 1. Layout may need to be changed on rotation
> 2. Other unknown issues

It's not just screen rotations and it's not just layouts. If the user
changes their locale and comes back to your running app, that's a
configuration change. If the user drops their device into a car dock,
that's a configuration change. If the user removes the device from the
car dock, that's a configuration change. And so on.

You also forgot about your options menus and perhaps others. And, not
only do you have to deal with this for each and every resource you are
using today, but also for each and every resource you add in the
future. And for each and every new configuration change that appears
in the future (averaging one new one per Android release).

> With the resources being automatically swapped out by Android, a simple
> refresh on screen elements would pick up a new language if you needed to
> support that.

Not necessarily. Many applications have strings beyond those wired
into a layout resource, which if cached would need to be reloaded.
Options menus are cached if the user opened the menu before. Drawables
get cached. And so on.

-- 
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: Multithreading in Android?

2011-10-09 Thread Studio LFP
Android is designed to keep applications around in a paused state unless it 
needs the memory back. If it does need memory from currently paused 
applications, it will close them to free up the required memory. This is to 
make sure the user can move around faster and provide a better user 
experience.

What you are seeing is normal and you don't have to worry about closing 
background windows as Android will handle it for you when it needs to.

Check out this post for more detail:

http://android-developers.blogspot.com/2010/04/multitasking-android-way.html

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 9, 2011 3:55:49 AM UTC-5, venugopal reddy wrote:
>
> Hi  dear friends, 
>
> I  Created one Internet application(using webview). its working fine. 
>
> I have one doubt, In Applications If click  our application icon it 
> will open in browser . i can operate.. 
>
> now my requirement is if  i close the browser straight away that 
> application should be closed... 
>
> but the application is running background... how can I achieve my 
> requirement, 
>
> Should i write  any particular code or any  setting in the emulator.. 
>
>
> Pls help me 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: stop progress bar when parsing JSON finish.

2011-10-09 Thread Studio LFP
Check out the AsyncTask object:

http://developer.android.com/reference/android/os/AsyncTask.html

Simple sample would be like:

private class AsyncInit extends AsyncTask
{
public static boolean bThreadRunning = false;
public Context context;
private ProgressDialog pdDialog;

@Override
protected void onPreExecute()
{
bThreadRunning = true;
pdDialog = ProgressDialog.show( context, "", "Doing something, 
please wait...", true );
}

@Override
protected void onPostExecute(Void result)
{
bThreadRunning = false;
pdDialog.dismiss();
}

@Override
protected Void doInBackground(Void... params)
{
// Do something here in the background
return null;
}
}

Then you can just activate that by this:

public void openBackground( Context context )
{
if( !AsyncInit.bThreadRunning )
{
AsyncInit atInit = new AsyncInit();
atInit.context = context;
atInit.execute( null, null, null );
}
}

There are other options available also, check out Threads, Handlers and 
Runnables also.

Steven
Studio LFP
http://www.studio-lfp.com


On Sunday, October 9, 2011 8:12:51 AM UTC-5, Muchamad Jeffri wrote:
>
> hello, i want to ask how to implement progress bar spinner in 
> background and then stop when parsing JSON data finish to list view. 
> this my source code. 
>
> package com.cob.json; 
>
> import java.lang.reflect.Type; 
> import java.util.ArrayList; 
> import java.util.HashMap; 
> import java.util.List; 
> import java.util.Map; 
>
> import android.app.Activity; 
> import android.os.Bundle; 
> import android.util.Log; 
> import android.view.View; 
> import android.widget.ListView; 
> import android.widget.Toast; 
>
> import com.google.gson.Gson; 
> import com.google.gson.reflect.TypeToken; 
>
> public class JSONListViewActivity extends Activity { 
>   /** Called when the activity is first created. */ 
> //ListView that will hold our items references back to main.xml 
> ListView lstTest; 
> //Array Adapter that will hold our ArrayList and display the items 
> on the ListView 
> ProjectsAdapter arrayAdapter; 
>
> //List that will  host our items and allow us to modify that array 
> adapter 
> ArrayList prjcts=null; 
> @Override 
> public void onCreate(Bundle savedInstanceState) { 
> super.onCreate(savedInstanceState); 
> setContentView(R.layout.main); 
> //Initialize ListView 
> lstTest= (ListView)findViewById(R.id.lstText); 
>
>  //Initialize our ArrayList 
> prjcts = new ArrayList(); 
> //Initialize our array adapter notice how it references the 
> listitems.xml layout 
> arrayAdapter = new ProjectsAdapter(JSONListViewActivity.this, 
> R.layout.list_item,prjcts); 
>
> //Set the above adapter as the adapter of choice for our list 
> lstTest.setAdapter(arrayAdapter); 
>
>
> //Instantiate the Web Service Class with he URL of the web 
> service not that you must pass 
> WebService webService = new WebService("http:// 
> frontine.hostoi.com/jsontest.json"); 
>
> //Pass the parameters if needed , if not then pass dummy one 
> as follows 
> Map params = new HashMap(); 
> params.put("var", ""); 
>
> //Get JSON response from server the "" are where the method 
> name would normally go if needed example 
> // webService.webGet("getMoreAllerts", params); 
> String response = webService.webGet("", params); 
>
> try 
> { 
> //Parse Response into our object 
> Type collectionType = new TypeToken>() 
> {}.getType(); 
>
> //JSON expects an list so can't use our ArrayList from the 
> lstart 
> List lst= new Gson().fromJson(response, 
> collectionType); 
>
> //Now that we have that list lets add it to the ArrayList 
> which will hold our items. 
> for(Projects l : lst) 
> { 
> prjcts.add(l); 
> } 
>
> //Since we've modified the arrayList we now need to notify 
> the adapter that 
> //its data has changed so that it updates the UI 
> arrayAdapter.notifyDataSetChanged(); 
> } 
> catch(Exception e) 
> { 
> Log.d("Error: ", e.getMessage()); 
> } 
>
>
>
> } 
> protected void onListItemClick(ListView lstTest, View v, int 
> position, long id) { 
> // TODO Auto-generated method stub 
> //super.onListItemClick(l, v, position, id); 
> String selection = lstTest.getItemAtPosition(position).toString(); 
> Toast.makeText(this, selection, Toast.LENGTH_LONG).show(); 
> } 
>
>
> }

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

Re: [android-developers] Re: textView Clears on Rotation

2011-10-09 Thread Studio LFP
I'm compiling a list of things that need to happen in both cases. So far it 
looks like a lot bigger challenge to not use the android:configChanges than 
to use it.

I've read the optimization post plenty of times and do understand it, but 
I'd like to get the big picture for the usages of both to be able to decide 
which is better in certain cases.

Here's a few of the issues I'm trying to find good solutions to when *not*using 
configChanges:

1. Window states are not saved. ListView scroll locations, ExpandedListView 
drop-downs and scroll locations, ScrollView locations, etc.
2. OpenGL VBOs and textures loaded into memory get destroyed and have to be 
reprocessed and copied back into memory along with the GLSurfaceView state 
information
3. Special consideration now has to be taken with AsyncTasks since they are 
linked to the UI and need to be stopped, location of processing saved and 
restarted
4. Special consideration for threading, but not quite as much as AsyncTasks
5. Special consideration needs to be taken for the things saved in the 
bundle so you don't leak the previous context. This could get tricky because 
I'm sure a lot of people pass a context to objects or blend data and view 
objects

*With* configChanges:

1. Layout may need to be changed on rotation
2. Other unknown issues

With the resources being automatically swapped out by Android, a simple 
refresh on screen elements would pick up a new language if you needed to 
support that. That also includes any images that might be swapped over, but 
as I have to refresh the state of my windows even when it isn't rotated, 
this is already written in the base application anyways.

To me it's also wrong to forget about the general case, i.e. other config 
> changes and the out of memory killer (and maybe more cases I can't think of 
> right now). 
>

This part did catch my eye and it is what I was wondering. Is there 
something that the configChanges does to cause internal issues because it is 
bugged? All of the configuration changes are fairly straight forward and 
documented, but if there is some issue internally, would be nice to know.

In an effort for this discussion not to go to waste, I'm trying to get the 
full picture compiled together on what has to happen on both so that I can 
get a post on my site or somewhere to help others. I know we all see this 
question fly by on this group (and on other help areas) all the time, so I 
figure a post of the compiled pros and cons of each would be helpful.

Anyone that would like to toss in additional information about the things 
you have to deal with on either occasion (using configChanges or not), 
please do so and I will compile it for us for future reference.

Steven
Studio LFP
http://www.studio-lfp.com



On Sunday, October 9, 2011 4:47:03 AM UTC-5, Kostya Vasilyev wrote:
>
>  
> 09.10.2011 2:41, Studio LFP пишет: 
>
> *TreKing, Kostya, Romain Guy,*
>
> I do understand what you guys are saying, so I am listening, but it seems 
> to be a contradiction since it seems most of the internal applications use 
> it, including quite a few that Google themselves send with the devices. 
> Maybe they aren't, but based on the speed of the rotate and the way the 
> screen looks, I'm pretty sure they are.
>
> [snip]
>
>
> That's where those methods pointed out by TreKing come into play, as an 
> optimization.
>
> And here is a blog post written by Romain Guy that covers this in more 
> detail:
>
>
> http://android-developers.blogspot.com/2009/02/faster-screen-orientation-change.html
>
> Those are optimizations for the common cases.
>
> The manifest attribute is fine, too, as long as 1) one understands that 
> it's also an optimization 2)  the code can handle the general case, where 
> the activity gets recreated and 3) the layout is the same for all 
> orientations.
>
>
> It seems like there are so many times where this is useful and being used, 
> yet people seem to be trying to tell people that it is "wrong", "incorrect", 
> "you are a horrible person and coder for using this".
>
>
> To me, it's wrong to mix up the concepts of "here is how you fix this 
> problem" and "this is an optimization you can make".
>
> To me it's also wrong to forget about the general case, i.e. other config 
> changes and the out of memory killer (and maybe more cases I can't think of 
> right now). 
>
> YMMV.
>
>
> Steven
> Studio LFP
> http://www.studio-lfp.com
>
>
> On Saturday, October 8, 2011 4:34:14 PM UTC-5, Romain Guy (Google) wrote: 
>>
>>  *TreKing,*
>>>
>>> If you choose to ignore a well documented feature given to us by the 
>>> Android team, that's your prerogative. As for the rest of us, we'll decide 
>>> when we prefer to use one feature over another.
>>>
>>
>>  He makes a good point. "Solving" this issue by requesting to handle 
>> orientation changes yourself just masks the problem (unless you request to 
>> handle *all* configuration changes in which case you make more work for 
>> yourself.) Handling ori

[android-developers] Re: How do I can start a new Activity after 1 minute?

2011-10-09 Thread Zwiebel
Really thanks for helps! I could make it with it! :)

On okt. 9, 15:23, Mark Murphy  wrote:
> On Sun, Oct 9, 2011 at 9:10 AM, Zwiebel  wrote:
> > It want me to create a new method removeCallbacks(Runnable)
>
> removeCallbacks() is a method on View. Just as you called
> postDelayed() on a View, you call removeCallbacks() on a View.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.1 Programming Books:http://commonsware.com/books

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


[android-developers] Re: call startActivityForResult from button

2011-10-09 Thread Rich
In the scope of an inner class, use OuterClass.this to refer to the 
Activity.  So, if your activity class is named MainActivity, call 
MainActivity.this.startActivityForResult(intent).

The other option is to define a method in the activity that does this work 
and call the Activity's method from the onClickListener

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

Re: [android-developers] Re: How do I can start a new Activity after 1 minute?

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 9:10 AM, Zwiebel  wrote:
> It want me to create a new method removeCallbacks(Runnable)

removeCallbacks() is a method on View. Just as you called
postDelayed() on a View, you call removeCallbacks() on a View.

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

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

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


[android-developers] stop progress bar when parsing JSON finish.

2011-10-09 Thread Muchamad Jeffri
hello, i want to ask how to implement progress bar spinner in
background and then stop when parsing JSON data finish to list view.
this my source code.

package com.cob.json;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class JSONListViewActivity extends Activity {
   /** Called when the activity is first created. */
//ListView that will hold our items references back to main.xml
ListView lstTest;
//Array Adapter that will hold our ArrayList and display the items
on the ListView
ProjectsAdapter arrayAdapter;

//List that will  host our items and allow us to modify that array
adapter
ArrayList prjcts=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Initialize ListView
lstTest= (ListView)findViewById(R.id.lstText);

 //Initialize our ArrayList
prjcts = new ArrayList();
//Initialize our array adapter notice how it references the
listitems.xml layout
arrayAdapter = new ProjectsAdapter(JSONListViewActivity.this,
R.layout.list_item,prjcts);

//Set the above adapter as the adapter of choice for our list
lstTest.setAdapter(arrayAdapter);


//Instantiate the Web Service Class with he URL of the web
service not that you must pass
WebService webService = new WebService("http://
frontine.hostoi.com/jsontest.json");

//Pass the parameters if needed , if not then pass dummy one
as follows
Map params = new HashMap();
params.put("var", "");

//Get JSON response from server the "" are where the method
name would normally go if needed example
// webService.webGet("getMoreAllerts", params);
String response = webService.webGet("", params);

try
{
//Parse Response into our object
Type collectionType = new TypeToken>()
{}.getType();

//JSON expects an list so can't use our ArrayList from the
lstart
List lst= new Gson().fromJson(response,
collectionType);

//Now that we have that list lets add it to the ArrayList
which will hold our items.
for(Projects l : lst)
{
prjcts.add(l);
}

//Since we've modified the arrayList we now need to notify
the adapter that
//its data has changed so that it updates the UI
arrayAdapter.notifyDataSetChanged();
}
catch(Exception e)
{
Log.d("Error: ", e.getMessage());
}



}
protected void onListItemClick(ListView lstTest, View v, int
position, long id) {
// TODO Auto-generated method stub
//super.onListItemClick(l, v, position, id);
String selection = 
lstTest.getItemAtPosition(position).toString();
Toast.makeText(this, selection, Toast.LENGTH_LONG).show();
}


}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 do I can start a new Activity after 1 minute?

2011-10-09 Thread Zwiebel
It want me to create a new method removeCallbacks(Runnable)

On okt. 9, 14:24, Mark Murphy  wrote:
> On Sun, Oct 9, 2011 at 8:17 AM, Zwiebel  wrote:
> > I tried to call removeCallbacks in onPause, like this:
> > removeCallbacks(r1); but it doesn't good.
>
> What does "doesn't good" mean?
>
> Another possibility is for you to set yourself a boolean flag that
> your Runnable examines, and display the other activity based on the
> value of the flag.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.1 Programming Books:http://commonsware.com/books

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


Re: [android-developers] Re: How do I can start a new Activity after 1 minute?

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 8:17 AM, Zwiebel  wrote:
> I tried to call removeCallbacks in onPause, like this:
> removeCallbacks(r1); but it doesn't good.

What does "doesn't good" mean?

Another possibility is for you to set yourself a boolean flag that
your Runnable examines, and display the other activity based on the
value of the flag.

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

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

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


Re: [android-developers] Re: Database cursor as null

2011-10-09 Thread gyanu maharjan
hi , i have solved similar problem.i have a list generated from the phone
contact and on the top of populated list view i have added text field and
search button so the user can search from the populated list.You and my
fuction seems similar i.e list view Since i am using list view i used cursor
on the custom ListAdapter to populate the data  which i placed on
constructor declaration so the required data is available for render in
getView() of adapter.it worked fine for me and code is little complex for
 myself also when i look back at glance  on the list.setOnClickListener()
which i implement differently but Adapter portion is simple.I don't know how
you linking with helper class.

On Sun, Oct 9, 2011 at 8:45 AM, decode  wrote:

> The data is quite huge, Like 10,000+ rows.
> cursor is declared in a helper class ...  a public class. I am closing
> the cursor in onDestroy of the class extending Application.
>
> There is a null check before launching the second activity. But, in
> second activity it is null. Doesnt happen always and not reproducible
> on our devices. Was reported by some users.
>
>
>
>
>
> On Oct 9, 8:27 am, lbendlin  wrote:
> > is your cursor declared in the application or in the activity?
> >
> > As you already realised there is no real need to hold on to the cursor.
> All
> > you need is the index of the table line for which you want to show the
> field
> > data in the second 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

[android-developers] Re: How do I can start a new Activity after 1 minute?

2011-10-09 Thread Zwiebel
I tried to call removeCallbacks in onPause, like this:
removeCallbacks(r1); but it doesn't good.

Here is my code:

public class Screen extends Activity{
int counter = 0;
Intent result;
Runnable r1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen);

SharedPreferences content = getSharedPreferences("counter", 0);
SharedPreferences.Editor editor = content.edit();
editor.putInt("counter", 0);
editor.commit();

result = new Intent("com.problem.RESULT");

r1 = new Runnable() {

@Override
public void run() {
startActivity(result);
}
};

ready.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ready.setVisibility(-1);
click.setVisibility(1);
counter = 0;
ready.postDelayed(r1, 6);
}
});

@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
SharedPreferences content = getSharedPreferences("counter", 0);
SharedPreferences.Editor editor = content.edit();
editor.putInt("counter", counter);
editor.commit();
removeCallbacks(r1); 
}

I declared the buttons, and everything, I only have problem with the
removeCallbacks. Thanks.



On okt. 9, 13:52, Mark Murphy  wrote:
> On Sun, Oct 9, 2011 at 7:26 AM, Zwiebel  wrote:
> > Ok thanks I could make it now with it, I had a problem in my code. Now
> > I have an another problem: Even if the user exit the program in THE
> > minute, my Activity will appear itself. How can I do against it?
>
> Call removeCallbacks() to remove the scheduled Runnable.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.1 Programming Books:http://commonsware.com/books

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


Re: [android-developers] Re: How do I can start a new Activity after 1 minute?

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 7:26 AM, Zwiebel  wrote:
> Ok thanks I could make it now with it, I had a problem in my code. Now
> I have an another problem: Even if the user exit the program in THE
> minute, my Activity will appear itself. How can I do against it?

Call removeCallbacks() to remove the scheduled Runnable.

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

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

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


[android-developers] Re: Check App instalation way

2011-10-09 Thread viktor
Done! ApplicationInfo

On 9 Жов, 13:20, viktor  wrote:
> Is it possible to check how an app was installed onto device?
>
> For e. : Market or it is installed by user, or it is in system folder
> system/app/*.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 do I can start a new Activity after 1 minute?

2011-10-09 Thread Zwiebel
Ok thanks I could make it now with it, I had a problem in my code. Now
I have an another problem: Even if the user exit the program in THE
minute, my Activity will appear itself. How can I do against it?

On okt. 9, 12:22, Mark Murphy  wrote:
> On Sun, Oct 9, 2011 at 6:18 AM, Zwiebel  wrote:
> > I have a button. If the user clicks on it, I want to start a new
> > Activity after 1 minute. Between the click and the new activity, the
> > user can click on an another button more times. How I can start the
> > new Activity after 1 minute, if the user clicks the button? I tried to
> > make it with a new Runnable thread, but I couldn't use the postdelayed
> > method.
>
> postDelayed() would seem to be the best answer here, so perhaps you
> could explain why you couldn't use it.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.1 Programming Books:http://commonsware.com/books

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


[android-developers] layout changes when on-screen keyboard shows/hides suggestions

2011-10-09 Thread Alexander Bürger

Dear Android experts,

I have a little problem with a layout of an activity. Some elements are 
moving in a strange way depending on the state of the on-screen keyboard.


For testing, I made an Activity that only calls setContentView with this 
layout:


http://schemas.android.com/apk/res/android";
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">






The problem is this: when starting to type in the EditText, the 
on-screen keyboard pops up a "suggestion bar" with some possible 
completions for the text typed in so far. When this suggestion bar is 
showing, the Button is moving up by about one pixel on my device (Xperia 
neo, 2.3.4), and when the suggestion bar is hidden again, the button 
moves back into the original position.I have no idea why this happens. 
To my eyes, the layout seems correct. I would be happy about any 
suggestions on how to get rid of this problem.


Thanks for your help,

Alexander

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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 do I can start a new Activity after 1 minute?

2011-10-09 Thread viktor
CountDownTimer, help you, you can stop timer anytime.

On 9 Жов, 13:18, Zwiebel  wrote:
> I have a button. If the user clicks on it, I want to start a new
> Activity after 1 minute. Between the click and the new activity, the
> user can click on an another button more times. How I can start the
> new Activity after 1 minute, if the user clicks the button? I tried to
> make it with a new Runnable thread, but I couldn't use the postdelayed
> method.
>
> Thanks in advance.

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


Re: [android-developers] How do I can start a new Activity after 1 minute?

2011-10-09 Thread Mark Murphy
On Sun, Oct 9, 2011 at 6:18 AM, Zwiebel  wrote:
> I have a button. If the user clicks on it, I want to start a new
> Activity after 1 minute. Between the click and the new activity, the
> user can click on an another button more times. How I can start the
> new Activity after 1 minute, if the user clicks the button? I tried to
> make it with a new Runnable thread, but I couldn't use the postdelayed
> method.

postDelayed() would seem to be the best answer here, so perhaps you
could explain why you couldn't use it.

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

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

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


Re: [android-developers] Can we 'include' a xml into another preference xml by file? and by jar(another package)?

2011-10-09 Thread Mark Murphy
On Sat, Oct 8, 2011 at 12:25 PM, Build account  wrote:
> 1. Can we include a xml layout file from another JAR package?
>  Like  ???
>  Is this possible?

Not that I am aware of. Note that you can call
addPreferencesFromResource() multiple times, if needed.

> 2. Can we include a xml preference file from another JAR package?

What is "another JAR package"?

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

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

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


[android-developers] Check App instalation way

2011-10-09 Thread viktor
Is it possible to check how an app was installed onto device?

For e. : Market or it is installed by user, or it is in system folder
system/app/*.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Regarding retrieving date and time from cell tower

2011-10-09 Thread sourabh sahu
This is the problem, case is there is no internet and data connectivity,
only gsm network is available,I dont want to use any internet services.

Please provide any suggestion.

Thanks & Regards,
Sourabh

On Sun, Oct 9, 2011 at 3:10 AM, Kostya Vasilyev  wrote:

> Not every cellular network provides date and time.
>
> I believe it's mandatory for CDMA (because of the nature of the protocol),
> but some GSM networks don't provide this info.
>
> If you need an independent time source, consider using NTP to obtain time
> from the Internet.
>
> -- Kostya
>
> 09.10.2011 14:00, sourabh sahu пишет:
>
>  In my application,I need current date and time, but as of now if user
>> changes the date of a device.the previous dates are coming.I want it to be
>> exact current date and time.
>> Thanks,
>> sourabh
>>
>
> --
> 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

[android-developers] How do I can start a new Activity after 1 minute?

2011-10-09 Thread Zwiebel
I have a button. If the user clicks on it, I want to start a new
Activity after 1 minute. Between the click and the new activity, the
user can click on an another button more times. How I can start the
new Activity after 1 minute, if the user clicks the button? I tried to
make it with a new Runnable thread, but I couldn't use the postdelayed
method.

Thanks in advance.

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


Re: [android-developers] Regarding retrieving date and time from cell tower

2011-10-09 Thread Kostya Vasilyev

Not every cellular network provides date and time.

I believe it's mandatory for CDMA (because of the nature of the 
protocol), but some GSM networks don't provide this info.


If you need an independent time source, consider using NTP to obtain 
time from the Internet.


-- Kostya

09.10.2011 14:00, sourabh sahu пишет:
In my application,I need current date and time, but as of now if user 
changes the date of a device.the previous dates are coming.I want it 
to be exact current date and time.

Thanks,
sourabh


--
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] Regarding retrieving date and time from cell tower

2011-10-09 Thread sourabh sahu
In my application,I need current date and time, but as of now if user
changes the date of a device.the previous dates are coming.I want it to be
exact current date and time.

Thanks,
sourabh

On Sat, Oct 8, 2011 at 11:06 PM, TreKing  wrote:

> On Sat, Oct 8, 2011 at 3:10 AM, sourabh sahu  wrote:
>
>> Is there any way to get date and time from cell tower in android
>> programmatically.
>
>
> IDK, but is there a reason you need it specifically from the cell tower?
> The device has this information ...
>
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Re: working with tabs (tabhost)

2011-10-09 Thread Kristoffer
Hello.

Thanks for the reply, but iam not sure how i should implement that in
my code, here is my code that build the tabs.

TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;

intent = new Intent().setClass(this, Main.class);
spec = tabHost.newTabSpec("main").setIndicator("Main")
.setContent(intent);
tabHost.addTab(spec);

intent = new Intent().setClass(this, Setting.class);
spec = tabHost.newTabSpec("settings").setIndicator("Settings")
.setContent(intent);
tabHost.addTab(spec);

tabHost.setCurrentTab(0);


And i also have this to work with:

int verified = pref.getInt("verified", 0);

if (verified == 1) {
 Then i need to change tab 1 to Main1.class instead of
Main.class
 }



On 9 Okt, 06:22, Subin Sebastian  wrote:
> Hi Kristoffer,
> As I understand from your question, I think you need to set a
> different content for the "main" tab when you change a specific
> preference in the "settings" tab. If I'm not wrong the below tutorial
> will help you to do so.
>
> http://subinsebastien.tumblr.com/post/6783812456/android-tab-layout
>
> In the above code, instead of passing a new TabSpec, create one
> reusable tabspec like,
> TabHost.TabSpec spec =
> mTabHst.newTabSpec("tab_test1").setIndicator("One",res.getDrawable(R.drawab­le.one)).setContent(i);
>
> In your method which is triggered on change of specific preference,
> use the following code.
>
> spec = spec.setContent(your_new_activity);
>
> I think this code should work, but I did not tested it yet. Please let
> me know if anything goes wrong.
>
> Thanks
>
> On 10/9/11, Kristoffer  wrote:
>
>
>
>
>
> > Hello.
>
> > Iam not sure this is possible to do but here is what i need to do.
>
> > Iam now creating two tabs one for the "main" page and one for the
> > "settings".
> > Lets call them main.java and setting.java
>
> > When i change a "thing" on the setting.java page then i need to show a
> > different intent (main1.java) when the user push the "main" tab.
>
> > Is this possible in some way?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Subin 
> Sebastianhttp://in.linkedin.com/in/subinsebastienhttps://plus.google.com/subin

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

2011-10-09 Thread Kostya Vasilyev


09.10.2011 2:41, Studio LFP ?:

*TreKing, Kostya, Romain Guy,*

I do understand what you guys are saying, so I am listening, but it 
seems to be a contradiction since it seems most of the internal 
applications use it, including quite a few that Google themselves send 
with the devices. Maybe they aren't, but based on the speed of the 
rotate and the way the screen looks, I'm pretty sure they are.


[snip]


That's where those methods pointed out by TreKing come into play, as an 
optimization.


And here is a blog post written by Romain Guy that covers this in more 
detail:


http://android-developers.blogspot.com/2009/02/faster-screen-orientation-change.html

Those are optimizations for the common cases.

The manifest attribute is fine, too, as long as 1) one understands that 
it's also an optimization 2)  the code can handle the general case, 
where the activity gets recreated and 3) the layout is the same for all 
orientations.




It seems like there are so many times where this is useful and being 
used, yet people seem to be trying to tell people that it is "wrong", 
"incorrect", "you are a horrible person and coder for using this".


To me, it's wrong to mix up the concepts of "here is how you fix this 
problem" and "this is an optimization you can make".


To me it's also wrong to forget about the general case, i.e. other 
config changes and the out of memory killer (and maybe more cases I 
can't think of right now).


YMMV.



Steven
Studio LFP
http://www.studio-lfp.com


On Saturday, October 8, 2011 4:34:14 PM UTC-5, Romain Guy (Google) wrote:

*TreKing,*

If you choose to ignore a well documented feature given to us
by the Android team, that's your prerogative. As for the rest
of us, we'll decide when we prefer to use one feature over
another.


He makes a good point. "Solving" this issue by requesting to
handle orientation changes yourself just masks the problem (unless
you request to handle *all* configuration changes in which case
you make more work for yourself.) Handling orientation changes
yourself also has a lot of side effects (if you want to have a
different layout in landscape and portrait you now need to deal
with it manually.)

-- 
Romain Guy

Android framework engineer
roma...@android.com

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


--
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] Re: Video in WebView

2011-10-09 Thread gyanu maharjan
check this..
http://stackoverflow.com/questions/4810421/open-video-player-in-webview

On Sun, Oct 9, 2011 at 1:46 PM, Siva Prakash wrote:

> Yes I want to play a video from You tube or from another HTML file.
>
>
>
>
> On Sun, Oct 9, 2011 at 1:22 PM, Efi Merdler-Kravitz  > wrote:
>
>> By video you mean youtube?
>>
>> On Oct 9, 7:49 am, Siva Prakash  wrote:
>> > Thanks
>> >
>> > This code is working for normal web pages but not with video/audio
>> >
>> > private WebView myWebView;
>> > private ProgressDialog pd ;
>> >
>> > this.myWebView = (WebView) this.findViewById(R.id.webView);
>> >
>> > Bundle extras = getIntent().getExtras();
>> > if(extras !=null  )
>> > {
>> >  String strURL = extras.getString("SCANNED_URL");
>> >  if (strURL != "")
>> > {
>> >
>> > myWebView. getSettings().setJavaScriptEnabled(true);
>> > myWebView. getSettings().setAllowFileAccess(true);
>> >
>> > myWebView. getSettings().setPluginsEnabled (true);
>> >
>> > FrameLayout mContentView = (FrameLayout) getWindow().
>> > getDecorView().findViewById(android.R.id.content);
>> > final View zoom = this.myWebView.getZoomControls();
>> >
>> > zoom.setVisibility(View.GONE);
>> >  this.pd = ProgressDialog.show(WebViewActivity.this, "Progress",
>> > "At Work...", true);
>> >
>> > this.myWebView.loadUrl(strURL);
>> >
>> > }
>> > }
>> >
>> > Thanks
>> >
>> > On Sun, Oct 9, 2011 at 10:22 AM, Subin Sebastian
>> > wrote:
>> >
>> >
>> >
>> > > Hello Siva,
>> > > I suggest you to put your code here for someone to find out why it
>> > > doesn't do that.
>> >
>> > > Regards.
>> >
>> > > On 10/9/11, Siva Prakash  wrote:
>> > > > Hi
>> >
>> > > > Im trying to load a video in WebView but it doesnt do that? Any
>> settings
>> > > > need to be marked?
>> >
>> > > > --
>> > > > You received this message because you are subscribed to the Google
>> > > > Groups "Android Developers" group.
>> > > > To post to this group, send email to
>> android-developers@googlegroups.com
>> > > > To unsubscribe from this group, send email to
>> > > > android-developers+unsubscr...@googlegroups.com
>> > > > For more options, visit this group at
>> > > >http://groups.google.com/group/android-developers?hl=en
>> >
>> > > --
>> > > Subin Sebastian
>> > >http://in.linkedin.com/in/subinsebastien
>> > >https://plus.google.com/subin<
>> > >https://plus.google.com/118262481642737404812>
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> > > Groups "Android Developers" group.
>> > > To post to this group, send email to
>> android-developers@googlegroups.com
>> > > To unsubscribe from this group, 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
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, 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] Multithreading in Android?

2011-10-09 Thread venugopal reddy
Hi  dear friends,

I  Created one Internet application(using webview). its working fine.

I have one doubt, In Applications If click  our application icon it
will open in browser . i can operate..

now my requirement is if  i close the browser straight away that
application should be closed...

but the application is running background... how can I achieve my
requirement,

Should i write  any particular code or any  setting in the emulator..


Pls help me

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

2011-10-09 Thread ehsan azimzadeh
I want to determine which bytecodes are usually execute. In other words I'm
doing a bytecode profiling. This is not only in a specific domain. Is there
any universal and valid benchmark?

Ehsan
On 8 October 2011 15:09, Damien Cooke  wrote:

> Not sure what you are trying to benchmark, but if it is network based, you
> should look at FABAN written by some bright people at Sun a few years ago.
>
> Damien
>
> On 09/10/2011, at 5:10 AM, ehsan azimzadeh wrote:
>
> > Hi
> >
> > Is there any android benchmark?
> > I want JAVA source not .apk or any other formats.
> >
> > Thanks
> > Ehsan
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, 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

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

2011-10-09 Thread Siva Prakash
Yes I want to play a video from You tube or from another HTML file.




On Sun, Oct 9, 2011 at 1:22 PM, Efi Merdler-Kravitz
wrote:

> By video you mean youtube?
>
> On Oct 9, 7:49 am, Siva Prakash  wrote:
> > Thanks
> >
> > This code is working for normal web pages but not with video/audio
> >
> > private WebView myWebView;
> > private ProgressDialog pd ;
> >
> > this.myWebView = (WebView) this.findViewById(R.id.webView);
> >
> > Bundle extras = getIntent().getExtras();
> > if(extras !=null  )
> > {
> >  String strURL = extras.getString("SCANNED_URL");
> >  if (strURL != "")
> > {
> >
> > myWebView. getSettings().setJavaScriptEnabled(true);
> > myWebView. getSettings().setAllowFileAccess(true);
> >
> > myWebView. getSettings().setPluginsEnabled (true);
> >
> > FrameLayout mContentView = (FrameLayout) getWindow().
> > getDecorView().findViewById(android.R.id.content);
> > final View zoom = this.myWebView.getZoomControls();
> >
> > zoom.setVisibility(View.GONE);
> >  this.pd = ProgressDialog.show(WebViewActivity.this, "Progress",
> > "At Work...", true);
> >
> > this.myWebView.loadUrl(strURL);
> >
> > }
> > }
> >
> > Thanks
> >
> > On Sun, Oct 9, 2011 at 10:22 AM, Subin Sebastian
> > wrote:
> >
> >
> >
> > > Hello Siva,
> > > I suggest you to put your code here for someone to find out why it
> > > doesn't do that.
> >
> > > Regards.
> >
> > > On 10/9/11, Siva Prakash  wrote:
> > > > Hi
> >
> > > > Im trying to load a video in WebView but it doesnt do that? Any
> settings
> > > > need to be marked?
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > Subin Sebastian
> > >http://in.linkedin.com/in/subinsebastien
> > >https://plus.google.com/subin<
> > >https://plus.google.com/118262481642737404812>
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, 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
>

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

2011-10-09 Thread Efi Merdler-Kravitz
By video you mean youtube?

On Oct 9, 7:49 am, Siva Prakash  wrote:
> Thanks
>
> This code is working for normal web pages but not with video/audio
>
> private WebView myWebView;
> private ProgressDialog pd ;
>
> this.myWebView = (WebView) this.findViewById(R.id.webView);
>
> Bundle extras = getIntent().getExtras();
> if(extras !=null  )
> {
>  String strURL = extras.getString("SCANNED_URL");
>  if (strURL != "")
> {
>
>     myWebView. getSettings().setJavaScriptEnabled(true);
>     myWebView. getSettings().setAllowFileAccess(true);
>
>     myWebView. getSettings().setPluginsEnabled (true);
>
>     FrameLayout mContentView = (FrameLayout) getWindow().
>     getDecorView().findViewById(android.R.id.content);
>     final View zoom = this.myWebView.getZoomControls();
>
>     zoom.setVisibility(View.GONE);
>      this.pd = ProgressDialog.show(WebViewActivity.this, "Progress",
>                 "At Work...", true);
>
>     this.myWebView.loadUrl(strURL);
>
> }
> }
>
> Thanks
>
> On Sun, Oct 9, 2011 at 10:22 AM, Subin Sebastian
> wrote:
>
>
>
> > Hello Siva,
> > I suggest you to put your code here for someone to find out why it
> > doesn't do that.
>
> > Regards.
>
> > On 10/9/11, Siva Prakash  wrote:
> > > Hi
>
> > > Im trying to load a video in WebView but it doesnt do that? Any settings
> > > need to be marked?
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Subin Sebastian
> >http://in.linkedin.com/in/subinsebastien
> >https://plus.google.com/subin<
> >https://plus.google.com/118262481642737404812>
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, 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: call startActivityForResult from button

2011-10-09 Thread John
"this" is the button. How do I get the Activity that the button is
housed in inside the Button.OnClick() event handler?

On Oct 8, 11:28 pm, TreKing  wrote:
> On Sun, Oct 9, 2011 at 12:14 AM, John  wrote:
> >  ((Activity) getApplicationContext()).startActivityForResult(intent,
> > BROWSE_FOR_FOLDER);
>
> Do not use getApplicationContext() unless you know what you're doing. It is
> the context associated with your Application, not your Activity.
>
> You need an Activity, so just use "this" - you're already running in an
> Activity, there's no reason to try using getApplicationContext().
>
> --- 
> --
> TreKing  - Chicago
> transit tracking app for Android-powered devices

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