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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:51:56+00:00 2026-05-29T07:51:56+00:00

I have post about this before but iv had no luck. this is my

  • 0

I have post about this before but iv had no luck. this is my code that i have at the moment. what i am looking for is. My button on my dialog to simply go back (or close) to the origanl
screen. i have been reading about the back button in android and it just go’s over my head.

java.code

import my.dlog.R;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.view.View.OnClickListener;

public class DlogActivity extends Activity {
/** Called when the activity is first created. */
Dialog dialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
dialog = new Dialog(this);
dialog.setContentView(R.layout.main2);
dialog.setTitle("This is my custom dialog box");
dialog.setCancelable(true);
Button b=(Button)findViewById(R.id.button1);

b.setOnClickListener(new OnClickListener() {
  public void onBackPressed() {
    Intent intent = new Intent(DlogActivity.this, DlogActivity.class);
    startActivity(intent);
    finish();
  }

  public void onClick(View v) {
    dialog.show();
  }
});

 }
}

xml.code

    <Button
    android:id="@+id/btn2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:text="Button" 
    android:onClick="DlogActivity"/>




  <ImageView
  android:layout_width="236dp"
  android:layout_height="220dp"
  android:layout_marginRight="100dp" android:background="@drawable/carsee"/>


  <RelativeLayout
  android:id="@+id/relativeLayout1"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" >
  • 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-29T07:51:57+00:00Added an answer on May 29, 2026 at 7:51 am

    Your code is totally confusing to me. I suspect that you might be confused about the difference between an activity and a dialog. If all you are trying to do is show a dialog on top of your activity, and then return to that activity when the dialog is dismissed, you need dialog.dismiss(). Read this

    If you are trying to achieve something else, please explain.

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

Sidebar

Related Questions

I opend a post about this before but I feel that I can now
This is a follow up to a previous question that I had before about
I have read this post about how to test private methods. I usually do
I've posted about this problem before, but I still haven't found a solution so
UPDATE!! I am sorry for this post, the code I had written for this
I have read the post here about using setTimeout() during intensive DOM processing (using
I have read nearly every single post about the activity not found to handle
From an earlier post about trying to improve my sites performance I have been
I have been asked to post a new question about how to correctly sort
i have this problem to find a particular xml node l have post this

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.