android setting content view twice
<p>I have a general android question about whether or not I can set the content view twice in the same activity. I will post the code here but it is pretty jumbled. I am using a service called swarm for my leader boards and achievements, so a lot of it is just jumble with that. But the problem is with my button called boards towards the bottom. sometimes when I hit the button it just decides to not register as clicked and close out the current activity.</p>

<pre><code>    public class WholettheballoutActivity extends SwarmActivity {
    GLView view;
    public GLRenderer renderer;
    public static int level = 4;
    public LinearLayout parentView;
    public Handler handle;
    public SwarmLeaderboard leaderboard;
    public Map achievements;

    GotLeaderboardCB callback = new GotLeaderboardCB() {
        public void gotLeaderboard(SwarmLeaderboard leaderboard1) {
            // Save the leaderboard for later use...
            leaderboard = leaderboard1;
        }
    };

    GotAchievementsMapCB callback2 = new GotAchievementsMapCB() {
        public void gotMap(Map&lt;Integer, SwarmAchievement&gt; achievements1) {
            // Store the map of achievements somewhere to be used later.
            achievements =  achievements1;
        }
    }; 

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.score);
        view = (GLView) findViewById(R.id.mySurfaceView);

        parentView = (LinearLayout) findViewById(R.id.parent);

        handle = new Handler(new Handler.Callback(){
            @Override
            public boolean handleMessage(Message msg){
                // message is handled by the UI thread
                if (!Swarm.isLoggedIn()) {
                    Swarm.init(WholettheballoutActivity.this, 240, "66e982c9795ca5871cc48b0dd34cdabe");
                }

                TextView tv = (TextView) findViewById(R.id.textView2);
                String temp = msg.obj.toString();
                tv.setText(temp);

                if (renderer.time==0) {
                    SwarmAchievement.getAchievementsMap(callback2);
                    // Make sure that we have our achievements map.
                    if (level &lt; 11) {
                        if (achievements != null) {
                            // Grab the achievement from our map.
                            SwarmAchievement achievement =  (SwarmAchievement) achievements.get(592 + level);
                            // No need to unlock more than once...
                            if (achievement != null &amp;&amp; achievement.unlocked == false) {
                                achievement.unlock();
                            }
                        }
                    }
                    WholettheballoutActivity.level+=1;
                    //NewLevelActivity.time= 30;
                    Intent newLevel = new Intent(WholettheballoutActivity.this,NewLevelActivity.class);
                    startActivityForResult(newLevel, 1);
                    renderer.time= (level * 10);
                }
                if (view.renderer.B.numBalls == 0) {
                    SwarmAchievement.getAchievementsMap(callback2);
                    if (view.renderer.points &gt; 10000) {
                        if (achievements != null) {
                            // Grab the achievement from our map.
                            SwarmAchievement achievement =  (SwarmAchievement) achievements.get(603);
                            // No need to unlock more than once...
                            if (achievement != null &amp;&amp; achievement.unlocked == false) {
                                achievement.unlock();
                            }
                        }
                        if (view.renderer.points &gt; 25000) {
                            if (achievements != null) {
                                // Grab the achievement from our map.
                                SwarmAchievement achievement =  (SwarmAchievement) achievements.get(604);
                                // No need to unlock more than once...
                                if (achievement != null &amp;&amp; achievement.unlocked == false) {
                                    achievement.unlock();
                                }
                            }
                            if (view.renderer.points &gt; 50000) {
                                if (achievements != null) {
                                    // Grab the achievement from our map.
                                    SwarmAchievement achievement =  (SwarmAchievement) achievements.get(605);
                                    // No need to unlock more than once...
                                    if (achievement != null &amp;&amp; achievement.unlocked == false) {
                                        achievement.unlock();
                                    }
                                }
                                if (view.renderer.points &gt; 100000) {
                                    if (achievements != null) {
                                        // Grab the achievement from our map.
                                        SwarmAchievement achievement =  (SwarmAchievement) achievements.get(606);
                                        // No need to unlock more than once...
                                        if (achievement != null &amp;&amp; achievement.unlocked == false) {
                                            achievement.unlock();
                                        }
                                    }
                                }
                            }
                        }
                    }
                    level = 1;
                    setContentView(R.layout.score_page);
                    final Button play =  (Button) findViewById(R.id.button1);
                    final Button boards =  (Button) findViewById(R.id.boards);
                    TextView score = (TextView) findViewById(R.id.textView2);
                    score.append("Score: " + view.renderer.points);
                    play.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                            WholettheballoutActivity.this.finish();
                        }
                    });

                    boards.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                            SwarmLeaderboard.getLeaderboardById(193, callback);
                            // First, make sure that we have our leaderboard.
                            if (!Swarm.isLoggedIn()) {
                                Swarm.init(WholettheballoutActivity.this, 240, "66e982c9795ca5871cc48b0dd34cdabe");
                            }
                            if (leaderboard != null) {
                                // Submit our score
                                leaderboard.submitScore(view.renderer.points);
                            }
                            if (leaderboard != null) {
                                leaderboard.showLeaderboard();
                            } 
                            WholettheballoutActivity.this.finish();
                        }
                    });
                }
                return true;
            }
        });
        renderer = new GLRenderer(this, parentView, handle);
        view.setRenderer(renderer);
        view.renderer = renderer;

        // You can use a FrameLayout to hold the surface view
        /* FrameLayout frameLayout = new FrameLayout(this);
        frameLayout.addView(view);
        // Then create a layout to hold everything, for example a RelativeLayout
        RelativeLayout relativeLayout= new RelativeLayout(this);
        relativeLayout.addView(frameLayout);
        setContentView(relativeLayout);*/
}
</code></pre>
