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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:55:40+00:00 2026-05-30T21:55:40+00:00

I got an assignment where I have to implement a custom call forwarding system

  • 0

I got an assignment where I have to implement a custom call forwarding system and was looking for ways of doing so. I decided that Androids own call forwarding looked great and decided that I wanted to prompt the user on an item click on the listview. Basically I want this to pop up when the user clicks an item.

this

Here’s the code in which I’m trying to implement the dialog box :

public class CallForwardActivity extends ListActivity 
{
String[] settingsLabels = {"Viderestillinger", "Altid", "Optaget", "Ingen svar", "Timeout"};
int position;
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  ListView lv = getListView();
  lv.setTextFilterEnabled(true);
  setListAdapter(new ArrayAdapter<String>(this, R.layout.callforward_items, R.id.callforward_item_text, settingsLabels));

  lv.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> parent, View view,
        int position, long id) 
    {
        // Open Dialog Box with an edittext view for setting the correct number to Call forward
        myTextDialog().show() // ???
    }
  });
}


private Dialog myTextDialog() {
    final View layout = View.inflate(this, R.layout.custom_dialog, null);

    final EditText savedText = ((EditText) layout.findViewById(R.id.myEditText));

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setIcon(0);

    builder.setPositiveButton("Save", new Dialog.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
           String myTextString = savedText.getText().toString().trim();
        }
    });
    builder.setView(layout);
    return builder.create();
 }

How do I go about “calling” this method/showing the dialog?

  • 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-30T21:55:41+00:00Added an answer on May 30, 2026 at 9:55 pm

    Use it this way to declare the dialog,

    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
                             builder.setView(//your view)
                               .setPositiveButton("Update", new DialogInterface.OnClickListener() {
                                public void onClick(final DialogInterface dialog, final int id) {
                                    //update click
                                }
                               })
                               .setNeutralButton("Disable", new DialogInterface.OnClickListener() {
                                    public void onClick(final DialogInterface dialog, final int id) {
                                        //disable click
                                    }
                                   })
                               .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                                    public void onClick(final DialogInterface dialog, final int id) {
                                    //cancel click
                                    }
                                   });
    

    And show it in your click listener as follows,

    builder.show();
    

    In the function builder.setView() you have to pass for it a view (layout for example) that consist of textview and edittext and button if you want to make it the same as the figure.

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

Sidebar

Related Questions

I have got an assignment in which I have to implement a AS3 wrapper
I have an assignment for school that is really got the best of me.
I have an assignment and i got a library including an interface class. [InfoItem]
I have got a assignment to develop a IPhone application in HTML 5 &
I'm just learning about C and got an assignment where we have to translate
There are a few concepts about iPhone memory management that have got me confused,
I have got an assignment in VBA where I have to convert an existing
So I've got an assignment that takes two inputs, males and females, and outputs
i have an erd for a school assignment that contains a many to many
I have got this assignment question on HMM and I have solved it. 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.