Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q]A little help in implementation

OP deathblade

16th February 2014, 11:58 PM   |  #1  
deathblade's Avatar
OP Senior Member
Thanks Meter: 367
 
1,356 posts
Join Date:Joined: Dec 2011
More
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
17th February 2014, 09:31 PM   |  #2  
Member
Thanks Meter: 21
 
88 posts
Join Date:Joined: 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.
17th February 2014, 09:37 PM   |  #3  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,411
 
2,813 posts
Join Date:Joined: Feb 2013
More
Quote:
Originally Posted by EmptinessFiller

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.
18th February 2014, 05:01 AM   |  #4  
deathblade's Avatar
OP Senior Member
Thanks Meter: 367
 
1,356 posts
Join Date:Joined: Dec 2011
More
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
18th February 2014, 05:04 AM   |  #5  
deathblade's Avatar
OP Senior Member
Thanks Meter: 367
 
1,356 posts
Join Date:Joined: Dec 2011
More
Or is there any resources that would be recommended?

Sent from my SGH-I747 using XDA Premium 4 mobile app
18th February 2014, 07:37 AM   |  #6  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,411
 
2,813 posts
Join Date:Joined: Feb 2013
More
Quote:
Originally Posted by deathblade

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: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes