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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:11:24+00:00 2026-06-14T20:11:24+00:00

This is my layout <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:tools=http://schemas.android.com/tools android:layout_width=match_parent android:layout_height=match_parent > <net.simonvt.widget.NumberPicker android:id=@+id/numberPicker android:layout_width=wrap_content android:layout_height=wrap_content

  • 0

This is my layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <net.simonvt.widget.NumberPicker
        android:id="@+id/numberPicker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="100dp" >
    </net.simonvt.widget.NumberPicker>

</RelativeLayout>

It shows a custom picker in my app. But I want to show this picker inside a dialog.

This is my custom dialog:

public class NumberPickerCustomDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setMessage("Dialog")
           .setPositiveButton("OK", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
               }
           })
           .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
               }
           }).;
    return builder.create();
}

How can I put my picker in this dialog?

Thank you!

  • 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-14T20:11:25+00:00Added an answer on June 14, 2026 at 8:11 pm

    You need to provide a custom layout to the dialog, to do so grab the LayoutInflater service and use it to inflate your layout.

    public class NumberPickerCustomDialog extends DialogFragment {
    Context context;
    
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        // get context
        context = getActivity().getApplicationContext();
        // make dialog object
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        // get the layout inflater
        LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        // inflate our custom layout for the dialog to a View
        View view = li.inflate(R.layout.my_custom_view, null);
        // inform the dialog it has a custom View
        builder.setView(view);
        // and if you need to call some method of the class
        MyCustomView myView = (MyCustomView) view.findViewById(R.id.custom_id_in_my_custom_view);
        myView.doSome("stuff");
        // create the dialog from the builder then show
        return builder.create();
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my xml: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:tools=http://schemas.android.com/tools android:layout_width=match_parent android:layout_height=match_parent > <SurfaceView android:layout_width=match_parent android:layout_height=10dp android:layout_alignParentBottom=true
This is my layout: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent > <TextView android:id=@+id/textView1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_centerHorizontal=true
This is my xml: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=match_parent android:layout_height=match_parent> <RelativeLayout android:layout_height=fill_parent android:layout_width=fill_parent > <RelativeLayout
I have a layout like this: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical > <include layout=@layout/basicinfo
I have this one layout: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:tools=http://schemas.android.com/tools android:id=@+id/mainContainer android:layout_width=fill_parent android:layout_height=fill_parent > <TextView android:id=@+id/legend
I have this layout: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:layout_gravity=center android:cacheColorHint=#0000 android:background=@layout/selectorgreybutton > <LinearLayout android:orientation=horizontal
I have layout like this: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:background=@drawable/bgr> <RelativeLayout android:layout_width=match_parent android:layout_height=wrap_content android:layout_centerVertical=true
HI there. This is my layout <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent> <ListView android:id=@+id/lv android:layout_width=fill_parent android:layout_height=fill_parent
This is my layout <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical > <TextView
I have a View like this: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical > <ScrollView android:layout_width=fill_parent

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.