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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:48:41+00:00 2026-05-27T00:48:41+00:00

Hello all i have a button i am trying to let users share a

  • 0

Hello all i have a button i am trying to let users share a specific sentance that has been created by three wheels that i have in my app this is the code i have so far:

 private void mixWheel(int id) {
    WheelView wheel = getWheel(id);
    wheel.scroll(-25 + (int) (Math.random() * 50), 2000);

    private String getWheelValue(int id) {
        WheelView wheel = getWheel(R.id.passw_1);
        int index = wheel.getCurrentItem();
        ((ArrayWheelAdapter<String>) wheel.getViewAdapter()).getItemText(index).toString();
        String values = getWheelValue(R.id.passw_1) + " " + getWheelValue(R.id.passw_2) + " " + getWheelValue(R.id.passw_3);
        return values;

        Button share = (Button) findViewById(R.id.tweet);
        share.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                emailIntent.setType("text/plain");
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.Subject));
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.Message));
                startActivity(emailIntent);

            }
        });

The problem is after “wheel.scroll(-25 + (int) (Math.random() * 50), 2000);”

I get this error “Syntax error, insert “}” to complete MethodBody”

If i put it after that line of code i then get an error under
“Button share = (Button) findViewById(R.id.tweet);”

Saying: Unreachable code
With qucik fix “Remove” but this just removes everything after that line of code i have posted the full code below just incase. Thanks in advance.

    public class PasswActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);



    setContentView(R.layout.passw_layout);
initWheel(R.id.passw_1, new String[] { "You", "Me", "Us" });
initWheel(R.id.passw_2, new String[] { "Are", "Going", ""Went });
initWheel(R.id.passw_3, new String[] { "There", "Here", ""Away });




    Button mix = (Button) findViewById(R.id.btn_mix);
    mix.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mixWheel(R.id.passw_1);
            mixWheel(R.id.passw_2);
            mixWheel(R.id.passw_3);

        }
    });

}

// Wheel scrolled flag
private boolean wheelScrolled = false;

// Wheel scrolled listener
OnWheelScrollListener scrolledListener = new OnWheelScrollListener() {
    public void onScrollingStarted(WheelView wheel) {
        wheelScrolled = true;
    }

    public void onScrollingFinished(WheelView wheel) {
        wheelScrolled = false;

    }
};

// Wheel changed listener
private OnWheelChangedListener changedListener = new OnWheelChangedListener() {
    public void onChanged(WheelView wheel, int oldValue, int newValue) {
        if (!wheelScrolled) {

        }
    }
};

/**
 * Initializes wheel
 * 
 * @param id
 *            the wheel widget Id
 */
private void initWheel(int id, String[] values) {
    WheelView wheel = getWheel(id);
    wheel.setViewAdapter(new ArrayWheelAdapter<String>(this, values));
    wheel.setCurrentItem((int) (Math.random() * 10));
    wheel.addChangingListener(changedListener);
    wheel.addScrollingListener(scrolledListener);
    wheel.setCyclic(true);
    wheel.setInterpolator(new AnticipateOvershootInterpolator());

}

/**
 * Returns wheel by Id
 * 
 * @param id
 *            the wheel Id
 * @return the wheel with passed Id
 */
private WheelView getWheel(int id) {
    return (WheelView) findViewById(id);

}



/**
 * Tests entered PIN
 * 
 * @param v1
 * @param v2
 * @param v3
 * @param v4
 * @return true
 */
private boolean testPin(int v1, int v2, int v3, int v4) {
    return testWheelValue(R.id.passw_1, v1)
            && testWheelValue(R.id.passw_2, v2)
            && testWheelValue(R.id.passw_3, v3);

}

/**
 * Tests wheel value
 * 
 * @param id
 *            the wheel Id
 * @param value
 *            the value to test
 * @return true if wheel value is equal to passed value
 */
private boolean testWheelValue(int id, int value) {
    return getWheel(id).getCurrentItem() == value;
}



/**
 * Mixes wheel
 * 
 * @param id
 *            the wheel id
 */
private void mixWheel(int id) {
    WheelView wheel = getWheel(id);
    wheel.scroll(-25 + (int) (Math.random() * 50), 2000);

    private String getWheelValue(int id) {
        WheelView wheel = getWheel(R.id.passw_1);
        int index = wheel.getCurrentItem();
        ((ArrayWheelAdapter<String>) wheel.getViewAdapter()).getItemText(index).toString();
        String values = getWheelValue(R.id.passw_1) + " " + getWheelValue(R.id.passw_2) + " " + getWheelValue(R.id.passw_3);
        return values;

        Button share = (Button) findViewById(R.id.tweet);
        share.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                emailIntent.setType("text/plain");
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.Subject));
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.Message));
                startActivity(emailIntent);

            }
        });


 }
 }
  • 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-27T00:48:42+00:00Added an answer on May 27, 2026 at 12:48 am

    Why is your getWheelValue() method inside of mixWheel? Try moving it outside of mixWheel like so, and re-organize your calls

    private void mixWheel(int id) {
        WheelView wheel = getWheel(id);
        wheel.scroll(-25 + (int) (Math.random() * 50), 2000);
    
    
    
    
     }
    
    private String getWheelValue(int id) {
            WheelView wheel = getWheel(R.id.passw_1);
            int index = wheel.getCurrentItem();
            ((ArrayWheelAdapter<String>) wheel.getViewAdapter()).getItemText(index).toString();
            String values = getWheelValue(R.id.passw_1) + " " + getWheelValue(R.id.passw_2) + " " + getWheelValue(R.id.passw_3);
            return values;
    
            Button share = (Button) findViewById(R.id.tweet);
            share.setOnClickListener(new View.OnClickListener() {
    
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                emailIntent.setType("text/plain");
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.Subject));
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.Message));
                startActivity(emailIntent);
    
            }
        });
    
    }
    

    I’m not even sure if that is valid syntax (a method within a method) – someone correct me if I am wrong.

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

Sidebar

Related Questions

hello all I have a small dialog which I created dynamically, which has a
All, I have a view that has a label and a text box (no
Hello all I have class that inherited from Qtreeview and I implement simple (
Problem Hello all! I have this code which takes my jpg image loops through
Hello i'm trying to use autocomplete dropdownlist plugin that name is ufd. Anyway, I
Hello friends i have a form view i have handele all needed events successfully
Hello mates i have a page View All Applicants.aspx with gridview and a link
Currently using Telerik ASP .NET MVC Controls version 2011.2.712 Hello all, I am trying
Hello all i have a simple problem i have a alertDialog and i want
Hello all i have a wheel picker working but at the moment it is

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.