Go to the home screen.

by ipeg . student » Wed, 25 Feb 2009 13:24:31 GMT


Sponsored Links
 Hi All Android Developers.......


                           Thanks for the replaies. I want to go to
the home page of android from my activity. Can anybody tell me how can
i do this? I have tried a lot. Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Romain Guy » Wed, 25 Feb 2009 13:25:44 GMT


 Just press back :)






-- 
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

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Go to the home screen.

by Romain Guy » Wed, 25 Feb 2009 13:25:49 GMT


 Or better yet, press the Home key :)







-- 
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

--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by ipeg . student » Wed, 25 Feb 2009 13:37:20 GMT


 Hello

                   Thanks for the reply. But my question is i have a
exit button. I want to go to the home screen by clicking the button. I
know the onClick() method. Please tell me the method by which i can go
to the home page of android.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        btn4=(Button)findViewById(R.id.bt4);
        btn4.setOnClickListener(new ImageButton.OnClickListener() {
                public void onClick(View v) {




                ????????







                }
                });


i dont want finish() method.

Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by suhas gavas » Wed, 25 Feb 2009 13:39:24 GMT


 hi
onclick just write System.exit(1); and it will do the rest for u

reagrds,
Suhas





--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Zack » Fri, 27 Feb 2009 01:46:20 GMT


 Hi,

I'm trying to do something similar. My app has 3 activities

EULA (checks preference for accepted, so must of the time is not seen)
->
Loading Data ->
Main Activity

If I get to the Main Activity and hit the back button, it goes back to
the loading screen. Now, I'm catching onKeyDown, looking for the back
button code and if I find it would like to use startActivity to launch
the Home Screen. System.exit(1) performs the same thing as the back
button.

Anyone know what class / package I can use in an Intent to launch the
home screen?





--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Zack » Fri, 27 Feb 2009 01:46:31 GMT


 Hi,

I'm trying to do something similar. I have a few activities in my app.
When the app starts it goes from

EULA -> Loading Screen -> Main Activity

If I get to the Main Activity and hit the back button it will go back
to the Loading Screen (which I understand) but now I'm trapping the
onKeyDown for the back button in my Main Activity and would like to
get to the home screen through startActivity()

System.exit(1) as suggested below seems to just restart my Main
Activity. Any suggestions? Thanks!






--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Marco Nelissen » Fri, 27 Feb 2009 02:50:36 GMT


 


You can just have your loading screen and EULA activities call
finish() on themselves when they are done. That way your 'main'
activity becomes the first activity in the chain, and exiting it will
exit your app.

--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Dianne Hackborn » Fri, 27 Feb 2009 11:41:45 GMT


 And for heaven's sake don't call System.exit()!







-- 
Dianne Hackborn
Android framework engineer
hack...@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.

--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by IPEG Student » Fri, 27 Feb 2009 12:23:19 GMT


 






Intent i = *new* Intent();

i.setAction("android.intent.action.MAIN");

i.addCategory("android.intent.category.HOME");

startActivity(i);
I think it can solve your problem.

--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by deepdr...@googlemail.com » Fri, 27 Feb 2009 16:27:39 GMT


 you should just remove it from the Java implementation :-)






--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Zack » Fri, 27 Feb 2009 21:06:58 GMT


 Well, that was simple :) Thanks all. I knew System.exit() was what I
was looking for.

On Feb 27, 3:27am, "deepdr...@googlemail.com"





--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Zack » Fri, 27 Feb 2009 21:07:27 GMT


 Was NOT what I was looking for!







--~--~---------~--~----~------------~-------~--~----~



Go to the home screen.

by Al Sutton » Fri, 27 Feb 2009 21:39:00 GMT


  http://groups.google.com/group/android-developers/browse_thread/thread/fbd891ee591f738d 

Al.
 http://andappstore.com/ 











-- 

* Written an Android App? - List it at  http://andappstore.com/  *

======
Funky Android Limited is registered in England & Wales with the 
company number  6741909. The registered head office is Kemp House, 
152-160 City Road, London,  EC1V 2NX, UK. 

The views expressed in this email are those of the author and not 
necessarily those of Funky Android Limited, it's associates, or it's 
subsidiaries.


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Activity lifecycle problem on Nexus One - onStop not called



No, onStop() should be called when you press either BACK or HOME. For
some reason, it is not doing that in the Nexus One. My best guess is
that it has to do with the Nexus One's home screen implementation, but
that's just a guess.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 2.0 Available!

-- 

2. Raw sound file as ringtone

Hi all,

I am using the following code trying to pull an .mp3 or .ogg file from
my raw directory and saving it to the sd card and activating it as a
ringtone. Although, it keeps failing for some reason or another and
doesnt actually copy the new file to the sdcard.

Any ideas please?

    public boolean saveas(int ressound){
         byte[] buffer=null;
         InputStream fIn =
getBaseContext().getResources().openRawResource(ressound);
         int size=0;

         try {
          size = fIn.available();
          buffer = new byte[size];
          fIn.read(buffer);
          fIn.close();
         } catch (IOException e) {
          // TODO Auto-generated catch block
          return false;
         }

         String path="/sdcard/media/audio/ringtones/";
         String filename="priceringtone"+".ogg";

         boolean exists = (new File(path)).exists();
         if (!exists){new File(path).mkdirs();}

         FileOutputStream save;
         try {
          save = new FileOutputStream(path+filename);
          save.write(buffer);
          save.flush();
          save.close();
         } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          return false;
         } catch (IOException e) {
          // TODO Auto-generated catch block
          return false;
         }

         sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.parse("file://"+path+filename)));

         File k = new File(path, filename);

         ContentValues values = new ContentValues();
         values.put(MediaStore.MediaColumns.DATA, k.getAbsolutePath());
         values.put(MediaStore.MediaColumns.TITLE, "exampletitle");
         values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/ogg");
         values.put(MediaStore.Audio.Media.ARTIST, "cssounds ");
         values.put(MediaStore.Audio.Media.IS_RINGTONE, true);
         values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true);
         values.put(MediaStore.Audio.Media.IS_ALARM, true);
         values.put(MediaStore.Audio.Media.IS_MUSIC, false);

         //Insert it into the database
 
this.getContentResolver().insert(MediaStore.Audio.Media.getContentUriForPath(k.getAbsolutePath()),
values);

         return true;
        }

-- 

3. Need Bluetooth UUID clarification

4. Updating the UI in response to a received broadcast.

5. multiple parameters with rawQuery in sqlite = BUG

6. HTML content on AppWidget

7. How to run a prefs activity from my widget !!