[android-developers] How to Create Custom Firmware for Android Device?
Hi, I know this is a bit open ended but I am having a hard time finding something detailed and would appreciate any 'go here' that anyone could provide. I have seen various instances on messages and posts advising people that they cannot do a certain action and would need to create their own version of the firmware to accomplish what they're asking. Is there any detailed steps on how to do this? I have gotten bits and pieces but not anything in any one place and definitely some contradictory information. Thanks in advance for any help erik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] How to Create Custom Firmware for Android Device?
Excellent, thanks. On Sunday, August 26, 2012 6:06:11 PM UTC-5, TreKing wrote: On Sun, Aug 26, 2012 at 5:52 PM, erik wagner erik.j...@gmail.comjavascript: wrote: I am having a hard time finding something detailed and would appreciate any 'go here' that anyone could provide. First step is to go to a group more dedicated to this topic: http://source.android.com/community/index.html - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Changing the icon for the All Apps Button
Hi, I am looking to actually replace the 'All Apps' button on the Android home screen. I know there is the Home sample app, as near as I can tell (and please correct me if I'm wrong) it overlays a separate home button on top of the existing one - instead of actually replacing it. Is there a way to actually replace the All Apps icon on the Android home screen? Sorry if this is a duplicate question, searching for 'all apps button' returns a dizzying array of non-pertinent results. Thanks, Erik Wagner -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Changing the icon for the All Apps Button
Gotcha. Thanks Mark. That was both what I expected and what I feared. On Nov 2, 7:33 am, Mark Murphy mmur...@commonsware.com wrote: On Wed, Nov 2, 2011 at 8:28 AM, erik wagner erik.j.wag...@gmail.com wrote: I am looking to actually replace the 'All Apps' button on the Android home screen. I know there is the Home sample app, as near as I can tell (and please correct me if I'm wrong) it overlays a separate home button on top of the existing one - instead of actually replacing it. Is there a way to actually replace the All Apps icon on the Android home screen? No, short of hacking the app on a rooted phone. Bear in mind that there is no single Android home screen -- there are probably a few dozen in use on production hardware and uncounted home screens you can download from the Android Market. You can create your own home screen app (see the sample app you mention). Users will then have a choice of running your app or the built-in one when they press HOME. If they make your app the default, they will go to your app exclusively when the press HOME, until they remove your app or launch in safe mode. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] sqlite help
Hi, I am wondering if anyone has a simple SQLite app/example they can point to, provide or whatever. Just basically looking for an example that will connect to a database, and add or remove a record. Been trying to sift through the searchable dictionary example and currently not having much luck getting to the barebone essentials. Failing an example, if anyone could provide a rough outline or what to do that would be extremely helpful as well. The example/outline doesn't need to be overly involved, just looking for what amounts to a Hello SQLite app. Thanks for any help/advice Erik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: sqlite help
Thanks Mark and Joel, very appreciated. Now I know what I will be doing this weekend g On Oct 21, 12:56 pm, Joel Witherspoon joel.withersp...@gmail.com wrote: On Fri, Oct 21, 2011 at 10:33 AM, Mark Murphy mmur...@commonsware.com wrote: On Fri, Oct 21, 2011 at 1:31 PM, erik wagner erik.j.wag...@gmail.com wrote: I am wondering if anyone has a simple SQLite app/example they can point to, provide or whatever. Just basically looking for an example that will connect to a database, and add or remove a record. Been trying to sift through the searchable dictionary example and currently not having much luck getting to the barebone essentials. Here's one from one of my books, if that helps: https://github.com/commonsguy/cw-android/tree/master/Database/Constants -- Mark Murphy (a Commons Guy) http://commonsware.com|http://github.com/commonsguy http://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en Erik, I recommend Mark's books for leaning Android dev period. They are fantastic. I also recommend Android Application Development For Dummies by Donn Felker. The SQLLite section is simple and easy to understand and learn. I started down the SQLLite road after reading this tutorial:http://www.screaming-penguin.com/node/7742. Without knowing your level of development expertise, it's hard to give you a tutorial to fit your needs. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Getting info from a calling activity advice
Hi, I'm trying to do something where I have an activity that needs to call another activity. I use the startActivityForResult and pass it a integer as the second parameter. I know I can check for that information after the second activity is done but my question is; is there a way I can know what the integer value is when starting the second activity? So, I have startActivityForResult(myIntent, 1); When the activity described by myIntent is started is there a way I can grab the 1 value and do something with it? If not, can anyone provide some advice on how to get a value from a calling activity to the called activity? Thanks in advance. Erik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Ringtones
Finally was able to find an example. Thank the Lord for smart people http://groups.google.com/group/android-developers/browse_thread/thread/fc05ace7d76dff62 On Sep 27, 2:52 pm, erik wagner erik.j.wag...@gmail.com wrote: Whoops, the Uri newUri line should have 'aUri' in the getContentResolver().insert portion. My editing mistake, only correcting so there's no confusion on anyone trying to follow it. Thanks. On Sep 27, 12:49 pm, erik wagner erik.j.wag...@gmail.com wrote: Hi, I'm trying to add a ringtone to the ringtone picker and am having a tough go of it. I am working off this example (http:// groups.google.com/group/android-developers/browse_thread/thread/ b5590a1551e4f97d) but cannot seem to get it to work. Any help would be greatly appreciated. Thanks. (my code is probably all over the place at this point) myContentValues.put(MediaStore.MediaColumns.DATA, getString(R.raw.asound)); myContentValues.put(MediaStore.MediaColumns.MIME_TYPE, audio/mp3); myContentValues.put(MediaStore.MediaColumns.TITLE, A Sound); I've left the other entries off since those seem to be pretty easy, is that the correct format of the DATA portion? The audio file is an mp3 in the res/raw folder. It is set as a ringtone including the rest of (what I think is) the relevant code, Uri aUri = MediaStore.Audio.Media.getContentUriForPath(getString(R.raw.asound)); Uri newUri = getContentResolver().insert(fearUri, myContentValues); RingtoneManager.setActualDefaultRingtoneUri(myContext, RingtoneManager.TYPE_RINGTONE, newUri); So I guess I have several questions... 1. Is there anything plainly wrong with the myContentValues statements? 2. When the ringtone picker is brought up should the title show up (in this case A Sound) or will it remain listed as 'default ringtone'? 3. If there is a sample project online that does this that anyone knows about (I looked through all the sample stuff but didn't see anything, I could have easily missed it though) feel free to include that. Thanks in advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Ringtones
Hi, I'm trying to add a ringtone to the ringtone picker and am having a tough go of it. I am working off this example (http:// groups.google.com/group/android-developers/browse_thread/thread/ b5590a1551e4f97d) but cannot seem to get it to work. Any help would be greatly appreciated. Thanks. (my code is probably all over the place at this point) myContentValues.put(MediaStore.MediaColumns.DATA, getString(R.raw.asound)); myContentValues.put(MediaStore.MediaColumns.MIME_TYPE, audio/mp3); myContentValues.put(MediaStore.MediaColumns.TITLE, A Sound); I've left the other entries off since those seem to be pretty easy, is that the correct format of the DATA portion? The audio file is an mp3 in the res/raw folder. It is set as a ringtone including the rest of (what I think is) the relevant code, Uri aUri = MediaStore.Audio.Media.getContentUriForPath(getString(R.raw.asound)); Uri newUri = getContentResolver().insert(fearUri, myContentValues); RingtoneManager.setActualDefaultRingtoneUri(myContext, RingtoneManager.TYPE_RINGTONE, newUri); So I guess I have several questions... 1. Is there anything plainly wrong with the myContentValues statements? 2. When the ringtone picker is brought up should the title show up (in this case A Sound) or will it remain listed as 'default ringtone'? 3. If there is a sample project online that does this that anyone knows about (I looked through all the sample stuff but didn't see anything, I could have easily missed it though) feel free to include that. Thanks in advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Ringtones
Whoops, the Uri newUri line should have 'aUri' in the getContentResolver().insert portion. My editing mistake, only correcting so there's no confusion on anyone trying to follow it. Thanks. On Sep 27, 12:49 pm, erik wagner erik.j.wag...@gmail.com wrote: Hi, I'm trying to add a ringtone to the ringtone picker and am having a tough go of it. I am working off this example (http:// groups.google.com/group/android-developers/browse_thread/thread/ b5590a1551e4f97d) but cannot seem to get it to work. Any help would be greatly appreciated. Thanks. (my code is probably all over the place at this point) myContentValues.put(MediaStore.MediaColumns.DATA, getString(R.raw.asound)); myContentValues.put(MediaStore.MediaColumns.MIME_TYPE, audio/mp3); myContentValues.put(MediaStore.MediaColumns.TITLE, A Sound); I've left the other entries off since those seem to be pretty easy, is that the correct format of the DATA portion? The audio file is an mp3 in the res/raw folder. It is set as a ringtone including the rest of (what I think is) the relevant code, Uri aUri = MediaStore.Audio.Media.getContentUriForPath(getString(R.raw.asound)); Uri newUri = getContentResolver().insert(fearUri, myContentValues); RingtoneManager.setActualDefaultRingtoneUri(myContext, RingtoneManager.TYPE_RINGTONE, newUri); So I guess I have several questions... 1. Is there anything plainly wrong with the myContentValues statements? 2. When the ringtone picker is brought up should the title show up (in this case A Sound) or will it remain listed as 'default ringtone'? 3. If there is a sample project online that does this that anyone knows about (I looked through all the sample stuff but didn't see anything, I could have easily missed it though) feel free to include that. Thanks in advance. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] return values from preferences with getString
Hi, I'm having a bit of a problem with the return values from preferences.getString. The value that I'm getting returned doesn't seem to be correct. This snippet will not evaluate correctly (i'm omitting the toast.length_long ending since it formats squirrelly). This always goes to the else (i.e. 'nothing') condition. There are only two possible values (Two and Four). String strTemp=prefs.getString(listPlayers, ); if (strTemp==Two) { Toast.makeText(WarGamePlay.this, two?, } else if (strTemp==Four) { Toast.makeText(WarGamePlay.this, four?, } else { Toast.makeText(WarGamePlay.this, nothing?, } If i exchange the prefs.getString with just... String strTemp=Two; then that correctly goes to the first condition in the if/else tree. What am I missing? I have checked the values coming back from the prefs.getString and there are no leading/trailing spaces or anything else visually wrong that I can see with the value. Any help on this would be appreciated. Thanks in advance. Erik Wagner -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: return values from preferences with getString
Thanks very much! I have to say though my (ignorant) questions are not over. I am ultra newbie on Java and am not sure how to write a (working) Equals method. This is the body of the Equals I wrote public boolean equals(String strTemp) { SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this); if (strTemp instanceof String) { String strP1 = prefs.getString(listPlayers, ); if (this.equals(strP1)) return true; } return false; } in the code i'm trying to do something along the lines of if ((equals(Two) { // blah blah } I know this is a basic-really-should-know-how-to question but I'm kind of flailing on the whole thing. Thanks. On Sep 4, 5:08 pm, Mark Murphy mmur...@commonsware.com wrote: Never compare strings with == in Java. Use equals(). On Sun, Sep 4, 2011 at 6:07 PM, erik wagner erik.j.wag...@gmail.com wrote: Hi, I'm having a bit of a problem with the return values from preferences.getString. The value that I'm getting returned doesn't seem to be correct. This snippet will not evaluate correctly (i'm omitting the toast.length_long ending since it formats squirrelly). This always goes to the else (i.e. 'nothing') condition. There are only two possible values (Two and Four). String strTemp=prefs.getString(listPlayers, ); if (strTemp==Two) { Toast.makeText(WarGamePlay.this, two?, } else if (strTemp==Four) { Toast.makeText(WarGamePlay.this, four?, } else { Toast.makeText(WarGamePlay.this, nothing?, } If i exchange the prefs.getString with just... String strTemp=Two; then that correctly goes to the first condition in the if/else tree. What am I missing? I have checked the values coming back from the prefs.getString and there are no leading/trailing spaces or anything else visually wrong that I can see with the value. Any help on this would be appreciated. Thanks in advance. Erik Wagner -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: return values from preferences with getString
Fair enough, thanks again On Sep 4, 6:12 pm, Mark Murphy mmur...@commonsware.com wrote: On Sun, Sep 4, 2011 at 6:54 PM, erik wagner erik.j.wag...@gmail.com wrote: Thanks very much! I have to say though my (ignorant) questions are not over. I am ultra newbie on Java and am not sure how to write a (working) Equals method. I heartily encourage you to learn Java *before* attempting to get into Android development, simply because most of the Java educational materials out there are designed for non-Android environments. This is the body of the Equals I wrote public boolean equals(String strTemp) { SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this); if (strTemp instanceof String) { String strP1 = prefs.getString(listPlayers, ); if (this.equals(strP1)) return true; } return false; } There is no point in your instanceof test, as Java is strongly typed, so it will always be a String. Also, I didn't tell you to *write* an equals() method, but to *use* the equals() method, as you did inside your own equals() method. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: help with spinners from preferences
I apologize that the code appeared to be/was unformatted, it looked fine on my end. Thanks for the tip. That is exactly what I was trying to hodgepodge together. Much appreciated. Erik Wagner On Aug 31, 10:59 am, TreKing treking...@gmail.com wrote: On Tue, Aug 30, 2011 at 7:50 PM, erik wagner erik.j.wag...@gmail.comwrote: I have a preference screen where a edit text brings up a spinner, the result from the spinner needs to get to the edit text on the preference screen and the value from the edit text needs to then get back to the main activity. I didn't look over your giant blob of foreign, unformatted code, but you should not neither either a spinner or edit text in a preference actiivty, unless you have your terms mixed up. All you should really need is a list preference.http://developer.android.com/reference/android/preference/ListPrefere... ----- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] help with spinners from preferences
Hi, I have a preference screen where a edit text brings up a spinner, the result from the spinner needs to get to the edit text on the preference screen and the value from the edit text needs to then get back to the main activity. I can get the value from a straight edit text to the main activity but I cannot figure out how to get the spinner choice to the edit field. (disclaimer, the bulk of this is from an example project that I am trying to use to learn how to do this). The relevant porton of the main.xml TableRow TextView android:text=Edit TEXT: android:paddingRight=5dip/ TextView android:id=@+id/edittext/ /TableRow I have a preferences.xml in the /res/xml folder... PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android; EditTextPreference android:key=edit_text android:title=Edit Text Preference android:dialogLayout=@layout/spinner android:summary=What to do?/ /PreferenceScreen I also have a spinner.xml in the /layout folder ?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 Spinner android:id=@+id/spinner android:layout_width=fill_parent android:layout_height=wrap_content android:width=200dp android:entries=@array/edit_text_array / /LinearLayout There are two activities. The first is PrefsActivity package com.Prefs; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class PrefsActivity extends Activity { /** Called when the activity is first created. */ private static final int EDIT_ID = Menu.FIRST+3; private TextView check_box=null; private TextView edit_text=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); check_box=(TextView) findViewById(R.id.checkbox1); edit_text=(TextView) findViewById(R.id.edittext); } public void onResume() { super.onResume(); SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this); check_box.setText(new Boolean(prefs.getBoolean(check_box, false)).toString()); edit_text.setText(prefs.getString(edit_text, )); //spinner.setText(prefs.getString(spinner, )); } public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, EDIT_ID, Menu.NONE, Edit Prefs) .setIcon(R.drawable.icon) .setAlphabeticShortcut('e'); return(super.onCreateOptionsMenu(menu)); } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case EDIT_ID: startActivity(new Intent(this, EditPreferences.class)); return(true); } return(super.onOptionsItemSelected(item)); } } and finally the EditPreferences activity. package com.Prefs; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.widget.TextView; public class EditPreferences extends PreferenceActivity { private TextView spinner=null; private TextView edit_text=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); spinner=(TextView) findViewById(R.id.spinner); addPreferencesFromResource(R.xml.preferences); } public void onResume() { super.onResume(); } } What I was thinking was that the spinner needed to feed the result to the edittext on the preferences before the edittext on the preferences could feed it to the one on the PrefsActivity activity. Long story short, what am I doing wrong and what should I do on this? I'm a little brained out on this after staring at it and trying everything my limited understanding could think of. Thanks in advance. Erik Wagner -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Advice on getting data from one activity to another
Hi, I guess this is more of a design with more than a little 'how do i' mixed in question. I have two activities (thus far), a main page and an options page. On the options page I set an option that I need to 'see' on the main page (as well as on subsequent other activites). What is the 'best' way to do this? Global variables are a no-no and a bit of a pain to do as I understand it. How can I do this? Perhaps just point me in the direction of a dev article on the subject though I couldn't find anything on point. At least at that point I can then move on to more detailed how-to questions. Thanks again for all the help on my various newbie questions. Erik Wagner -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Advice on getting data from one activity to another
Thanks! Now to figure out how to use them, hopefully I won't be back later with a 'uh, how do i do this?' question. On Aug 27, 9:50 am, Mark Murphy mmur...@commonsware.com wrote: On Sat, Aug 27, 2011 at 10:32 AM, erik wagner erik.j.wag...@gmail.com wrote: Hi, I guess this is more of a design with more than a little 'how do i' mixed in question. I have two activities (thus far), a main page and an options page. On the options page I set an option that I need to 'see' on the main page (as well as on subsequent other activites). What is the 'best' way to do this? Use SharedPreferences and an OnSharedPreferenceChangeListener. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 3.1 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] reading choices from spinners
Hi all, I have a very simple game that I'm trying to do for learning purposes. One of the options is selecting the number of players (2-4) via a spinner. When a choice is made from the spinner I am moving the value to a string and then using that string in a series of if/else if statements to (eventually) handle the option. I am running into the problem where the condition that (to me) seems like it should be true is evaluating to false. If I select Two, the value moved to the variable is Two but the check for the variable == Two isn't getting hit. (hope that was all clear, backstory may not be needed but better safe than vague). Anyway, the spinner's OnSelectedItemListener... public class MyPlayerOnItemSelectedListener implements OnItemSelectedListener { public void onItemSelected(AdapterView? parent, View view, int pos, long id) { String strResult; strResult = parent.getItemAtPosition(pos).toString(); if (strResult == Two) { Toast.makeText(parent.getContext(), this is the result when one is selected, Toast.LENGTH_LONG).show(); } else if (strResult == Three) { Toast.makeText(parent.getContext(), three players / + strResult + /, Toast.LENGTH_LONG).show(); } else if (strResult == Four) { Toast.makeText(parent.getContext(), four, Toast.LENGTH_LONG).show(); } else { Toast.makeText(parent.getContext(), something else / + strResult + /, Toast.LENGTH_LONG).show(); } } public void onNothingSelected(AdapterView? parent) { } } No matter what I select using this code the Toast shows as something else / + what the value actually is + /. i.e. if I chose 'Two' the toast reads something else /Two/. Any help would be greatly appreciated on this. I'm certain it is something very fundamental that I'm just missing. Thanks in advance Erik Wagner -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Getting a second page to do anything
Hi, This is I'm sure a very simple thing to do and I am just missing something but I am just starting out. I have the main view, which has a button. The button brings up a second view that is supposed to show some toast message (or, in fact do anything). I can get everything to work on the first view, but nothing at all to work on the second. first view (main.xml for the layout) public class actvSecondPage extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button btnToast = (Button) findViewById(R.id.btnToast); btnToast.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(actvSecondPage.this, this is some toast, Toast.LENGTH_LONG).show(); } }); final Button btnSecondPage = (Button) findViewById(R.id.btnSecondPage); btnSecondPage.setOnClickListener(new OnClickListener() { public void onClick(View v) { setContentView(R.layout.second); } }); } } Second view (second.xml for the layout) public class actvSecond extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second); Toast.makeText(actvSecond.this, this is some toast on the actual second page., Toast.LENGTH_LONG).show(); }; } the android.manifest.xml (in case i'm missing something there) ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=com.SecondPage android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=3 / application android:icon=@drawable/icon android:label=@string/ app_name activity android:name=.actvSecondPage android:label=@string/app_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity /application /manifest Can anyone help as to why what works in the first class does not in the second? Or, rather, that nothing at all works in the second class? Any help would be appreciated, thanks. Erik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Getting a second page to do anything
Ah, that did the trick. Thank you very much, it was setting the Intent that I was totally missing. On Aug 21, 10:04 am, Appaholics raghavs...@appaholics.in wrote: You need to declare the second activity in the manifest. You will also need an intent in your first activity to launch the second one. Thishttp://www.warriorpoint.com/blog/2009/05/24/android-how-to-switch-bet... help you in adding and starting another activity. Thanks On Sun, Aug 21, 2011 at 8:27 PM, erik wagner erik.j.wag...@gmail.comwrote: Hi, This is I'm sure a very simple thing to do and I am just missing something but I am just starting out. I have the main view, which has a button. The button brings up a second view that is supposed to show some toast message (or, in fact do anything). I can get everything to work on the first view, but nothing at all to work on the second. first view (main.xml for the layout) public class actvSecondPage extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button btnToast = (Button) findViewById(R.id.btnToast); btnToast.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(actvSecondPage.this, this is some toast, Toast.LENGTH_LONG).show(); } }); final Button btnSecondPage = (Button) findViewById(R.id.btnSecondPage); btnSecondPage.setOnClickListener(new OnClickListener() { public void onClick(View v) { setContentView(R.layout.second); } }); } } Second view (second.xml for the layout) public class actvSecond extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second); Toast.makeText(actvSecond.this, this is some toast on the actual second page., Toast.LENGTH_LONG).show(); }; } the android.manifest.xml (in case i'm missing something there) ?xml version=1.0 encoding=utf-8? manifest xmlns:android=http://schemas.android.com/apk/res/android; package=com.SecondPage android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=3 / application android:icon=@drawable/icon android:label=@string/ app_name activity android:name=.actvSecondPage android:label=@string/app_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity /application /manifest Can anyone help as to why what works in the first class does not in the second? Or, rather, that nothing at all works in the second class? Any help would be appreciated, thanks. Erik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- -- Raghav Sood CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles required to have complete control)http://www.raghavsood.com/https://market.android.com/developer?pub=Appaholicshttp://www.appaholics.in/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Hello Listview project
Hi to all, I am very new to both java and android development so this is probably a very simple question. I have been going through the various 'hello' tutorials on this site. I've hit a snag on the 'Hello Listview' (this one http://developer.android.com/resources/tutorials/views/hello-listview.html). When trying to run it I get a fatal error and the debugger shows me the following message of Your content must have a ListView whose id attribute is 'android.R.id.list' I've seen some similar things on various posts but could not find the answer to; 1. where is this entry to be made (the androidmanifest.xml? the list.xml?) and 2. what the entry actually should be. Thanks in advance for any answers. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en