[android-beginners] Re: Why won't Intent pass along the extras
Do think to pass a object reference from one screen to another, or from one activity to another? If implement this using Parcelable, it might be expensive. What I want is just pass the object reference. But I don't know how to do it. Do you have any idea? frizzo wrote: I have a class object that I want to pass from one screen to another. So I made it inherit from Parcelable and added the following code to my class: public class ItemDescription implements Parcelable { /// property setters and getters public int describeContents() { // TODO Auto-generated method stub return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mData); } public static final Parcelable.CreatorItemDescription CREATOR = new Parcelable.CreatorItemDescription() { public ItemDescription createFromParcel(Parcel in) { return new ItemDescription(in); } public ItemDescription[] newArray(int size) { return new ItemDescription[size]; } }; } In response to an event, I do kick off another screen (Intent) and put extras into it: Intent mIntent = new Intent(v.getContext(), Item.class); Parcelable itemDesc = getItemDescription(preset); // returns ItemDescription mIntent.putExtra(com.vbrad.android.mystapp.item1, itemDesc); startActivity(mIntent); In the onCreate event of this new activity, I attempt o retrieve the contents of the itemDesc object in the following manner: Intent intent = getIntent(); Parcelable p = intent.getParcelableExtra(com.vbrad.android. mystapp.item1); ItemDescription itemDesc = (ItemDescription) p; However, the itemDesc object is unpopulated - all the internal variables are at default values (e.g. 0 for numeric types, null for everything else). It's like it was just created. What am I missing here? Thanks. -- Zhiping Zeng --- Database Research Group Department of Computer Science and Technology Tsinghua University, Beijing, 100084, P.R.China --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Why won't Intent pass along the extras
I don't think that's possible (see my other post about this very topic). That's why I am asking why Parcel passing won't work. On Mar 10, 11:00 pm, Zhiping Zeng clipse.z...@gmail.com wrote: Do think to pass a object reference from one screen to another, or from one activity to another? If implement this using Parcelable, it might be expensive. What I want is just pass the object reference. But I don't know how to do it. Do you have any idea? frizzo wrote: I have a class object that I want to pass from one screen to another. So I made it inherit from Parcelable and added the following code to my class: public class ItemDescription implements Parcelable { /// property setters and getters public int describeContents() { // TODO Auto-generated method stub return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mData); } public static final Parcelable.CreatorItemDescription CREATOR = new Parcelable.CreatorItemDescription() { public ItemDescription createFromParcel(Parcel in) { return new ItemDescription(in); } public ItemDescription[] newArray(int size) { return new ItemDescription[size]; } }; } In response to an event, I do kick off another screen (Intent) and put extras into it: Intent mIntent = new Intent(v.getContext(), Item.class); Parcelable itemDesc = getItemDescription(preset); // returns ItemDescription mIntent.putExtra(com.vbrad.android.mystapp.item1, itemDesc); startActivity(mIntent); In the onCreate event of this new activity, I attempt o retrieve the contents of the itemDesc object in the following manner: Intent intent = getIntent(); Parcelable p = intent.getParcelableExtra(com.vbrad.android. mystapp.item1); ItemDescription itemDesc = (ItemDescription) p; However, the itemDesc object is unpopulated - all the internal variables are at default values (e.g. 0 for numeric types, null for everything else). It's like it was just created. What am I missing here? Thanks. -- Zhiping Zeng --- Database Research Group Department of Computer Science and Technology Tsinghua University, Beijing, 100084, P.R.China --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Different UI based on orientation
Let's say your layout is in a file called res/layout/myscreen.xml. Simply delete it and instead do the following: res/layout-port/myscreen.xml for portrait res/layout-land/myscreen.xml for landscape The system will automatically pick the right one. The same works for animations, drawables, etc. On Tue, Mar 10, 2009 at 12:04 PM, dutch pieter.kapsenb...@gmail.com wrote: Not sure if this is been answered (I searched). I am working on an app that should have a different look depending on the orientation (i.e. if the keyboard is opened). Specifically, certain buttons I put in the UI should disappear when the keyboard is opened, since the keyboard will be used for that. How can this be done in the code? Do I need 2 different XML files for the layout and somehow swap between the two? -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Arabic localization project
The ArabicReshaper code cannot be added to the system without hacking it and play with its files. shimonsh, x2android is asking about a way to get his app to work with messages longer than 70 characters. He is not asking about how did you fix the ArabicReshaper class. I will try your app and give you a feedback regards to you all On Mar 8, 7:31 am, TAKEphONE shimo...@gmail.com wrote: Hi, On Feb 22, 12:25 pm, G_man aman@gmail.com wrote: 3- You need an Arabic reshaper and it is already there:http://wm-arabic.cvs.sourceforge.net/viewvc/wm-arabic/JAVA_Android_Ve... 4- All you need is to find a way fix the ArabicReshaper.java file into the system The ArabicReshaper code seems to be a bit broken - it always adds one character to the string transferred to it. Can someone look at it and fix it ? TIA --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Top and bottom TextView layout?
Dears, I think the settings you made means the content of that textview is aligned at horizontal_center and top/bottom within that textview, not within the whole screen.If you want to make the text view aligned at top or bottom within the whole screen, you might try to use other kind of layout manager. B.R. Augustin. 2009/3/11 Rui Vieira ruidevie...@googlemail.com Hi everyone, Noob question: I was trying to create a layout with a text view aligned to the top and another aligned to the bottom. After reading the layout dev docs, I wrote the following: ?xml version=1.0 encoding=UTF-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:background=@drawable/bg TextView android:id=@+id/text1 android:layout_height=wrap_content android:layout_width=fill_parent android:textSize=30px android:textColor=#00 android:gravity=center_horizontal|top android:text=Top!/ TextView android:id=@+id/text2 android:layout_height=wrap_content android:layout_width=fill_parent android:textSize=30px android:textColor=#00 android:gravity=center_horizontal|bottom android:text=Bottom!/ /LinearLayout ... but it doesn't work... Can someone give me a tip? Thanks in advance. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Problem with textview in a Dialog
Nobody to help me ? On Mar 10, 11:30 am, Chavepeyer Geoffrey gchavepe...@gmail.com wrote: So, I've created a test case but still encounter the same problem: package be.geoc.DialogTest; import android.app.Activity; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class Dialog_Test extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button b = (Button) findViewById(R.id.Button01); b.setOnClickListener(new View.OnClickListener(){ public void onClick(View arg0) { Dialog d = new Dialog(Dialog_Test.this); d.setContentView(R.layout.meeting_detail); TextView tv = (TextView) findViewById(R.id.TextView01); System.out.println(tv); tv.setText(TEST); d.show(); } }); } } And the 2 xml layout files : main.xml : ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/hello android:id=@+id/TextView/ Button android:id=@+id/Button01 android:layout_width=wrap_content android:layout_height=wrap_content android:text=Ouvrir le dialog/ Button /LinearLayout and meeting_detail.xml : ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent TextView android:id=@+id/TextView01 android:layout_width=wrap_content android:layout_height=wrap_content/TextView /LinearLayout Is anyone able to help me ? Thanks a lot !!! Geoffrey --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] restricting access to database
hello, i am trying to put password on database, so, that no other application can access my database, has any one else tried some thing similar, then kindly help me. thanks Er.Syed Imran Ali --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] unsubscribe me
how should i unsubscribe from the list? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Checking Internet Connection
ConnectivityManager is what I was looking for :-) Yes Jon, I keep in mind the constraints, but the app that I am developing it's something similar to a navigator (for car drivers) with extra functionalities. So, the device could be powered and I don't consider restrictions of power ;-) Thank you! On Mar 10, 8:45 pm, Jon Phenow j.phe...@gmail.com wrote: You might also try and be careful. It seems that many applications on many hand-held devices, if they are attempting to have a persistent connection with anything such as GPS or internet will drain a battery fast. I realize these devices are getting better at handling such demanding applications but just something to keep in mind. Possibly look for a way to have retrieve information from the internet/GPS when you know it is needed. On Tue, Mar 10, 2009 at 1:55 PM, Jean-Baptiste Queru j...@android.comwrote: http://developer.android.com/reference/android/net/ConnectivityManage... might be what you're looking for. JBQ On Tue, Mar 10, 2009 at 4:03 AM, Android Beginners albert.hernan...@gmail.com wrote: Hi, How can I check the Internet Connection? I need also the same with the GPS signal... I am developing an app that needs to be persistently connected to the Internet and I need something like a Listener. Should I create my own Listener or there is something implemented? Thank you in advance. -- Jean-Baptiste M. JBQ Queru Android Engineer, Google. Questions sent directly to me that have no reason for being private will likely get ignored or forwarded to a public forum with no further warning. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Top and bottom TextView layout?
Hi, Thanks for the reply. For what I want, it doesn't matter if the whole screen is occupied by the two views (it's just the text I need at top and bottom). I've managed to do that with the same layout, just giving more weight to the top view: ?xml version=1.0 encoding=UTF-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:background=@drawable/bg TextView android:id=@+id/text1 android:layout_height=wrap_content android:layout_width=fill_parent android:textSize=30px android:textColor=#00 android:gravity=center_horizontal android:layout_weight=1 android:text=Top!/ TextView android:id=@+id/text2 android:layout_height=wrap_content android:layout_width=fill_parent android:textSize=30px android:textColor=#00 android:gravity=center_horizontal android:text=Bottom!/ /LinearLayout Again, thanks for your help. On Mar 11, 7:47 am, Lu Augustin iamaugus...@gmail.com wrote: Dears, I think the settings you made means the content of that textview is aligned at horizontal_center and top/bottom within that textview, not within the whole screen.If you want to make the text view aligned at top or bottom within the whole screen, you might try to use other kind of layout manager. B.R. Augustin. 2009/3/11 Rui Vieira ruidevie...@googlemail.com Hi everyone, Noob question: I was trying to create a layout with a text view aligned to the top and another aligned to the bottom. After reading the layout dev docs, I wrote the following: ?xml version=1.0 encoding=UTF-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent android:background=@drawable/bg TextView android:id=@+id/text1 android:layout_height=wrap_content android:layout_width=fill_parent android:textSize=30px android:textColor=#00 android:gravity=center_horizontal|top android:text=Top!/ TextView android:id=@+id/text2 android:layout_height=wrap_content android:layout_width=fill_parent android:textSize=30px android:textColor=#00 android:gravity=center_horizontal|bottom android:text=Bottom!/ /LinearLayout ... but it doesn't work... Can someone give me a tip? Thanks in advance. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: unsubscribe me
To unsubscribe from this group, send email to: android-beginners+unsubscr...@googlegroups.com On Mar 11, 11:06 am, Kusuma Pabba kusu...@ncoretech.com wrote: how should i unsubscribe from the list? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: EditText appearance
You could create a colorstate list (xml file in res/drawable), for example http://developer.android.com/reference/android/content/res/ColorStateList.html Here is an example i used for textcolors. Should work for HintColors too! res/drawabale/myedittextcolors.xml: ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_focused=true android:state_pressed=false android:color=@android:color/secondary_text_dark / item android:state_focused=true android:state_pressed=true android:color=@android:color/secondary_text_dark / item android:state_focused=false android:state_pressed=true android:color=@android:color/secondary_text_dark / item android:color=@android:color/secondary_text_dark / /selector Now you only have to assign it to your EditText widget. Edit the XML and change android:textColorHint=#FF to android:textColorHint=@drawable/myedittextcolors and it should work. This is usefull if you want to have different colors depending on the state of the edittext (i.e. if its focused, clicked, etc). For one color, use android:textColorHint=#FF or android:textColorHint=@color/ mycustomcolor if you have defined your color in /res/values/ colors.xml On Mar 10, 11:30 am, Mr.No f.hi...@arcor.de wrote: Hello, how do i change the size, style, typeface of a hint? If the EditText gains the focus the border-color changes to orange, how do i set a other color? rgds Mr.No --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Intercepting web browser clicks
Kevin wrote: I have an interesting problem: I'd like to create a background service that can somehow detect/intercept/keep track of user clicks on the phone's internet browser. I was wondering if this is even possible. I know you can overwrite your own WebView to get this information, but given that the phone's browser and my service are completely different applications, I doubt that the service can get any information about the browser's clicks. Correct -- for security reasons, what you are asking to do should not be possible. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training in Sweden -- http://www.sotrium.com/training.php --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] AndroidManifest.xml file missing!
HI: I built ADT and integrated it to eclipse, and build android source code in eclipse. It reports as following: Description ResourcePathLocationType AndroidManifest.xml file missing! android Unknown Android ADT Problem Can u help me to resolve it? THX --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Android design question
The reason is that the activities in question might live in different processes, and therefore the parameters that are passed to startActivity might have to be marshalled across virtual machines, across processes (and across UIDs). JBQ On Tue, Mar 10, 2009 at 10:52 PM, frizzo rg...@vbrad.com wrote: The system in place to pass information between the screens... I am confused why the team chose to reinvent the wheel via the putExtras methods. Instead of making the transport objects inherit from Parcelable and the like, why not just use Java's OO strength and set objects to Activities themselves. For instance, like this: class Caller extends Activity { public on buttonClick() { ThisScreen ts = new ThisScreen(); ts.SetCustomValue(10); startActivity(ts) } } class ThisScreen extends Activity { public void onCreate() { txtBox.setText(Integer.toString(i)); } public void SetCustomValue (int i) { ... } } Instead we are having to unnecessarily learn new concepts. Was there a compelling reason to implement it they it's implemented that I am not seeing? Thanks. -- Jean-Baptiste M. JBQ Queru Android Engineer, Google. Questions sent directly to me that have no reason for being private will likely get ignored or forwarded to a public forum with no further warning. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Intents and Activities
Yea, Intents are kind of events. You can use them to call or communicate with other Activities or Applications. And you can add extra data (Intent.putExtra(...)) to send data to other activities On Mar 10, 9:06 pm, Lovedumplingx lovedumpli...@gmail.com wrote: Don't know if this went through last time so I'll post again So I'm still working to get the paradigm down. Activities are related to screens and everything you want a user to see needs to be part of an activity. But what's with the Intent? Are all intents tied to an activity? I thought I had read that Intents were more like events. If that's the case cool...but I'm really struggling on where Intents fit into the whole concept. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Why won't Intent pass along the extras
I have done this succesfully with a Serializable object added with Intent#putExtra(String, Serializable). Is there some reason why Parcelable is a better choice in your case? ++Steve On Mar 11, 1:45 am, frizzo rg...@vbrad.com wrote: I have a class object that I want to pass from one screen to another. So I made it inherit from Parcelable and added the following code to my class: public class ItemDescription implements Parcelable { /// property setters and getters public int describeContents() { // TODO Auto-generated method stub return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mData); } public static final Parcelable.CreatorItemDescription CREATOR = new Parcelable.CreatorItemDescription() { public ItemDescription createFromParcel(Parcel in) { return new ItemDescription(in); } public ItemDescription[] newArray(int size) { return new ItemDescription[size]; } }; } In response to an event, I do kick off another screen (Intent) and put extras into it: Intent mIntent = new Intent(v.getContext(), Item.class); Parcelable itemDesc = getItemDescription(preset); // returns ItemDescription mIntent.putExtra(com.vbrad.android.mystapp.item1, itemDesc); startActivity(mIntent); In the onCreate event of this new activity, I attempt o retrieve the contents of the itemDesc object in the following manner: Intent intent = getIntent(); Parcelable p = intent.getParcelableExtra(com.vbrad.android. mystapp.item1); ItemDescription itemDesc = (ItemDescription) p; However, the itemDesc object is unpopulated - all the internal variables are at default values (e.g. 0 for numeric types, null for everything else). It's like it was just created. What am I missing here? Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Real Audio
According to the Specs it should support Real Audio formats?!?! I'm confused as to why it would not and why there isn't a player for it yet!! Help! On Mar 2, 3:54 pm, Dave Sparks davidspa...@android.com wrote: No, Android does not have support for RA formats. On Mar 2, 10:04 am, AA ayma...@gmail.com wrote: Is there a way to play real audio files on my G1? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Real Audio
AA wrote: According to the Specs it should support Real Audio formats?!?! Which specs are these? The Android specs with respect to media formats can be found here: http://developer.android.com/guide/appendix/media-formats.html -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to *Advanced* Android Development_ Version 0.7! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
I changed this to loading the database in from an asset and it works fine. But the issue is now the loading time. On the emulator it takes over 5 seconds for the list to be populated. And when doing a a filter (getListView().setTextFilterEnabled(true);) it takes almost 10 seconds to filter the list. Is it unreasonable to think that about 9000 entries should be sorted faster? Mark, Does your book talk about handling this type of stuff? I see that version 2.0 is not in print so I plan to pick it up. David On Mar 10, 8:19 am, Mark Murphy mmur...@commonsware.com wrote: NFSpeedypur wrote: I am trying to on first start up fill up a sql database with the default values. This database is around 9000 entries and it is causing the app to go over the 16MB heap. I am trying to find a way to do this so that it will not cause this over flow. At the moment I am running the 9000 inserts, 1 after another in a thread. Are there any other suggestions? Use transactions. The heap problem is probably due to SQLite holding everything in transaction buffers. You might, say, do a transaction for every 100 entries or so. -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
NFSpeedypur wrote: On the emulator it takes over 5 seconds for the list to be populated. That feels wrong, but I haven't tried a 9,000-row table. And when doing a a filter (getListView().setTextFilterEnabled(true);) it takes almost 10 seconds to filter the list. Is it unreasonable to think that about 9000 entries should be sorted faster? Did you add an index on the to-be-filtered columns? Does your book talk about handling this type of stuff? There's some coverage of this in the _Advanced Android_ book (not yet in print, beta available to subscribers), with more to come as that book gets expanded over the course of the next 12-18 months. I see that version 2.0 is not in print so I plan to pick it up. Version 2.0 is available in print. If you're looking at the Amazon page, they *still* have not updated the cover (gr) -- I'll be trying to do that again later this week. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
NFSpeedypur wrote: No I did not add any index to the to be filtered columns, I am using a basic array so I did not know there could be a index? setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1, Titles)); If the data is in a database, use a CursorAdapter or SimpleCursorAdapter, rather than loading them all into an ArrayAdapter. That should be significantly faster. Maybe it will be worth grabbing the subscription on Commonwares instead of the book. If I download the pdfs, am I able to print pages for personal use or is it only for computer viewing? Printing is perfectly fine for personal use. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] db4o Object Database Android Demos Updated
Hi. For those of you who never heard about db4o - it's an Android complaint open source object database with a thriving user community (http://developer.db4o.com). It allows you to store/retrieve POJOs directly (no tables, no rows, no cursors) without sacrificing speed, flexibility and reliability. I'm sending this message to the list because I wanted to let you know that we've updated the PasswordSafe and MapMe Android demos to work with both the latest stable version of db4o (v7.4) and Android SDK (v1.1 r1). By checking out these examples (tutorial and videos included) you'll realize how easy and straight forward it's to persist POJOs rather than relying solely on SQLite. For more information see: http://developer.db4o.com/blogs/community/archive/2009/03/11/db4o-android-demos-updated.aspx Enjoy!! German Viscuso db4objects --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
I believe I understand more of what you are saying about adding the index. Do you mean to the actual column in the database? Does filtering the text requery the database each time? David On Mar 11, 12:08 pm, NFSpeedypur nfspeedy...@gmail.com wrote: No I did not add any index to the to be filtered columns, I am using a basic array so I did not know there could be a index? setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1, Titles)); Maybe it will be worth grabbing the subscription on Commonwares instead of the book. If I download the pdfs, am I able to print pages for personal use or is it only for computer viewing? David On Mar 11, 11:37 am, Mark Murphy mmur...@commonsware.com wrote: NFSpeedypur wrote: On the emulator it takes over 5 seconds for the list to be populated. That feels wrong, but I haven't tried a 9,000-row table. And when doing a a filter (getListView().setTextFilterEnabled(true);) it takes almost 10 seconds to filter the list. Is it unreasonable to think that about 9000 entries should be sorted faster? Did you add an index on the to-be-filtered columns? Does your book talk about handling this type of stuff? There's some coverage of this in the _Advanced Android_ book (not yet in print, beta available to subscribers), with more to come as that book gets expanded over the course of the next 12-18 months. I see that version 2.0 is not in print so I plan to pick it up. Version 2.0 is available in print. If you're looking at the Amazon page, they *still* have not updated the cover (gr) -- I'll be trying to do that again later this week. -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
I see yes I had tried the cursor in the past and it does work faster, but I could not get the Filter to work. Do I need to write my own search portion if I use the cursor method? Thank you for your help. You personally have been a lifesaver to me, in the android field. David On Mar 11, 12:11 pm, NFSpeedypur nfspeedy...@gmail.com wrote: I believe I understand more of what you are saying about adding the index. Do you mean to the actual column in the database? Does filtering the text requery the database each time? David On Mar 11, 12:08 pm, NFSpeedypur nfspeedy...@gmail.com wrote: No I did not add any index to the to be filtered columns, I am using a basic array so I did not know there could be a index? setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1, Titles)); Maybe it will be worth grabbing the subscription on Commonwares instead of the book. If I download the pdfs, am I able to print pages for personal use or is it only for computer viewing? David On Mar 11, 11:37 am, Mark Murphy mmur...@commonsware.com wrote: NFSpeedypur wrote: On the emulator it takes over 5 seconds for the list to be populated. That feels wrong, but I haven't tried a 9,000-row table. And when doing a a filter (getListView().setTextFilterEnabled(true);) it takes almost 10 seconds to filter the list. Is it unreasonable to think that about 9000 entries should be sorted faster? Did you add an index on the to-be-filtered columns? Does your book talk about handling this type of stuff? There's some coverage of this in the _Advanced Android_ book (not yet in print, beta available to subscribers), with more to come as that book gets expanded over the course of the next 12-18 months. I see that version 2.0 is not in print so I plan to pick it up. Version 2.0 is available in print. If you're looking at the Amazon page, they *still* have not updated the cover (gr) -- I'll be trying to do that again later this week. -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
NFSpeedypur wrote: I believe I understand more of what you are saying about adding the index. Do you mean to the actual column in the database? Does filtering the text requery the database each time? That I don't know -- I haven't tried filtering. My guess is yes, but queries, particularly on indexed columns, should be pretty snappy. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
NFSpeedypur wrote: I see yes I had tried the cursor in the past and it does work faster, but I could not get the Filter to work. Do I need to write my own search portion if I use the cursor method? Unfortunately, I don't know -- I haven't tried filters with cursors as yet. There's just *so* many nooks and crannies to play around in! I'll add that to my to-do list for a future edition of _Advanced Android_. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Question regarding linearlayout
hi,all: I have a question regarding linearlayout(maybe other layout types) __ | textf |button | |___|__| I want to implement above layout, firstly to place a textfield on the screen, and place a button on its right, the button's size is fixed, and I want to textfield to fill the rest space of the row. I want to use LinearLayout, but can not implement such UI. Anyboday have suggestion? Thank you! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Background Color
I'm a complete newb here (got a Hello World app working, but otherwise my mind is a blank slate as far as Java goes), but how do you set the background color for an application that will utilize nothing but text and simple shapes? The javax.swing.* package doesn't seem to be available, and I'm not sure you can even treat an Android Activity as a JFrame anyways. Softball question for you guys. Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] GPS String hidden application
Hello All, i want to write a GPS application which will be started when i enter string like (*#1234#) on the dialer screen and then the Application will start so that only developer can access that application. i want to write this application to just test all the functionalities of the GPS. can anyone help me out on this? its really urgent. thanks and regards, Ashish dhiman --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Delaying
I'm working on a part of my application to change a textview text. But I do not know how to make it delay like I want it to. I tried using a schedule(runnable, delay, unit) but it never worked unless the delay was 0. How would I make it delay for like 3 seconds? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] GPS String hidden application
Hello All, i want to write a GPS application which will be started when i enter string like (*#1234#) on the dialer screen and then the Application will start so that only developer can access that application. i want to write this application to just test all the functionalities of the GPS. can anyone help me out on this? its really urgent. thanks and regards #Ashish Dhiman# --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Can someone make me an app?
I would like someone to make an app for me. I am willing to pay for it and hope to list it on the android market. The app would be a niche app, only downloaded by certain people. If you are interesting in making the app for me please email me. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] GPS String hidden application
Hello All, i want to write a GPS application which will be started when i enter string like (*#1234#) on the dialer screen and then the Application will start so that only developer can access that application. i want to write this application to just test all the functionalities of the GPS. can anyone help me out on this? its really urgent. thanks and regards, Ashish dhiman --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Tab widget and activity
I am trying to have both a tab widget and another activity running at the same time. I am trying to start the second activity from the same oncreate method as the tab widget; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTabHost = getTabHost(); mTabHost.addTab(mTabHost.newTabSpec(one).setIndicator (one).setContent(R.id.textview1)); mTabHost.addTab(mTabHost.newTabSpec(two).setIndicator (two).setContent(R.id.textview2)); mTabHost.addTab(mTabHost.newTabSpec(three).setIndicator (three).setContent(R.id.textview3)); mTabHost.setCurrentTab(0); Intent i = new Intent(Test.this, TestThing.class); } This only stops the tab widget from being shown(if i understand correctly it would need a pause/ interrupt to show the tab activity), I would however like it to work with these 2 running together. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] I want to install Android in Nokia Phone
I've a Nokia 6681. And i want to install android in that phone, so can you please mention how to install it and where to download it from. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Filling a large database causes crash
Alright well I will work on that and maybe send you an email if I can find additional information about it. I just purchased a commonswares subscription and I look forward to reading your books. David On Mar 11, 12:24 pm, Mark Murphy mmur...@commonsware.com wrote: NFSpeedypur wrote: I see yes I had tried the cursor in the past and it does work faster, but I could not get the Filter to work. Do I need to write my own search portion if I use the cursor method? Unfortunately, I don't know -- I haven't tried filters with cursors as yet. There's just *so* many nooks and crannies to play around in! I'll add that to my to-do list for a future edition of _Advanced Android_. -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Background Color
AJ wrote: I'm a complete newb here (got a Hello World app working, but otherwise my mind is a blank slate as far as Java goes), but how do you set the background color for an application that will utilize nothing but text and simple shapes? Put an android:background attribute on the appropriate elements of your layout XML. It can either be a simple color or a reference to a Drawable resource (e.g., PNG, gradient). -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: GPS String hidden application
Ashish Dhiman wrote: i want to write a GPS application which will be started when i enter string like (*#1234#) on the dialer screen and then the Application will start so that only developer can access that application. You have no means of intercepting events from the Dialer application. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Question regarding linearlayout
Give your button a width of wrap_content, your text field a width of 0dip and a weight of 1. On Tue, Mar 10, 2009 at 10:26 PM, striverwang striverw...@gmail.com wrote: hi,all: I have a question regarding linearlayout(maybe other layout types) __ | textf |button | |___|__| I want to implement above layout, firstly to place a textfield on the screen, and place a button on its right, the button's size is fixed, and I want to textfield to fill the rest space of the row. I want to use LinearLayout, but can not implement such UI. Anyboday have suggestion? Thank you! -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android 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 -~--~~~~--~~--~--~---
[android-beginners] Re: I want to install Android in Nokia Phone
http://source.android.com/download goodluck! On Mar 11, 2:45 am, Arasan araa...@gmail.com wrote: I've a Nokia 6681. And i want to install android in that phone, so can you please mention how to install it and where to download it from. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Background Color
an example of what Mark had in mind, I think: EditText android:id=@+id/entry android:layout_width=fill_parent android:layout_height=wrap_content android:background=@android:drawable/editbox_background android:layout_below=@id/label/ also you could use Java code, such as in this example for a subclass of Dialog, such as an AlertDialog instance: getWindow().setBackgroundDrawable( new ColorDrawable (Color.DKGRAY) ); Note that the last technique is not guaranteed to be supported over the long term. Romain Guy from Google had a nice post recently on performance issues for backgrounds: http://android-developers.blogspot.com/2009/03/window-backgrounds-ui-speed.html serge On Mar 11, 1:26 pm, Mark Murphy mmur...@commonsware.com wrote: AJ wrote: I'm a complete newb here (got a Hello World app working, but otherwise my mind is a blank slate as far as Java goes), but how do you set the background color for an application that will utilize nothing but text and simple shapes? Put an android:background attribute on the appropriate elements of your layout XML. It can either be a simple color or a reference to a Drawable resource (e.g., PNG, gradient). -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] How-To: Display Emulator in Landscape (Sideways) View?
I was over at db4o and they had a demo with the emulator displayed in landscape (sideways) mode. How do you do that? I'm developing and app that needs the keyboard exposed. Thanks! JLMG --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: How-To: Display Emulator in Landscape (Sideways) View?
JLMG wrote: I was over at db4o and they had a demo with the emulator displayed in landscape (sideways) mode. How do you do that? Ctrl-F12 toggles you between portrait and landscape modes in the emulator. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training in Sweden -- http://www.sotrium.com/training.php --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Eclipse Landscape Emulator
Is there a way to launch my app from eclipse in landscape mode on the emulator? Or am I doomed to having it launch in portrait, so eclipse will build and deploy my app, then launching a landscape emulator from the command line? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Eclipse Landscape Emulator
droozen wrote: Is there a way to launch my app from eclipse in landscape mode on the emulator? Or am I doomed to having it launch in portrait, so eclipse will build and deploy my app, then launching a landscape emulator from the command line? Can't you just use Ctrl-F12 to toggle between portrait and landscape? -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Background Color
sm1, I'm confused by the example code you provided (the EditText block). Which parts of the text are to be interpreted literally, and which are just placeholders for values? I only ask because I don't see any specific color defined. On Mar 11, 5:18 pm, sm1 sergemas...@gmail.com wrote: an example of what Mark had in mind, I think: EditText android:id=@+id/entry android:layout_width=fill_parent android:layout_height=wrap_content android:background=@android:drawable/editbox_background android:layout_below=@id/label/ also you could use Java code, such as in this example for a subclass of Dialog, such as an AlertDialog instance: getWindow().setBackgroundDrawable( new ColorDrawable (Color.DKGRAY) ); Note that the last technique is not guaranteed to be supported over the long term. Romain Guy from Google had a nice post recently on performance issues for backgrounds:http://android-developers.blogspot.com/2009/03/window-backgrounds-ui-... serge On Mar 11, 1:26 pm, Mark Murphy mmur...@commonsware.com wrote: AJ wrote: I'm a complete newb here (got a Hello World app working, but otherwise my mind is a blank slate as far as Java goes), but how do you set the background color for an application that will utilize nothing but text and simple shapes? Put an android:background attribute on the appropriate elements of your layout XML. It can either be a simple color or a reference to a Drawable resource (e.g., PNG, gradient). -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Background Color
AJ wrote: sm1, I'm confused by the example code you provided (the EditText block). Which parts of the text are to be interpreted literally, and which are just placeholders for values? I only ask because I don't see any specific color defined. In his example, he uses: android:background=@android:drawable/editbox_background This refers not to a color per se, but to a Drawable, one that happens to be provided by the system (hence the @android prefix). If, say, you wanted the background to be red, you could use: android:background=# where # is red with no transparency (100% alpha channel) in AARRGGBB format. http://developer.android.com/guide/topics/resources/available-resources.html#colorvals -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Eclipse Landscape Emulator
Hi droozen, In Eclipse do the following. Select your project Go to Run Run Configuration Then select the Target tab. under Emulator Launch Parameters select the Screen Size and set the drop down to HVGA-P. I just tested this and it worked for me, my app started in Landscape mode. Good luck. Kevin On Mar 11, 6:27 pm, droozen droozenr...@gmail.com wrote: Is there a way to launch my app from eclipse in landscape mode on the emulator? Or am I doomed to having it launch in portrait, so eclipse will build and deploy my app, then launching a landscape emulator from the command line? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Basic file input / output tutorial
I'm new to Java/Android, can anyone recommend a tutorial on android that introduces reading and writing flat files? sj ps, if this is a double post, sorry, but I posted several hours ago and it seems it never went through. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] What's the bar at the top of the screen called?
Note: Don't mean to double post, but I didn't see my initial post appear. Reposting. Hi, I've been tasked with designing the UI for our Android app and I'm trying to gather as much information as I can to be well informed. Quick question... What's the bar at the top of the screen called? I'm trying to refer to it in some documentation and would like the official title for it. Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Synchronizing activity with service state
I've got an activity that lets a user start and stop a service, which then hangs around putting up notifications periodically. I have a toggle button for turning the service on and off, and I need it to have the correct state whenever the user runs the activity, depending on whether the service is already running or not. Since there doesn't appear to be a way to directly query whether or not the service is running, my solution was to have the service class set a boolean preference to true in its onCreate() method, and set it to false in its onDestroy(). The launcher activity in turn checks the preference set by the service in its onCreate() and sets the toggle's state accordingly. service class: private void savePreference(boolean state) { SharedPreferences settings = getSharedPreferences(PING_PREFS,0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean(KEY_RUNNING, state); editor.commit(); } onCreate() { ... savePreference(true); } onDestroy() { ... savePreference(false); } and the toggle button does: private OnClickListener mTogListener = new OnClickListener() { public void onClick(View v) { // Perform action on clicks if (tog.isChecked()) { Toast.makeText(TimepieController.this, ON, Toast.LENGTH_SHORT).show(); startService(new Intent(TimepieController.this, PingService.class)); mStarted = true; } else { Toast.makeText(TimepieController.this, OFF, Toast.LENGTH_SHORT).show(); stopService(new Intent(TimepieController.this, PingService.class)); mStarted = false; } } }; So it seems to me like this ought to work, however, after I stop the service if I leave the launcher activity with the Back button and then return, the toggle button is set back to on again. If I leave the launcher activity with the Home button when I return the toggle button remains off. Is there some better/more correct way to synchronize the state of the toggle button with the service? If not, any ideas on what is going wrong? Why would the way I leave the app effect the state of the preference? Does stopping the service not necessarily call the service's onDestroy()? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Android Tutorial on reading / writing simple files?
Does anyone know of a tutorial that explains how to do basic file reading / writing in Android? Its hard getting back to OO programming from matlab/perl! All I want to do, in two parts: 1. Read a file from the SD card, and store the values into variables. 2. Read a file from a website, and store the values into variables. Thanks for ANY help! :) sj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] What's the bar at the top of the screen called?
Hi, I've been tasked with designing the UI for our Android app and I'm trying to gather as much information as I can to be well informed. Quick question... What's the bar at the top of the screen called? I'm trying to refer to it in some documentation and would like the official title for it. Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Background Color
Hmmm, OK, well I'm trying to keep this as simple as possible (just a pure red background with no foreground elements), but I've run into another error. Here's my main_layout.xml file: /** main_layout.xml **/ ?xml version=1.0 encoding=utf-8? MainLayout xmlns:android=http://schemas.android.com/apk/res/ android EditText android:background=# / /MainLayout /** main_layout.xml **/ And the application code: /** home **/ package info.tanguay.android.hello; import android.app.Activity; import android.os.Bundle; public class home extends Activity { public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main_layout); } } /** home **/ Running the app in the emulator, though, results in an error message from the emulator itself: The application Home (process info.tanguay.android.hello) has stopped unexpectedly. Please try again. Any ideas? I really appreciate your guys' help. On Mar 11, 7:46 pm, Mark Murphy mmur...@commonsware.com wrote: AJ wrote: sm1, I'm confused by the example code you provided (the EditText block). Which parts of the text are to be interpreted literally, and which are just placeholders for values? I only ask because I don't see any specific color defined. In his example, he uses: android:background=@android:drawable/editbox_background This refers not to a color per se, but to a Drawable, one that happens to be provided by the system (hence the @android prefix). If, say, you wanted the background to be red, you could use: android:background=# where # is red with no transparency (100% alpha channel) in AARRGGBB format. http://developer.android.com/guide/topics/resources/available-resourc... -- Mark Murphy (a Commons Guy)http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: What's the bar at the top of the screen called?
Notification On Wed, Mar 11, 2009 at 7:47 PM, 5harp ugn...@gmail.com wrote: Note: Don't mean to double post, but I didn't see my initial post appear. Reposting. Hi, I've been tasked with designing the UI for our Android app and I'm trying to gather as much information as I can to be well informed. Quick question... What's the bar at the top of the screen called? I'm trying to refer to it in some documentation and would like the official title for it. Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: What's the bar at the top of the screen called?
sry status bar On Wed, Mar 11, 2009 at 9:29 PM, Kather Jailani jail...@gmail.com wrote: Notification On Wed, Mar 11, 2009 at 7:47 PM, 5harp ugn...@gmail.com wrote: Note: Don't mean to double post, but I didn't see my initial post appear. Reposting. Hi, I've been tasked with designing the UI for our Android app and I'm trying to gather as much information as I can to be well informed. Quick question... What's the bar at the top of the screen called? I'm trying to refer to it in some documentation and would like the official title for it. Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] textview '\n' not causing carraige return
I am very confused. I have brought in data from a database in a string format. This data is something like Hello\nThis is a Test But it is not the '\n' as a carriage return and I am not sure why. If I add another part to the string with like ... string + \nHello it works fine with the \n. So I am assuming that somehow it is bringing in the \n as 2 characters from the database instead of 1. I have tried to modify the database to be both varChars and texts for the column and they both are the same result. Is there something straight forward I am missing? David --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: What's the bar at the top of the screen called?
Ok, thanks. BTW, I guess I should've just asked where I could find things like this for future reference... Is there a G1 UI glossary or something similar that lays out all the default elements? On Mar 11, 7:36 pm, Kather Jailani jail...@gmail.com wrote: sry status bar On Wed, Mar 11, 2009 at 9:29 PM, Kather Jailani jail...@gmail.com wrote: Notification On Wed, Mar 11, 2009 at 7:47 PM, 5harp ugn...@gmail.com wrote: Note: Don't mean to double post, but I didn't see my initial post appear. Reposting. Hi, I've been tasked with designing the UI for our Android app and I'm trying to gather as much information as I can to be well informed. Quick question... What's the bar at the top of the screen called? I'm trying to refer to it in some documentation and would like the official title for it. Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: What's the bar at the top of the screen called?
http://www.scribd.com/doc/6262341/g1-Full-Manual On Wed, Mar 11, 2009 at 11:05 PM, 5harp ugn...@gmail.com wrote: Ok, thanks. BTW, I guess I should've just asked where I could find things like this for future reference... Is there a G1 UI glossary or something similar that lays out all the default elements? On Mar 11, 7:36 pm, Kather Jailani jail...@gmail.com wrote: sry status bar On Wed, Mar 11, 2009 at 9:29 PM, Kather Jailani jail...@gmail.com wrote: Notification On Wed, Mar 11, 2009 at 7:47 PM, 5harp ugn...@gmail.com wrote: Note: Don't mean to double post, but I didn't see my initial post appear. Reposting. Hi, I've been tasked with designing the UI for our Android app and I'm trying to gather as much information as I can to be well informed. Quick question... What's the bar at the top of the screen called? I'm trying to refer to it in some documentation and would like the official title for it. Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Why won't Intent pass along the extras
I have no idea whether it's a better choice or not. I asked the question here as to how to do it and was given Parcelable as the answer. I'll give it a try with serializable. On Mar 11, 6:36 am, Steven Farley srfar...@gmail.com wrote: I have done this succesfully with a Serializable object added with Intent#putExtra(String, Serializable). Is there some reason why Parcelable is a better choice in your case? ++Steve On Mar 11, 1:45 am, frizzo rg...@vbrad.com wrote: I have a class object that I want to pass from one screen to another. So I made it inherit from Parcelable and added the following code to my class: public class ItemDescription implements Parcelable { /// property setters and getters public int describeContents() { // TODO Auto-generated method stub return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mData); } public static final Parcelable.CreatorItemDescription CREATOR = new Parcelable.CreatorItemDescription() { public ItemDescription createFromParcel(Parcel in) { return new ItemDescription(in); } public ItemDescription[] newArray(int size) { return new ItemDescription[size]; } }; } In response to an event, I do kick off another screen (Intent) and put extras into it: Intent mIntent = new Intent(v.getContext(), Item.class); Parcelable itemDesc = getItemDescription(preset); // returns ItemDescription mIntent.putExtra(com.vbrad.android.mystapp.item1, itemDesc); startActivity(mIntent); In the onCreate event of this new activity, I attempt o retrieve the contents of the itemDesc object in the following manner: Intent intent = getIntent(); Parcelable p = intent.getParcelableExtra(com.vbrad.android. mystapp.item1); ItemDescription itemDesc = (ItemDescription) p; However, the itemDesc object is unpopulated - all the internal variables are at default values (e.g. 0 for numeric types, null for everything else). It's like it was just created. What am I missing here? Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---