Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7643335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:25:22+00:00 2026-05-31T09:25:22+00:00

I have a small app that when button presses navigates when moving from main

  • 0

I have a small app that when button presses navigates when moving from main screen to next screen this works fine, but when I added a button on the next page (to go back) it breaks.

Fun.java

package com.forcetechnology.OptusApp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Fun extends Activity {
OnClickListener backListener;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fun);

    Button backButtonf = (Button)findViewById(com.forcetechnology.OptusApp.R.id.backtoMainf);
    backListener = new OnClickListener()
    {           
        public void onClick(View v) 
        {        
         Intent i = new Intent();
         i.setClassName("com.forcetechnology.OptusApp", "com.forcetechnology.OptusApp.OptusAppMain");
                startActivity(i);           
        }
    };
    backButtonf.setOnClickListener(backListener);

   }

}

Fun.Xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >




<ImageButton
    android:id="@+id/backtoMainf"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/val5" />

</LinearLayout>

Main.xml

<ImageButton
    android:id="@+id/funbutton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:background="@drawable/val5"
    android:src="@drawable/val5" />



<ImageButton
    android:id="@+id/executionbutton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/funbutton"
    android:layout_alignParentRight="true"
    android:background="@drawable/val2"
    android:src="@drawable/val2" />



<ImageButton
    android:id="@+id/performancebutton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/executionbutton"
    android:layout_toLeftOf="@+id/funbutton"
    android:background="@drawable/val3"
    android:src="@drawable/val4" />



<ImageButton
    android:id="@+id/innovationbutton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/executionbutton"
    android:layout_alignParentLeft="true"
    android:background="@drawable/val3"
    android:src="@drawable/val3" />



<ImageButton
    android:id="@+id/peoplebutton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/innovationbutton"
    android:layout_toLeftOf="@+id/executionbutton"
    android:background="@drawable/val1"
    android:src="@drawable/val1" />

</RelativeLayout>

OPtusAppMain.java

    package com.forcetechnology.OptusApp;

import android.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

public class OptusAppMain extends Activity 
{
    OnClickListener funListener,executionListener,innovationListener,peopleListener,performanceListener;;
    TextView testView;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(com.forcetechnology.OptusApp.R.layout.main);
        ImageButton funButton = (ImageButton)findViewById(com.forcetechnology.OptusApp.R.id.funbutton);
        ImageButton executionButton = (ImageButton)findViewById(com.forcetechnology.OptusApp.R.id.executionbutton);
        ImageButton innovationButton = (ImageButton)findViewById(com.forcetechnology.OptusApp.R.id.innovationbutton);
        ImageButton peopleButton = (ImageButton)findViewById(com.forcetechnology.OptusApp.R.id.peoplebutton);
        ImageButton performanceButton = (ImageButton)findViewById(com.forcetechnology.OptusApp.R.id.performancebutton);


        funListener = new OnClickListener()
        {           
            public void onClick(View v) 
            {        
                 Intent i = new Intent();
                    i.setClassName("com.forcetechnology.OptusApp", "com.forcetechnology.OptusApp.Fun");
                    startActivity(i);           
            }
        };
        executionListener = new OnClickListener()
        {           
            public void onClick(View v) 
            {        
                 Intent i = new Intent();
                 i.setClassName("com.forcetechnology.OptusApp", "com.forcetechnology.OptusApp.Execution");
                    startActivity(i);          
            }
        };
        innovationListener = new OnClickListener()
        {           
            public void onClick(View v) 
            {        
                 Intent i = new Intent();
                 i.setClassName("com.forcetechnology.OptusApp", "com.forcetechnology.OptusApp.Innovation");
                    startActivity(i);           
            }
        };
        peopleListener = new OnClickListener()
        {           
            public void onClick(View v) 
            {        
                 Intent i = new Intent();
                 i.setClassName("com.forcetechnology.OptusApp", "com.forcetechnology.OptusApp.People");
                    startActivity(i);           
            }
        };
        performanceListener = new OnClickListener()
        {           
            public void onClick(View v) 
            {        
                 Intent i = new Intent();
                 i.setClassName("com.forcetechnology.OptusApp", "com.forcetechnology.OptusApp.Performance");
                    startActivity(i);         
            }
        };
        funButton.setOnClickListener(funListener);
        executionButton.setOnClickListener(executionListener);
        innovationButton.setOnClickListener(innovationListener);
        peopleButton.setOnClickListener(peopleListener);
        performanceButton.setOnClickListener(performanceListener);
    }




}

Edit: I have traced the error to this line Button backButtonf = (Button)findViewById(com.forcetechnology.OptusApp.R.id.backtoMainf); in fun.java.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:25:24+00:00Added an answer on May 31, 2026 at 9:25 am

    In the onClick() of backListener, just call finish() to go back to the previous activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small app that has a Render thread. All this thread does
I have a small app that downloads some files from a remote (HTTP) server
In my app I have a small custom button that just shows an FB
I have small web app that generate PDF files as a report. I'm trying
I have a relatively small app that Im building using vb.net 2.0, and nant.
I have a small WinForms app that utilizes a BackgroundWorker object to perform a
I have a small helper app that I use to inject scripts into html
I have written a small app that puts my bluetooth in discoverable mode for
So I have a small C# app that needs to periodically check the contents
I have written a small chat app that uses mysql + php to facilitate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.