Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,770,637 Members 39,064 Now Online
XDA Developers Android and Mobile Development Forum

[Q]A little help in implementation

Tip us?
 
deathblade
Old
#1  
deathblade's Avatar
Senior Member - OP
Thanks Meter 363
Posts: 1,338
Join Date: Dec 2011
Default [Q]A little help in implementation

Hi I am making my first app, a launcher, I have to questions

1. I have it setup to return to home screen from app drawer but it also refreshes the whole main activity the code I have in place for this is:

[Code] @override public void onBackPressed() { super.onBackPressed(); setContentView(R.layout.activity_main); [code]

Is there a better way to do this(without refreshing the main activity) if so can someone point me in the right direction


2. What is the best way to implement page viewer for more home screens or is there a better way to do this as well?

I appreciate all and any response and help and thank anyone willing to lend a hand

Sent from my SGH-I747 using XDA Premium 4 mobile app
 


Google Nexus 7 (2013)
Rom:Sinless/Vanir (via Multirom)

Samsung Galaxy S III SGH-I747
Rom: Vanir 4.4.2

Samsung SGH-i977 Infuse 4G

LINKS:
MY SLIDING MESSAGING THEMES ARE LOCATED HERE
 
EmptinessFiller
Old
#2  
Member
Thanks Meter 21
Posts: 88
Join Date: Sep 2013
I think a launcher is definitely not an app a beginner should code.
But to your question: I guess you should leave super.onBackPressed() out.
 
nikwen
Old
#3  
nikwen's Avatar
Recognized Contributor
Thanks Meter 1307
Posts: 2,700
Join Date: Feb 2013
Quote:
Originally Posted by EmptinessFiller View Post
I think a launcher is definitely not an app a beginner should code.
But to your question: I guess you should leave super.onBackPressed() out.
Well, I think it depends on which kind of launcher he creates. If it is no fancy 3D launcher, I think of it as a better project for a beginner than a project that involves Server interaction. There are special, easy launchers which are designed for children as well.
 
deathblade
Old
#4  
deathblade's Avatar
Senior Member - OP
Thanks Meter 363
Posts: 1,338
Join Date: Dec 2011
Its no 3d or nothing really fancy the idea I have is a very simplistic and minimal launcher with just basic launcher features, the ui will be very similar to other launchers but yet different, so no other suggestions on how to implement closing app drawer when back button is pressed?

Sent from my SGH-I747 using XDA Premium 4 mobile app
 


Google Nexus 7 (2013)
Rom:Sinless/Vanir (via Multirom)

Samsung Galaxy S III SGH-I747
Rom: Vanir 4.4.2

Samsung SGH-i977 Infuse 4G

LINKS:
MY SLIDING MESSAGING THEMES ARE LOCATED HERE
 
deathblade
Old
#5  
deathblade's Avatar
Senior Member - OP
Thanks Meter 363
Posts: 1,338
Join Date: Dec 2011
Or is there any resources that would be recommended?

Sent from my SGH-I747 using XDA Premium 4 mobile app
 


Google Nexus 7 (2013)
Rom:Sinless/Vanir (via Multirom)

Samsung Galaxy S III SGH-I747
Rom: Vanir 4.4.2

Samsung SGH-i977 Infuse 4G

LINKS:
MY SLIDING MESSAGING THEMES ARE LOCATED HERE
 
nikwen
Old
#6  
nikwen's Avatar
Recognized Contributor
Thanks Meter 1307
Posts: 2,700
Join Date: Feb 2013
Quote:
Originally Posted by deathblade View Post
Its no 3d or nothing really fancy the idea I have is a very simplistic and minimal launcher with just basic launcher features, the ui will be very similar to other launchers but yet different, so no other suggestions on how to implement closing app drawer when back button is pressed?

Sent from my SGH-I747 using XDA Premium 4 mobile app
I would create two Fragments, one for the homescreens and one for the app drawer. Set it up that way that you can use popBackStack() to return to the homescreens from the app drawer.
Very detailed resource on Fragments: http://developer.android.com/guide/c...fragments.html
The Following User Says Thank You to nikwen For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes