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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:48:33+00:00 2026-06-17T20:48:33+00:00

This is the top half of the class that hosts the dialog. import android.app.Activity;

  • 0

This is the top half of the class that hosts the dialog.

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MovieAdd extends Activity {

private EditText mTitleText;
private Button mSavebutton;
private Long mRowId;
private MyMoviesDBAdapter mDbHelper;
private String genrename;
private TextView mGenretext;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.getWindow().setSoftInputMode     (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

    mDbHelper = new MyMoviesDBAdapter(this);

    setContentView(R.layout.add_movie_dialog);


    mTitleText = (EditText) findViewById(R.id.mMovietitle);
    mGenretext = (TextView) findViewById(R.id.genre_text);


    mSavebutton = (Button) findViewById(R.id.mSavebutton);

    mRowId = savedInstanceState != null ? savedInstanceState.getLong(MyMoviesDBAdapter.KEY_ROWID) 
        : null;

    registerButtonListeners();
    onCreateDialog(savedInstanceState);

}

the problem is that when I use this code, the TextView is always set to “Thriller” the “which” variable seems to always be initializing to 14. I’m not even sure this is the best method to achieve what I am trying to do as later, after the dialog is closed, the “genrename” variable is then passed into a database.

 public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(MovieAdd.this);
    builder.setTitle(R.string.select_genre);
           builder.setItems(R.array.genres, new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int which) {
               // The 'which' argument contains the index position
               // of the selected item

            switch(which) {
                case 0:
                    genrename = "Action";
                case 1:
                    genrename = "Anime";
                case 2:
                    genrename = "Childrens";
                case 3:
                    genrename = "Classics";
                case 4:
                    genrename = "Comedy";
                case 5:
                    genrename = "Cult";
                case 6:
                    genrename = "Documentary";
                case 7:
                    genrename = "Drama";
                case 8:
                    genrename = "Foreign";
                case 9:
                    genrename = "Horror";
                case 10:
                    genrename = "Music";
                case 11:
                    genrename = "Romance";
                case 12:
                    genrename = "Sci-fi";
                case 13:
                    genrename = "Sports";
                case 14:
                    genrename = "Thriller";                 
                }
            mGenretext.setText(genrename);

           }
    });


    return builder.show();
}
  • 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-17T20:48:34+00:00Added an answer on June 17, 2026 at 8:48 pm

    Use break in every case of switch else the control will fall down to last case.For that reason only it is showing only Thriller.

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

Sidebar

Related Questions

I have a varchar column that has data like this top<somenumber> so the word
I know that in standard SQL you can do this: update top (100) table1
I am trying to show Google Map on the Top Half of the Android
The idea of this function is to fade the top half only of the
I am using this sliding top panel using mootools (for orientation, the code is
My current method is this: SELECT TOP 1 ID FROM DATAENTRY ORDER BY ID
I have a sql like this: SELECT TOP 1 field_name * FROM table_name and
So I have something like this: module top (..., out,...); ... output [0:1] out;
Putting this at the top of your CSS file: * { margin: 0; padding:
Update Putting this at the top because it is crazy :) So some users

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.