[android-beginners] Building the apk using the ant script .
Hi , iam facing problem in creating the .apk file using the ant script . The generated .apk named as _unaligned.apk instead of .apk and on installing the _unaligned.apk file to the device i get force-close showing the java.lang.VerifyError exaception , but the same apk generated using IDE works fine . i am struck on this for a long time , is it possible for you to share the build.xml file that generates the .apk file . thank you and regards Sheik -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] Re: Upgrade to Android 2.2 phones
I heard about nexus one should be very easy to 2.2. On Tue, Jun 22, 2010 at 10:00 AM, Joshua Partogi joshua.part...@gmail.comwrote: Thanks for the swift response Mark. Really appreciate it. This really helps us for evaluating Android. Regards, Joshua. On Jun 22, 9:48 am, Mark Murphy mmur...@commonsware.com wrote: On Mon, Jun 21, 2010 at 7:46 PM, Joshua Partogi joshua.part...@gmail.com wrote: I am still new to Android and planning to create an app on Android. I have heard that Android 2.2 OS is out already That is not correct. A leaked Froyo build made the rounds, but nothing has been officially released yet for any current production device. My question is, would it be possible to upgrade to Android 2.2 from an Android 2.1 phones? That is a question for the manufacturer of the device in question. I believe most have said their 2.1 devices will get 2.2, but there is no guarantee. -- Mark Murphy (a Commons Guy)http://commonsware.com| http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android App Developer Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- Regards, Michael Leung http://www.itblogs.info http://www.michaelleung.info -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] Name of apk
apk bole to? On Tue, Jun 22, 2010 at 11:12 AM, Aviral Shrivastava aviral...@gmail.comwrote: Hi.. Can we identify the name of the apk at the run time through code without using adb? Thanks Regards Aviral Shrivastava -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Name of apk
Hi.. Can we identify the name of the apk at the run time through code without using adb? Thanks Regards Aviral Shrivastava -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] How comes that the estimate time becomes negative
Dear all, I have developed a small app that helps the driver to regulate his speed in order to pass the traffic light when it is green; and thereby minimizing the number of times that he has to stop for red. But, the app does not always work as anticipated. In my app, I need to get the timedifference from when he starts driving to the actual time. This time is needed in order to calculate whether he will reach the light when it is green, or if he needs to slow down in case the current speed is too high. I will appreciate any help that can guide me in the right direction to identify the problem: is it due to Java and that it cannot control the on-going queueing of GPS data? is it due to problems with HTC Hero and Android 1.5; or is it something much more simple that causes my problem. Please, send me your input. I have inserted the most relevant parts of the code below which is structurized as: 1) gpspos() is the function called when I want to start the routine (the main app is launched before). 2) initial_time should contain the timesample from when I call the routine. That is the reason why I set it to zero in the beginning and then update it the first time the conditions distance_1 radius and counter_L are fulfilled. These conditions are fulfilled when I call gpspos(). 3) time=location.getTime() is the GPS clock. 4) double spend_time_1_sec = (time - initial_time); determines the time spend since I called gpspos(). Thank you for your time and help CKLOCH public void gpspos() { super.onResume(); LocationManager locMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener locListener = new LocationListener() { double initial_time = 0; public voidonLocationChanged(Location location) { if (location != null) { double time = location.getTime()/1000; double spend_time_1_sec = (time - initial_time); if (distance_1radius counter_L==1) // This is only true once when the routine gpspos() is called { initial_time = location.getTime()/1000; // initial_time is in seconds } } } } -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: How to (properly) get device orientation data?
On Jun 17, 11:56 am, lawrizy lawr...@gmail.com wrote: Hi, I wanna thank you very much for your explanation. The official documentation was very difficult to understand. And the example in the api sample (the compass) does use a depreciated methods (with sensorlistener). Nice, I'm glad it's been useful. Just remember, this is definitely not definitive. I don't understand what does remapCoordinateSystem and his parameters, could you help? Hmm, not sure where is the difficulty, but in my example it demonstrates remapping to camera's line of view (Y axis along the camera's axis instead of the device length) as used in augmented reality applications. I think that on this one the documentation is pretty extensive try looking it up again at: http://developer.android.com/reference/android/hardware/SensorManager.html#remapCoordinateSystem(float[],%20int,%20int,%20float[]) For what it worth, Rick Deckard. -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Getting text of dynamically created radio buttons
Thanks. I'm making a quiz app and once completed, i'll blog it with a tutorial on: http://www.maxood-android-corner.blogspot.com/ You are welcome to subscribe on my blog. On Jun 18, 7:23 am, Mikey frak@gmail.com wrote: I have taken a look at the API reference, and getText() looks like it might be what you need... On 18 Jun 2010, at 15:11, Maxood wrote: How can i retrieve the text of a dynamically created radio button selected by the user? Here's my code: RadioGroup radiogroup = (RadioGroup) findViewById(R.id.rdbGp1); // layout params to use when adding each radio button LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams( RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT); for (int i = 0; i 4; i++){ final RadioButton newRadioButton = new RadioButton(this); c3 = db.getAns(3); for (int j=0;ji;j++) c3.moveToNext(); label = c3.getString(0); newRadioButton.setText(label); newRadioButton.setId(6); radiogroup.addView(newRadioButton, layoutParams); Waiting for the reply, Maqsood -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] ListView refresh in ListActivity
Hello, I have a ListActivity with a custom CursorAdapter. Using a ContextMenu I delete a row from the database. My problem is, that after deleting the row, the ListView is not updated. IIRC the ListView should refresh automatically. But I also tried to trigger this with a requery() on the cursor. Maybe you can give me a hint where I have to look or what I am doing wrong. Here is the relevant part from onContextItemSelected(...): [...] switch(item.getItemId()) { case R.id.beeyards_context_delete: mDatenbank.deleteBeeyard(info.id); Toast toast = Toast.makeText(this, R.string.toast_entry_deleted, Toast.LENGTH_SHORT); toast.show(); //BeeyardsCursorAdapter adapter = (BeeyardsCursorAdapter) getListAdapter(); //adapter.getCursor().requery(); // Doesn't work return true; } And mDatabase.deleteBeeyard(info.id) deletes the entry: public boolean deleteBeeyard(long id) { final SQLiteDatabase dbCon = getWritableDatabase(); int rowsDeleted = 0; try { rowsDeleted = dbCon.delete(BeeyardTable.TABLE_NAME, BeeyardTable.WHERE_ID_EQUALS, new String[] { String.valueOf(id) }); } finally { dbCon.close(); } return rowsDeleted == 1; } Thanks a lot! -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] ListView refresh in ListActivity
On Tue, Jun 22, 2010 at 9:26 AM, beedaddy mda...@googlemail.com wrote: But I also tried to trigger this with a requery() on the cursor. That technique works fine: http://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 _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: ListView refresh in ListActivity
Thank you Mark! In my deleteBeeyard() method, the finally {dbCon.close();} was the problem. I thought the SQLiteDatabase I get from getWritableDatabase() is unrelated to the previously created Cursor (with getReadableDatabase().rawQuery(...) ) for the CursorAdapter. Obviously I didn't (and still don't) understand some basics. :-( -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: How to (properly) get device orientation data?
Thank you for your answer. I will try on a device. On 22 juin, 11:17, repDetect() n6mba50...@gmail.com wrote: On Jun 17, 11:56 am, lawrizy lawr...@gmail.com wrote: Hi, I wanna thank you very much for your explanation. The official documentation was very difficult to understand. And the example in the api sample (the compass) does use a depreciated methods (with sensorlistener). Nice, I'm glad it's been useful. Just remember, this is definitely not definitive. I don't understand what does remapCoordinateSystem and his parameters, could you help? Hmm, not sure where is the difficulty, but in my example it demonstrates remapping to camera's line of view (Y axis along the camera's axis instead of the device length) as used in augmented reality applications. I think that on this one the documentation is pretty extensive try looking it up again at:http://developer.android.com/reference/android/hardware/SensorManager...[],%20int,%20int,%20float[]) For what it worth, Rick Deckard. -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Switch between views.
Tx for rply treking, Everything is working and fine, since i am newbie either in java and android. I am looking for better/good ways if there is any. Do u have nice links u can share? On Jun 21, 11:01 pm, TreKing treking...@gmail.com wrote: On Mon, Jun 14, 2010 at 9:43 PM, m0ny3t dendydo...@gmail.com wrote: The question is: 1. Do I did a correct the way calling the other activity? Sure. Did you try it? Did it work? 2. Is it effective if I pass the JSON text between intents? Effective is arguable. Does it work? Then sure. 3. How to pass an object between activities? Make your object serializable, parcelable, or able to be stored in and retrieved from a Bundle. --- -- TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Problems with Google Groups?
Thanks, it was the Cookie Monster! On Jun 21, 3:13 pm, RichardC richard.crit...@googlemail.com wrote: Had the same problem in Firefox, deleting the cookies for groups.google.* fixed it. Hope this helps /Richard On Jun 21, 7:15 pm, Greg Donald gdon...@gmail.com wrote: On Mon, Jun 21, 2010 at 12:43 PM,DonFrenchdcfre...@gmail.com wrote: I just fired up an IE 8.0 instance and the problem does not exist with it, only with FF. And using a new instance of FF does not help. Here is a screen grab of the page for this thread on FireFox: http://www.donfrenchphotography.com/MiscPhotos/ScreenGrab.jpg This sort of thing happens to me sometimes when Ad Block causes style sheets to not load. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] File Browsing or Customisation Activities
On Tue, Jun 15, 2010 at 4:02 AM, redneon darrell.bl...@gmail.com wrote: I've seen the RingtonePreference activity, so I can probably get away with using that for browsing for ringtones but there doesn't appear to be anything similar for wallpapers. Try looking into MediaStore. - TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] LogCat
I use LogCat a lot when debugging but it is an irritation that it frequently has to be reset to get the latest log output. I am only aware of two ways to get the log output when this happens: 1) Go to the DDMS perspective and then pull down the menu in the Devices view and select reset adb, and 2) Exit Eclipse and restart it. Some of the time Reset adb works but often it does not and I have to exit and restart Eclipse. So, first, am I doing something wrong that causes LogCat to stop functioning? And second, is there another way to refresh the log other than the two methods I mentioned? And third, is this a bug in the Android Eclipse plug-in? If it is, why doesn't Google fix it? -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] LogCat
Don, I can recommend running adb logcat from the OS's command line window. This way, it's always around, you can make it as large as you want, and can do filtering by piping through grep or find, if necessary. -- Kostya 22.06.2010 22:02, DonFrench пишет: I use LogCat a lot when debugging but it is an irritation that it frequently has to be reset to get the latest log output. I am only aware of two ways to get the log output when this happens: 1) Go to the DDMS perspective and then pull down the menu in the Devices view and select reset adb, and 2) Exit Eclipse and restart it. Some of the time Reset adb works but often it does not and I have to exit and restart Eclipse. So, first, am I doing something wrong that causes LogCat to stop functioning? And second, is there another way to refresh the log other than the two methods I mentioned? And third, is this a bug in the Android Eclipse plug-in? If it is, why doesn't Google fix it? -- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] LogCat
Thanks a lot for that tip, even though I was not the person asking the question... On 22 Jun 2010, at 19:11, Kostya Vasilyev wrote: Don, I can recommend running adb logcat from the OS's command line window. This way, it's always around, you can make it as large as you want, and can do filtering by piping through grep or find, if necessary. -- Kostya 22.06.2010 22:02, DonFrench пишет: I use LogCat a lot when debugging but it is an irritation that it frequently has to be reset to get the latest log output. I am only aware of two ways to get the log output when this happens: 1) Go to the DDMS perspective and then pull down the menu in the Devices view and select reset adb, and 2) Exit Eclipse and restart it. Some of the time Reset adb works but often it does not and I have to exit and restart Eclipse. So, first, am I doing something wrong that causes LogCat to stop functioning? And second, is there another way to refresh the log other than the two methods I mentioned? And third, is this a bug in the Android Eclipse plug-in? If it is, why doesn't Google fix it? -- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] ListView TextFilter..Broken?
Hi everyone, My issue is simplebelow is the code. When the list filters, and the person clicks, no matter what the position is on 0...Can I do it by the string name in the listview instead of the position? public void onListItemClick(ListView l, View v, int position, long id) { if(position == 0) { Intent in = new Intent(this, ingredientsclam.class); startActivity(in); } } Clam Soup is at position 0, and apple pie is at position 1. If they search apple pie it will filter, but when they click it it will take them to the position 0... -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Date picker problem
Thank you everyone. I resolved most of the issues with all the help from all the group members. I have one last issue: R. id. display cannot be resolved. Couldn't find anything online to help. Any help would be appreciated. /*** * Excerpted from Hello, Android!, * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for any purpose. * Visit http://www.pragmaticprogrammer.com/titles/eband for more book information. ***/ package org.example.sudoku; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import java.util.Calendar; import android.app.DatePickerDialog; import android.app.Dialog; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; import android.widget.Toast; public class sudoku extends Activity implements OnClickListener { private TextView mDateDisplay; private Button mPickDate; private int mYear; private int mMonth; private int mDay; static final int DATE_DIALOG_ID = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // capture our View elements mDateDisplay = (TextView) findViewById(R.id.dateDisplay); mPickDate = (Button) findViewById(R.id.pickDate); // add a click listener to the button mPickDate.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); // get the current date final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); // display the current date updateDisplay(); // Set up click listeners for all the buttons View continueButton = findViewById(R.id.continue_button); continueButton.setOnClickListener(this); View newButton = findViewById(R.id.new_button); newButton.setOnClickListener(this); View aboutButton = findViewById(R.id.about_button); aboutButton.setOnClickListener(this); View exitButton = findViewById(R.id.exit_button); exitButton.setOnClickListener(this); } /** Called when the activity is first created. */ @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay); } return null; } // updates the date we display in the TextView private void updateDisplay() { mDateDisplay.setText( new StringBuilder() // Month is 0 based so add 1 .append(mMonth + 1).append(-) .append(mDay).append(-) .append(mYear).append( )); } // the callback received when the user sets the date in the dialog private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mYear = year; mMonth = monthOfYear; mDay = dayOfMonth; updateDisplay(); } }; // ... public void onClick(View v) { switch (v.getId()) { case R.id.about_button: Intent i = new Intent(this, About.class); startActivity(i); break; // More buttons go here (if any) ... } } } On Jun 22, 8:56 am, DonFrench dcfre...@gmail.com wrote: Well you can't have two onCreate methods -- that much is certain. So fix that first and then work on the other problems. On Jun 21, 9:13 pm, Varun Khanduja varunkhand...@gmail.com wrote: Thank you. I resolved some of the issues and the number of errors are down to 3. /*** * Excerpted from Hello, Android!, * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for any purpose. * Visithttp://www.pragmaticprogrammer.com/titles/ebandformore book information. ***/ package org.example.sudoku; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import java.util.Calendar; import
Re: [android-beginners] Re: Date picker problem
Looking through your code, I do not see where you are using R.id.display, however I see R.id.dateDisplay If the problem is with R.id.dateDisplay, do you have any layout defined that has the id dateDisplay? Check in your res/layout folder -Tope On Tue, Jun 22, 2010 at 3:57 PM, Varun Khanduja varunkhand...@gmail.com wrote: Thank you everyone. I resolved most of the issues with all the help from all the group members. I have one last issue: R. id. display cannot be resolved. Couldn't find anything online to help. Any help would be appreciated. /*** * Excerpted from Hello, Android!, * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for any purpose. * Visit http://www.pragmaticprogrammer.com/titles/eband for more book information. ***/ package org.example.sudoku; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import java.util.Calendar; import android.app.DatePickerDialog; import android.app.Dialog; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; import android.widget.Toast; public class sudoku extends Activity implements OnClickListener { private TextView mDateDisplay; private Button mPickDate; private int mYear; private int mMonth; private int mDay; static final int DATE_DIALOG_ID = 0; �...@override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // capture our View elements mDateDisplay = (TextView) findViewById(R.id.dateDisplay); mPickDate = (Button) findViewById(R.id.pickDate); // add a click listener to the button mPickDate.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); // get the current date final Calendar c = Calendar.getInstance(); mYear = c.get(Calendar.YEAR); mMonth = c.get(Calendar.MONTH); mDay = c.get(Calendar.DAY_OF_MONTH); // display the current date updateDisplay(); // Set up click listeners for all the buttons View continueButton = findViewById(R.id.continue_button); continueButton.setOnClickListener(this); View newButton = findViewById(R.id.new_button); newButton.setOnClickListener(this); View aboutButton = findViewById(R.id.about_button); aboutButton.setOnClickListener(this); View exitButton = findViewById(R.id.exit_button); exitButton.setOnClickListener(this); } /** Called when the activity is first created. */ @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay); } return null; } // updates the date we display in the TextView private void updateDisplay() { mDateDisplay.setText( new StringBuilder() // Month is 0 based so add 1 .append(mMonth + 1).append(-) .append(mDay).append(-) .append(mYear).append( )); } // the callback received when the user sets the date in the dialog private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { mYear = year; mMonth = monthOfYear; mDay = dayOfMonth; updateDisplay(); } }; // ... public void onClick(View v) { switch (v.getId()) { case R.id.about_button: Intent i = new Intent(this, About.class); startActivity(i); break; // More buttons go here (if any) ... } } } On Jun 22, 8:56 am, DonFrench dcfre...@gmail.com wrote: Well you can't have two onCreate methods -- that much is certain. So fix that first and then work on the other problems. On Jun 21, 9:13 pm, Varun Khanduja varunkhand...@gmail.com wrote: Thank you. I resolved some of the issues and the number of errors are down to 3. /*** * Excerpted from Hello, Android!, * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for
[android-beginners] onHandleIntent(Intent) method does not get called
Hi -- I'm tryng to get an IntentService to work, and I have extended IntentService, and I implemented a onHandletIntent(Intent) method. I put some logging in there, but this method never gets called. I must be doing something really dumb, but I don't know what it is. Is there something else I need to implement or override, or whatever, to make this work? -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en