[android-developers] Back button problem in android
when i click on androids back button it stops whole activitybut i want to come back to previous page..can anyone help me to solve this problem... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] back button problem
On Fri, Jul 1, 2011 at 12:11 AM, ragupathi ragupathi ragumm...@gmail.comwrote: im new one for in android. im developing one application. im using database if i calling new activity to store the values in database it working fine. but when i came back to previous activity it not reloaded that previous activity. it will display same as old content. i need when im clicking back button it reloaded (refresh) all content in the activity.. can any one help me pls.. Look at startActivityForResult(). - 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
Re: [android-developers] back button problem
I'd just reload the data in onResume(). If you are using managed cursors or the Loader framework, that sort of thing should happen automagically. On Fri, Jul 1, 2011 at 2:43 AM, TreKing treking...@gmail.com wrote: On Fri, Jul 1, 2011 at 12:11 AM, ragupathi ragupathi ragumm...@gmail.com wrote: im new one for in android. im developing one application. im using database if i calling new activity to store the values in database it working fine. but when i came back to previous activity it not reloaded that previous activity. it will display same as old content. i need when im clicking back button it reloaded (refresh) all content in the activity.. can any one help me pls.. Look at startActivityForResult(). - 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 3.5 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] back button problem
hi every one, im new one for in android. im developing one application. im using database if i calling new activity to store the values in database it working fine. but when i came back to previous activity it not reloaded that previous activity. it will display same as old content. i need when im clicking back button it reloaded (refresh) all content in the activity.. can any one help me pls.. advance thaks... -- 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] Back button problem
Hi everybody, In my application I am displaying list. I have created ContextMenu. In that there are options like add,remove,back,etc... Now when I select Remove option then I call method deleteRecord(), which delete that list record from database. After that I call method - startActivity(getIntent()); Because of this method activity restarts and list changes are instantly visible to user because in start method I had write code that display the list like. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { sampleDB = this.openOrCreateDatabase(SAMPLE_DBNAME, MODE_PRIVATE, null); Cursor c = sampleDB.rawQuery (SELECT RoomName, SwitchFullName FROM SwitchTable ORDER BY RoomName,null); int count = c.getCount(); System.out.println (Total number of records are+count); if (c != null ) { if (c.moveToFirst()) { do { roomName = c.getString(c.getColumnIndex(RoomName)); switchName = c.getString(c.getColumnIndex(SwitchFullName)); System.out.println (roomName+:+switchName); results.add(roomName+-+switchName); } while (c.moveToNext()); c.close(); } } this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1,results)); } catch (SQLiteException se ) { Log.e(getClass().getSimpleName(), Could not create or Open the database); } finally { //sampleDB.close(); } registerForContextMenu(getListView()); } Now suppose I have list like this Hall - Fan Kitchen - AC Bedroom - tv and suppose I delete record no 1 then list display as following Kitchen - AC Bedroom - tv It looks perfectly well. But suppose I press the back button then list is again display as Hall - Fan Kitchen - AC Bedroom - tv Actually first record is deleted succesfully, but though also it is displayed when I press back button. How to avoid this problem? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Back button problem
Can't you just refresh the listview instead of creating a new Activity? If you instead really want to create a new one, before calling startActivity() call finish(), so that pressing back will skip that old list activity. On Wed, Dec 8, 2010 at 12:08 PM, pramod.deore deore.pramo...@gmail.comwrote: Hi everybody, In my application I am displaying list. I have created ContextMenu. In that there are options like add,remove,back,etc... Now when I select Remove option then I call method deleteRecord(), which delete that list record from database. After that I call method - startActivity(getIntent()); Because of this method activity restarts and list changes are instantly visible to user because in start method I had write code that display the list like. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { sampleDB = this.openOrCreateDatabase(SAMPLE_DBNAME, MODE_PRIVATE, null); Cursor c = sampleDB.rawQuery (SELECT RoomName, SwitchFullName FROM SwitchTable ORDER BY RoomName,null); int count = c.getCount(); System.out.println (Total number of records are+count); if (c != null ) { if (c.moveToFirst()) { do { roomName = c.getString(c.getColumnIndex(RoomName)); switchName = c.getString(c.getColumnIndex(SwitchFullName)); System.out.println (roomName+:+switchName); results.add(roomName+-+switchName); } while (c.moveToNext()); c.close(); } } this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1,results)); } catch (SQLiteException se ) { Log.e(getClass().getSimpleName(), Could not create or Open the database); } finally { //sampleDB.close(); } registerForContextMenu(getListView()); } Now suppose I have list like this Hall - Fan Kitchen - AC Bedroom - tv and suppose I delete record no 1 then list display as following Kitchen - AC Bedroom - tv It looks perfectly well. But suppose I press the back button then list is again display as Hall - Fan Kitchen - AC Bedroom - tv Actually first record is deleted succesfully, but though also it is displayed when I press back button. How to avoid this problem? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- YuviDroid Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget to quickly access your favorite apps and contacts!) http://android.yuvalsharon.net -- 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] Back button problem
Pramod, Move the code that loads data from the database from onCreate to onStart. See this for an explanation: http://developer.android.com/guide/topics/fundamentals.html#actlife ( scroll down to see a very useful flowchart ) -- Kostya 08.12.2010 14:08, pramod.deore пишет: Hi everybody, In my application I am displaying list. I have created ContextMenu. In that there are options like add,remove,back,etc... Now when I select Remove option then I call method deleteRecord(), which delete that list record from database. After that I call method - startActivity(getIntent()); Because of this method activity restarts and list changes are instantly visible to user because in start method I had write code that display the list like. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { sampleDB = this.openOrCreateDatabase(SAMPLE_DBNAME, MODE_PRIVATE, null); Cursor c = sampleDB.rawQuery (SELECT RoomName, SwitchFullName FROM SwitchTable ORDER BY RoomName,null); int count = c.getCount(); System.out.println (Total number of records are+count); if (c != null ) { if (c.moveToFirst()) { do { roomName = c.getString(c.getColumnIndex(RoomName)); switchName = c.getString(c.getColumnIndex(SwitchFullName)); System.out.println (roomName+:+switchName); results.add(roomName+-+switchName); } while (c.moveToNext()); c.close(); } } this.setListAdapter(new ArrayAdapterString(this, android.R.layout.simple_list_item_1,results)); } catch (SQLiteException se ) { Log.e(getClass().getSimpleName(), Could not create or Open the database); } finally { //sampleDB.close(); } registerForContextMenu(getListView()); } Now suppose I have list like this Hall - Fan Kitchen - AC Bedroom - tv and suppose I delete record no 1 then list display as following Kitchen - AC Bedroom - tv It looks perfectly well. But suppose I press the back button then list is again display as Hall - Fan Kitchen - AC Bedroom - tv Actually first record is deleted succesfully, but though also it is displayed when I press back button. How to avoid this problem? -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en