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 7433271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:35:20+00:00 2026-05-29T09:35:20+00:00

Can some one tell me were i am going wrong. i have three activity’s

  • 0

Can some one tell me were i am going wrong. i have three activity’s that i want to connect togever. This code is my first java file and first xml file. i think my onclick code some where is not right. my end result is that all 3 activity connect with 3 image buttons…thank

java 1.code
package my.hope;

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.ImageView;
    import android.content.Intent;
    public class NewhopeActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ImageView myImage = (ImageView) findViewById(R.id.imageButton1);
    myImage.setOnClickListener(new OnClickListener() {

        intent intent = new intent(Newhopeactivity.this, Act2.class);
        startActivity(intent);

            public void onClick(View v) {
                // TODO Auto-generated method stub

            }
    }  
  );  
} 

}

xml.code

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

    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/bt" />

<ImageButton
    android:id="@id/imageButton1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" 
    android:onClick="Act2"/>

  • 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-29T09:35:21+00:00Added an answer on May 29, 2026 at 9:35 am

    You have to put the startActivity() into the actual onClick() method.

    myImage.setOnClickListener(new OnClickListener() {
    
    
            public void onClick(View v) {
                intent intent = new intent(Newhopeactivity.this, Act2.class);
                startActivity(intent);
            }
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone tell me whats going wrong in this code! testit :- read(Term1), read(Term2),
Can some one tell me how do i display real time in c++. what
Please can some one briefly tell me with example what does the means of
Can someone tell me if I'm just going about the setup the wrong way?
I have a problem with this script, something is going wrong. Rnumer stays undefined.This
Can someone tell me why this processes all the files and then does it
Can someone tell me why this http://hupcapstudios.com/projects/calendar.html won't load in IE? The error message:
Can someone tell me whether MSMQ (using transactions) supports competing consumers? Basically, I have
Can someone tell me how to accomplish this mapping using Fluent NHibernate? It's simply
I'm working on some code that calls a service. This service call could fail

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.