[android-beginners] Re: Best Practices
Hi Spredzy, In addition to the performance notes that you've already found at the main Android site, coding conventions in general usage by Android developers, and that are based on Sun's Java coding guidelines, can be found at: http://source.android.com/submit-patches/code-style-guide If you are using Eclipse, check the following stackoverflow link: http://stackoverflow.com/questions/2480596/did-anyone-create-the-java-code-formatter-profile-for-eclipse-ide-that-conforms-t This has links to get the Eclipse code formatter template and import organizer template recommended by the Android code style guide (the top link). You can just copy the templates and import them into Eclipse (for the Galileo Eclipse release this would be: Window- Preferences-Java-Code Style-Formatter, and ...Code Style-Import Organizer, and them Import). Hope this helps! XCaffeinated On Mar 24, 5:53 am, Spredzy yguen...@gmail.com wrote: Hi everyone, I'm quiet new in the Android world and I am starting some applications developement. I would like to know if some of you knows any website with known Best Practices and Pitfalls to avoid. I've read the part on the official Android pages, but I was wondering if someone knew more tricks. Thank you a lot, Cordially, -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe from this group, send email to android-beginners+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
[android-beginners] Re: How to download android source code in windows machine
There is a great page here Attaching Android platform source in Eclipse: http://android.opensourceror.org/2010/01/18/android-source/ that explains both how to get the correct sources for the platform you are looking for and how to get Eclipse to recognize it. The author also took the time to gather zips of sources for 1.5, 1.6 and 2.1, which you can just download and start browsing immediately. Skip down to the section on 'What you came here for'. Immediately after that section he explains how to get it working with Eclipse. He also has links to several other related articles. Hope this helps! XCaf On Feb 17, 11:38 am, Kitzy kitzyk...@gmail.com wrote: I read online that this link should work for the latest source:http://git.source.android.com/?p=platform/frameworks/base.git;a=snaps... The filename is base-HEAD.tar.gz and is 30mb It does not support download accelerator and the speed average is 15kbps. I haven't been able to get it to finish downloading however :( I did find however you can download Cupcake Android v1.5 source code 21.6 mb:http://rgruet.free.fr/public/android-1.5-cupcake-src.ziphttp://www.digginmobile.com/android.asphttp://www.mediafire.com/download.php?ulnovo4wzde And they are requesting mirrors to the code if you can set one up. If anyone knows any other sites or ways, they would be greatly appriciated. Sincierly, -Kitzy On Feb 10, 12:42 pm, Abhijeet Rukmangad talktoabhij...@gmail.com wrote: Hello, Any Idea how to download Android code on a windows machine..? It is mentioned on google site that code cannot be downloaded on windows machine.. So Is there any torrent available for same..? please let me know if anyone of you has downloaded the source code on windows machine..? Thanks in appreciation !! -- Best Regards, Abhijeet Rukmangad- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Serial over Bluetooth
Apologies for the lengthy post, but I wanted this to be at least semi- useful, and there is not a lot of info out there. I see that the OP is from awhile ago, but that this thread has been resurrected. I am currently using my Droid (firmware push: 2.0.1) to communicate to an ArduinoBT (Bluetooth) board via SPP (the ArduinoBT's default) using the well-known SPP UUID (0x1101 host side, and the UUID-extended version of 0x1101 on the client (Android) side; see the code below for the actual UUID). The ArduinoBT board uses a BlueGiga WT11 module and iWrap firmware/API. We currently have it interfaced to a hobby robot. *** Following pertains to Android 2.0 and up; there is no public Bluetooth API before 2.0 *** Given that the ArduinoBT comes out of the box set up for SPP, I configured our Android client application to do the same. I've commented the code, but you need to know something about Bluetooth to get the most out of it. I highly recommend Bluetooth Essentials for Programmers, available for free. On the Android side: the Android SDK doc, and the Bluetooth Chat Sample are excellent references. Before you run the client, you need to pair your robot controller with your Android device. It doesn't have to be connected, just paired. You can do the discovery/pairing from your handset's standard networking settings. You will need a PIN; Android requires authentication even if your robot controller doesn't (most controllers let you set this as an option). You will also need to enable Bluetooth. This is a brain-dead simple client, no threading, no receiving; all it does is send commands to our robot (modified a bit, since the OP only cares about the SPP communication material), and should be very easy to modify for various purposes. All that needs to be changed on this side is the MAC address. Enter the robot controller's MAC address in place of the XX:XX... string below. package com.example.thinbtclient; import java.io.IOException; import java.io.OutputStream; import java.util.UUID; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.os.Bundle; import android.util.Log; import android.widget.Toast; public class ThinBTClient extends Activity { private static final String TAG = THINBTCLIENT; private static final boolean D = true; private BluetoothAdapter mBluetoothAdapter = null; private BluetoothSocket btSocket = null; private OutputStream outStream = null; //Well known SPP UUID (will *probably* map to RFCOMM channel 1 (default) if not in use); //see comments in onResume(). private static final UUID MY_UUID = UUID.fromString(1101--1000-8000-00805F9B34FB); private static String address = XX:XX:XX:XX:XX:XX; //== hardcode your robot (server) MAC address here... /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); if(D) Log.e(TAG, +++ ON CREATE +++); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter == null) { Toast.makeText(this, Bluetooth is not available., Toast.LENGTH_LONG).show(); finish(); return; } if (!mBluetoothAdapter.isEnabled()) { Toast.makeText(this, Please enable your BT and re-run this program., Toast.LENGTH_LONG).show(); finish(); return; } if(D) Log.e(TAG, +++ DONE IN ON CREATE, GOT LOCAL BT ADAPTER ++ +); } @Override public void onStart() { super.onStart(); if(D) Log.e(TAG, ++ ON START ++); } @Override public void onResume() { super.onResume(); if(D) { Log.e(TAG, + ON RESUME +); Log.e(TAG, + ABOUT TO ATTEMPT CLIENT CONNECT +); } //When this returns, it will 'know' about the server, via it's MAC address. BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); //We need two things before we can successfully connect (authentication issues //aside): a MAC address, which we already have, and an RFCOMM channel. //Because RFCOMM channels (aka ports) are limited in number, Android doesn't allow //you to use them directly; instead you request a RFCOMM mapping based on a service //ID. In our case, we will use the well-known SPP Service ID. This ID is in UUID //(GUID to you Microsofties) format. Given the UUID, Android will handle the //mapping for you. Generally, this will return RFCOMM 1, but not always; it //depends what other BlueTooth services are in use on your Android device. try { btSocket = device.createRfcommSocketToServiceRecord(MY_UUID);
[android-beginners] Re: Serial over Bluetooth
I've posted a nicely-formatted version of the code from the previous post here: http://www.anddev.org/viewtopic.php?p=35487#35487 -XCaf On Feb 11, 7:02 pm, XCaffeinated ssatn...@gmail.com wrote: Apologies for the lengthy post, but I wanted this to be at least semi- useful, and there is not a lot of info out there. I see that the OP is from awhile ago, but that this thread has been resurrected. I am currently using my Droid (firmware push: 2.0.1) to communicate to an ArduinoBT (Bluetooth) board via SPP (the ArduinoBT's default) using the well-known SPP UUID (0x1101 host side, and the UUID-extended version of 0x1101 on the client (Android) side; see the code below for the actual UUID). The ArduinoBT board uses a BlueGiga WT11 module and iWrap firmware/API. We currently have it interfaced to a hobby robot. *** Following pertains to Android 2.0 and up; there is no public Bluetooth API before 2.0 *** Given that the ArduinoBT comes out of the box set up for SPP, I configured our Android client application to do the same. I've commented the code, but you need to know something about Bluetooth to get the most out of it. I highly recommend Bluetooth Essentials for Programmers, available for free. On the Android side: the Android SDK doc, and the Bluetooth Chat Sample are excellent references. Before you run the client, you need to pair your robot controller with your Android device. It doesn't have to be connected, just paired. You can do the discovery/pairing from your handset's standard networking settings. You will need a PIN; Android requires authentication even if your robot controller doesn't (most controllers let you set this as an option). You will also need to enable Bluetooth. This is a brain-dead simple client, no threading, no receiving; all it does is send commands to our robot (modified a bit, since the OP only cares about the SPP communication material), and should be very easy to modify for various purposes. All that needs to be changed on this side is the MAC address. Enter the robot controller's MAC address in place of the XX:XX... string below. package com.example.thinbtclient; import java.io.IOException; import java.io.OutputStream; import java.util.UUID; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.os.Bundle; import android.util.Log; import android.widget.Toast; public class ThinBTClient extends Activity { private static final String TAG = THINBTCLIENT; private static final boolean D = true; private BluetoothAdapter mBluetoothAdapter = null; private BluetoothSocket btSocket = null; private OutputStream outStream = null; //Well known SPP UUID (will *probably* map to RFCOMM channel 1 (default) if not in use); //see comments in onResume(). private static final UUID MY_UUID = UUID.fromString(1101--1000-8000-00805F9B34FB); private static String address = XX:XX:XX:XX:XX:XX; //== hardcode your robot (server) MAC address here... /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); if(D) Log.e(TAG, +++ ON CREATE +++); mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter == null) { Toast.makeText(this, Bluetooth is not available., Toast.LENGTH_LONG).show(); finish(); return; } if (!mBluetoothAdapter.isEnabled()) { Toast.makeText(this, Please enable your BT and re-run this program., Toast.LENGTH_LONG).show(); finish(); return; } if(D) Log.e(TAG, +++ DONE IN ON CREATE, GOT LOCAL BT ADAPTER ++ +); } @Override public void onStart() { super.onStart(); if(D) Log.e(TAG, ++ ON START ++); } @Override public void onResume() { super.onResume(); if(D) { Log.e(TAG, + ON RESUME +); Log.e(TAG, + ABOUT TO ATTEMPT CLIENT CONNECT +); } //When this returns, it will 'know' about the server, via it's MAC address. BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); //We need two things before we can successfully connect (authentication issues //aside): a MAC address, which we already have, and an RFCOMM channel. //Because RFCOMM channels (aka ports) are limited in number, Android doesn't allow //you to use them directly; instead you request a RFCOMM mapping based on a service //ID. In our case, we will use the well-known SPP Service ID. This ID is in UUID //(GUID to you Microsofties) format. Given
[android-beginners] Re: CustomView - horizontal slider help needed
Hi MobDev, Glad you found it useful. For some reason, I referred to you as xxx in my OP to you, probably because I wrote it offline, and if there's a way to edit Google Groups' posts once they're submitted, it eludes me *completely*. I will organize these notes a bit better and post a tutorial on custom seekbars on anddev In The Near Future(TM); I will post a trackback here when I do. In the meantime if you run into problems just ask - sometimes the interactions of some of the layout attributes can be a bit confusing. -XCaf On Jan 29, 11:54 am, MobDev developm...@mobilaria.com wrote: wow ! great information, I will be having a look at this next week ! At a first glance it looks like a very gooid pointer on how to get thins done :D Thx a lot ! On 28 jan, 02:49, XCaffeinated ssatn...@gmail.com wrote: Apologies, I forgot the links in the above post: The full composited image:http://i916.photobucket.com/albums/ad9/XCaf/SeekbarOverTestBackground... The four component images:http://i916.photobucket.com/albums/ad9/XCaf/CustomSeekbarParts.png -XCaf On Jan 27, 8:39 pm, XCaffeinated ssatn...@gmail.com wrote: Hi xxx Sliders in Android are called Seekbars. This may help you when you search online. Recently, I needed to do exactly what you are describing. You can see a test screenshot of this - a Seekbar with images to the left and right (and a text label above as well, which is also an image, and all are composited on top of a test menu background) here: The component images are (I’ve combined them into one photobucket image, but they are four separate images in my Android project, and some have been resized): You can see from this screenshot that the ‘left’, ‘right’ and ‘above’ images are actually all part of a single image. All images are pngs. You use an .xml file containing a layer-list to specify which pngs to use for your seekbar elements. In my screenshots you can see that I have a translucent Seekbar base, and then a solid overlay to indicate the actual progress (I’m not using a thumb or secondary progress here). This .xml file looks like: ?xml version=1.0 encoding=utf-8? layer-list xmlns:android=http://schemas.android.com/apk/res/ android item android:id=@android:id/background android:drawable=@drawable/sbrsoundbase_normal /item item android:id=@android:id/progress android:drawable=@drawable/sbrsoundoverlay_normal /item /layer-list where sbrsoundbase_normal is the png for the seekbar base, and sbrsoundoverlay_normal is the png for the progress overlay. These are the second and third images in the component screenshot above. Once you’ve decided what images you want, you will need a layout similar to: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent android:gravity=center android:background=@drawable/screenbackground LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:gravity=center_horizontal android:background=@drawable/sbrsoundbackground SeekBar android:id=@+id/sbrsound android:layout_width=wrap_content android:layout_height=wrap_content android:progressDrawable=@drawable/sbrsound android:secondaryProgress=0 android:thumb=@null android:max=10 android:minHeight=10dip android:minWidth=200dip android:layout_marginTop=15dip android:paddingTop=20dip android:paddingBottom=20dip /SeekBar /LinearLayout /LinearLayout The progressDrawable attribute is where you reference the .xml file described previously. I’ve included an overall parent background image (screenbackground), in a master LinearLayout, to show how you might reuse a single standard fullsize image for all your menu backgrounds. This corresponds to the ‘Backgound Image’ png in the screenshot. The attributes most likely to bite you are minHeight and minWidth. I had to make my minHeight *exactly* equal to my artwork height which is 15 pixels high (15 pixels == 10 dip on Droid) in order to avoid scaling artifacts; I’m sure there is a better way to do this, but I’ve not investigated fully. Similarly for minWidth – it is the exact width dimension of my artwork, 300 pixels (200 dip for the Droid). So this is not elegant, but hopefully will get you going in the right direction. The paddingXXX attributes make it much easier for people with large fingers to interact with the Seekbar (try removing them and you will see ), whereas layout_marginTop just
[android-beginners] Re: CustomView - horizontal slider help needed
Hi xxx Sliders in Android are called Seekbars. This may help you when you search online. Recently, I needed to do exactly what you are describing. You can see a test screenshot of this - a Seekbar with images to the left and right (and a text label above as well, which is also an image, and all are composited on top of a test menu background) here: The component images are (I’ve combined them into one photobucket image, but they are four separate images in my Android project, and some have been resized): You can see from this screenshot that the ‘left’, ‘right’ and ‘above’ images are actually all part of a single image. All images are pngs. You use an .xml file containing a layer-list to specify which pngs to use for your seekbar elements. In my screenshots you can see that I have a translucent Seekbar base, and then a solid overlay to indicate the actual progress (I’m not using a thumb or secondary progress here). This .xml file looks like: ?xml version=1.0 encoding=utf-8? layer-list xmlns:android=http://schemas.android.com/apk/res/ android item android:id=@android:id/background android:drawable=@drawable/sbrsoundbase_normal /item item android:id=@android:id/progress android:drawable=@drawable/sbrsoundoverlay_normal /item /layer-list where sbrsoundbase_normal is the png for the seekbar base, and sbrsoundoverlay_normal is the png for the progress overlay. These are the second and third images in the component screenshot above. Once you’ve decided what images you want, you will need a layout similar to: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent android:gravity=center android:background=@drawable/screenbackground LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:gravity=center_horizontal android:background=@drawable/sbrsoundbackground SeekBar android:id=@+id/sbrsound android:layout_width=wrap_content android:layout_height=wrap_content android:progressDrawable=@drawable/sbrsound android:secondaryProgress=0 android:thumb=@null android:max=10 android:minHeight=10dip android:minWidth=200dip android:layout_marginTop=15dip android:paddingTop=20dip android:paddingBottom=20dip /SeekBar /LinearLayout /LinearLayout The progressDrawable attribute is where you reference the .xml file described previously. I’ve included an overall parent background image (screenbackground), in a master LinearLayout, to show how you might reuse a single standard fullsize image for all your menu backgrounds. This corresponds to the ‘Backgound Image’ png in the screenshot. The attributes most likely to bite you are minHeight and minWidth. I had to make my minHeight *exactly* equal to my artwork height which is 15 pixels high (15 pixels == 10 dip on Droid) in order to avoid scaling artifacts; I’m sure there is a better way to do this, but I’ve not investigated fully. Similarly for minWidth – it is the exact width dimension of my artwork, 300 pixels (200 dip for the Droid). So this is not elegant, but hopefully will get you going in the right direction. The paddingXXX attributes make it much easier for people with large fingers to interact with the Seekbar (try removing them and you will see ), whereas layout_marginTop just adds a bit of space above the control. The max attribute again works in conjunction with the artwork so the Seekbar appears to increment in discrete chunks (one element at a time in whatever direction the user is sliding in). If you remove it, max will default to 100, and you will see the Seekbar slide almost continuously as the user slides his finger. The gravity attribute applies to all it’s children. So the first ‘gravity=”center”’ translates to “center the sound background image, and the sound Seekbar images”. The second ‘gravity=”center_horizontally”’ translates to “center the sound Seekbar images left to right” The .java portion of this is extremely straightforward: public class CustomSeekbar extends Activity { private static final String TAG = MYTAG; SeekBar sbrSound; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); sbrSound = (SeekBar)findViewById(R.id.sbrsound); sbrSound.setOnSeekBarChangeListener(mSoundSeekbarListener); } private OnSeekBarChangeListener mSoundSeekbarListener = new OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) { Log.v(TAG, SOUND SEEKBAR: Progress changed: progress =
[android-beginners] Re: CustomView - horizontal slider help needed
Apologies, I forgot the links in the above post: The full composited image: http://i916.photobucket.com/albums/ad9/XCaf/SeekbarOverTestBackground.png The four component images: http://i916.photobucket.com/albums/ad9/XCaf/CustomSeekbarParts.png -XCaf On Jan 27, 8:39 pm, XCaffeinated ssatn...@gmail.com wrote: Hi xxx Sliders in Android are called Seekbars. This may help you when you search online. Recently, I needed to do exactly what you are describing. You can see a test screenshot of this - a Seekbar with images to the left and right (and a text label above as well, which is also an image, and all are composited on top of a test menu background) here: The component images are (I’ve combined them into one photobucket image, but they are four separate images in my Android project, and some have been resized): You can see from this screenshot that the ‘left’, ‘right’ and ‘above’ images are actually all part of a single image. All images are pngs. You use an .xml file containing a layer-list to specify which pngs to use for your seekbar elements. In my screenshots you can see that I have a translucent Seekbar base, and then a solid overlay to indicate the actual progress (I’m not using a thumb or secondary progress here). This .xml file looks like: ?xml version=1.0 encoding=utf-8? layer-list xmlns:android=http://schemas.android.com/apk/res/ android item android:id=@android:id/background android:drawable=@drawable/sbrsoundbase_normal /item item android:id=@android:id/progress android:drawable=@drawable/sbrsoundoverlay_normal /item /layer-list where sbrsoundbase_normal is the png for the seekbar base, and sbrsoundoverlay_normal is the png for the progress overlay. These are the second and third images in the component screenshot above. Once you’ve decided what images you want, you will need a layout similar to: ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=fill_parent android:layout_height=fill_parent android:gravity=center android:background=@drawable/screenbackground LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:gravity=center_horizontal android:background=@drawable/sbrsoundbackground SeekBar android:id=@+id/sbrsound android:layout_width=wrap_content android:layout_height=wrap_content android:progressDrawable=@drawable/sbrsound android:secondaryProgress=0 android:thumb=@null android:max=10 android:minHeight=10dip android:minWidth=200dip android:layout_marginTop=15dip android:paddingTop=20dip android:paddingBottom=20dip /SeekBar /LinearLayout /LinearLayout The progressDrawable attribute is where you reference the .xml file described previously. I’ve included an overall parent background image (screenbackground), in a master LinearLayout, to show how you might reuse a single standard fullsize image for all your menu backgrounds. This corresponds to the ‘Backgound Image’ png in the screenshot. The attributes most likely to bite you are minHeight and minWidth. I had to make my minHeight *exactly* equal to my artwork height which is 15 pixels high (15 pixels == 10 dip on Droid) in order to avoid scaling artifacts; I’m sure there is a better way to do this, but I’ve not investigated fully. Similarly for minWidth – it is the exact width dimension of my artwork, 300 pixels (200 dip for the Droid). So this is not elegant, but hopefully will get you going in the right direction. The paddingXXX attributes make it much easier for people with large fingers to interact with the Seekbar (try removing them and you will see ), whereas layout_marginTop just adds a bit of space above the control. The max attribute again works in conjunction with the artwork so the Seekbar appears to increment in discrete chunks (one element at a time in whatever direction the user is sliding in). If you remove it, max will default to 100, and you will see the Seekbar slide almost continuously as the user slides his finger. The gravity attribute applies to all it’s children. So the first ‘gravity=”center”’ translates to “center the sound background image, and the sound Seekbar images”. The second ‘gravity=”center_horizontally”’ translates to “center the sound Seekbar images left to right” The .java portion of this is extremely straightforward: public class CustomSeekbar extends Activity { private static final String TAG = MYTAG; SeekBar sbrSound; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main
[android-beginners] Re: How to upload HelloAndroid.apk directly to HTC Hero
Hi Michael, Your suggestion is a great one for testing on friends' phones, without requiring them to, at the very least, install adb and the associated USB drivers. Also at your suggestion, I downloaded the Linda Manager file manager. It's really slick. Thanks for the tips. -XCaf On Jan 14, 1:51 pm, Michael boggess coda5...@gmail.com wrote: Save the .apk to your SD card or send it to your self in an email. To install you need to allow non-market apks to be installed, Settings - Applications - Unknown Sources (check). Use a file browsing utility (search the market for Linda Manager) to navigate to the place where you saved your .apk and install. Your HelloWorld application should appear in your application list with the others. On Jan 12, 11:43 am, kknight kknight2...@gmail.com wrote: Hi All, I am a beginner. I built and signed HelloAndroid.apk using Eclipse AD, and I want to test it on my HTC Hero phone. How can I upload the apk to my HTC phone and test it? Thanks. kknight- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Diagonal Screen transition.
Hi Satish, Animation between activities is indeed possible in Android 2.0 and later, using the overridePendingTransition() API, with the caveat as implied by Sean, that the user can override the animations if he so wishes, in his global device settings. This API was specifically added to give developers more control over inter-activity animations (versus view animations which are done intra-activity). I posted a tutorial on exactly how to use overridePendingTransition() at anddev.org: http://www.anddev.org/viewtopic.php?p=32766 Though the tutorial shows a fade transition between two activities, it can easily be changed to do a diagonal transition, as per your OP: In my case the user should get the feel that next screen is coming from one corner of the current screen. Here is how: In the tutorial, replace mainfadein.xml with diagslide_enter.xml: ?xml version=1.0 encoding=utf-8? translate xmlns:android=http://schemas.android.com/apk/res/ android android:fromXDelta=-100% android:toXDelta=0% android:fromYDelta=-100% android:toYDelta=0% android:duration=2000 / and replace splashfadeout.xml with diagslide_leave.xml: ?xml version=1.0 encoding=utf-8? translate xmlns:android=http://schemas.android.com/apk/res/ android android:fromXDelta=0% android:toXDelta=-100% android:fromYDelta=0% android:toYDelta=-100% android:duration=2000 / Add diagslide_enter.xml and diagslide_leave.xml to your /res/anim directory, and change the overridePendingTransition() statement to: overridePendingTransition(R.anim.diagslide_enter, R.anim.diagslide_leave); This will give the feel of the next screen coming from one corner, while the previous screen leaves from the other corner. Here's a YouTube video (forgive the quality, the emulator runs horribly slowly on my system, but it looks terrific on the Droid): http://www.youtube.com/watch?v=vqTbdAg_82c If you'd rather have the next screen come from one corner, while the previous screen stays put, do this: overridePendingTransition(R.anim.diagslide_enter, R.anim.hold); where hold.xml is a placeholder to keep the old activity from disappearing too soon: ?xml version=1.0 encoding=utf-8? translate xmlns:android=http://schemas.android.com/apk/res/ android android:fromXDelta=0 android:toXDelta=0 android:duration=2000 / If you'd rather have the next screen come from one corner over an empty background, do this: overridePendingTransition(R.anim.diagslide_enter, 0); Once you get it working you should probably consider shortening the durations, 2 seconds is kind of long. Great info on other animation attributes is here: http://developer.android.com/intl/zh-CN/guide/topics/resources/available-resources.html#animation There are examples in the SDK (search *.java in the 2.X platforms for overridePendingTransition). I will add some of this info to the anddev tutorial, and post a trackback. Hope this helps! XCaf On Jan 8, 7:55 am, satish bhoyar getsatonl...@gmail.com wrote: Hi, I am trying to do the diagonal screen transition, i am not able to figure out what I should use. In my case the user should get the feel that next screen is coming from one corner of the current screen . Thanks, -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Eclipse Debugger
Hi Lyndon, Regarding logcat output, make sure the 'Limit console output' checkbox is unchecked. This can be found at Windows-Preferences-Run/Debug- Console. XCaf On Jan 10, 1:03 pm, Lyndon lyn...@infomediauk.net wrote: Hi I am an experienced Java web developer and have been using Eclipse for about 5 years. I recently thought I'd give Android a go and so I set up Galileo with the Android ADK. I can get the example apps and widgets working no problem but... I cannot get the Eclipse debugger to work at all. I have followed the instructions and let the 'Debug as...' process start the AVD and I have set breakpoints but I can never get the process to stop on a breakpoint. It's very strange. Also, I have Logcat working but quite often that stops showing anything too. Is the ADK buggy? -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: How to use Dev tools which flashes momentary pink rectangle on any screen sections being redrawn?
Hi Mahesh, It is already installed as part of the DevTools package on the emulator (unless you've somehow managed to delete it). Start the emulator, open the slider drawer, and you'll find a DevTools icon there. Open DevTools, and the third item down from the top is the 'Show screen updates' checkbox. The moment you enable it, you should start seeing magenta-filled rectangles indicating screen redraws (aka dirty rectangles). Hope this helps! XCaf On Jan 12, 5:25 am, mahesh sharma smashmah...@gmail.com wrote: Hi All, How to use Dev tools which flashes momentary pink rectangle on any screen sections being redrawn? Tool description is given athttp://developer.android.com/guide/developing/debug-tasks.html Could anybody please suggest me where to install this tool and how to use it? Thanks, Mahesh -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: r cannot be resolved and other Eclipse/Android oddities
Hi oregonduckman, For the R cannot be resolved issue, make sure your R import is in the form: import your.package.name.R Sometimes a default of: import android.R will appear (I've not figured out the metric that causes this to occur). Remove the android.R import, and replace it with your.package.name.R. Hopefully this will help. As far as the build path errors issue, again I've not figured out exactly what triggers this, but if you touch any of your project files (i.e., make an inconsequential change and resave it, so Eclipse thinks it needs to be rebuilt, or use a Touch utility), and rebuild, this should hopefully help too. You may have to do it twice. I usually just pick one of the project's .java files and touch that. Hope this helps! XCaf On Dec 28, 3:41 pm, oregonduckman oregonduck...@gmail.com wrote: I frequently receive the error r cannot be resolved when adding functionality to an application and I have no idea why this happens. The change can be as simple as adding an ArrayList when the error appears in Eclipse. I have also seen the same kind of thing with the error message The project cannot be built until build path errors are resolved appearing after closing Eclipse then re-opening it with a given project. Are these just Eclipse/Android Plugin idiosyncrasies or I am doing something wrong? My development environment is Leopard+ Eclipse Platform 3.5.1.M20090917-0800+ Android Development Tools 0.9.5.v200911191123-20404 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: resource id references in XML files?
Hi Nurg, This is probably too late to help you, but maybe others would like to know. I've just posted a solution at anddev.org: http://www.anddev.org/xml_integer_array_resource_references_getintarray-t9268.html Best of luck! XCaf On Nov 13, 8:36 pm, Nurg stephen.lafl...@gmail.com wrote: Bump. On Nov 4, 7:12 pm, Nurg stephen.lafl...@gmail.com wrote: I'm attempting to set up arrays of resource ids in XML and choosing from them during runtime, but it appears the references are not resolving as I would expect. Here is an example of what I am doing in the arrays.xml file in my res/values directory: resources string-array name=pets itemcat/item itemdog/item /string-array integer-array name=cat item@drawable/cat/item item@raw/cat_meow1/item item@raw/cat_meow2/item /integer-array integer-array name=dog item@drawable/dog/item item@raw/dog_bark1/item item@raw/dog_bark2/item /integer-array /resources And in my code: private void setPet(String petType) { int arrayId = mResources.getIdentifier(petType, array, getPackageName()); int[] petResids = mResources.getIntArray(arrayId); BACKGROUND = petResids[0]; SOUND_PET1 = petResids[1]; SOUND_PET2 = petResids[2]; } What I am seeing: - The arrayId value is getting set to the correct resource id. - If I hardcode the resource ids (from R.java) in array.xml, everything works. - However, using the @ notation does not work -- the petResids array is filled with zeroes. I know that one can reference strings from the strings.xml file, colors from the colors.xml file, etc. Is it the case that the @ references are evaluated for only some XML files (like those in the layout or menu directories)? Or am I missing something more fundamental?- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en