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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:40:13+00:00 2026-06-16T18:40:13+00:00

I have an ImageButton: <ImageButton android:id=@+id/nextPageB android:layout_width=50dp android:layout_width=50dp android:layout_alignParentBottom=True android:contentDescription=@string/nextPage android:onClick=NextPage android:src=@drawable/ic_launcher /> This

  • 0

I have an ImageButton:

<ImageButton 
android:id="@+id/nextPageB"
android:layout_width="50dp"
android:layout_width="50dp"
android:layout_alignParentBottom="True"
android:contentDescription="@string/nextPage"
android:onClick="NextPage"
android:src="@drawable/ic_launcher"
/>

This is part of a seperate activity that is started from my main activity:

Intent intent = new Intent(this, BookRead.class);
startActivity(intent);

Once in the new activity I call the NextPage method upon ImageButton click:

public void NextPage(View view)
{
    view.setBackgroud(res.getDrawable(R.Drawable.MyNewImage));
}

‘res’ is defined in my new activity in the onCreate method:

res = this.getResources();

For some reason when I click my ImageButton it changes the background on the ImageButton itself instead of the activity layout.

  • 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-06-16T18:40:15+00:00Added an answer on June 16, 2026 at 6:40 pm

    An imagebutton is also a view, and you are probably passing the imagebutton view to the NextPage method.

    You could either get the correct view by referencing it from XML or do something like view.getParent().

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

Sidebar

Related Questions

I have an Activity with the following image button: <ImageButton android:id=@+id/nextPage android:layout_width=wrap_content android:layout_height=wrap_content android:contentDescription=@string/nextPageString
I have the following imageButton <ImageButton android:id=@+id/header_buttonleft android:layout_width=40dip android:layout_height=40dip android:layout_alignParentLeft=true android:layout_marginLeft=10dip android:layout_marginTop=5dip android:src=@drawable/icon_download android:clickable=true/>
Here I have EditText and ImageButton : <LinearLayout android:layout_width=match_parent android:layout_height=wrap_content android:id=@+id/layout1 android:weightSum=1.0> <EditText android:id=@+id/searchBox
For example i have view which have id : <ImageButton android:id=@+id/imageButtonStart android:layout_width=100dp android:layout_height=100dp />
I have one ImageButton in my xml layout like that : <ImageButton android:id=@+id/tabsButton android:background=@drawable/button
I have an asp:ImageButton with OnClick=Btn_OnClick. In Btn_OnClick I have this line: DataTable dtTable
So I have an asp:imagebutton for lets say loginning into a web site. OnClick
I have this Selector defined: <selector xmlns:android=http://schemas.android.com/apk/res/android> <!-- PRESSED --> <item android:state_pressed=true android:drawable=@drawable/backarrow_blueshiny />
Hello Android Experts, I have the following layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:gravity=center_horizontal> <ImageButton
I have ImageButton with CommandArgument attribute which is having multiple Eval value. When I

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.