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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:22:50+00:00 2026-06-03T15:22:50+00:00

public class master extends Activity { ProgressDialog progressDialog; EditText tahmini_kelime; EditText girilen_sayi ; EditText

  • 0
public class master extends Activity {
    ProgressDialog    progressDialog;
    EditText tahmini_kelime;
    EditText girilen_sayi ;
    EditText toplam_harf_sayisi ;
    Button tamamdir; 
    TextView jTextArea1;
    Vector vector_all,vect_end,vect,recent_search;
    BufferedReader read;
    String recent_tahmin_kelime; 
    boolean bayrak,bayrak2 ;
    int column_number  ;
    InputStreamReader inputreader ;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         requestWindowFeature(Window.FEATURE_NO_TITLE);
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
           getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.master);
        column_number=0;
        bayrak=true;
          toplam_harf_sayisi=(EditText)findViewById(R.id.toplam_harf);
          tahmini_kelime=(EditText)findViewById(R.id.tahmini_kelime);
          girilen_sayi=(EditText)findViewById(R.id.sayi_gir);
          tamamdir=(Button)findViewById(R.id.tamamdirrrr);
            jTextArea1=(TextView)findViewById(R.id.jte);
            bayrak2=true;




            recent_search = new Vector();
            InputStream  inputStream =  getResources().openRawResource(R.raw.sozluk);
            try {
                  inputreader     = new InputStreamReader(inputStream,"utf-8");
            } catch (UnsupportedEncodingException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            };
            read = new BufferedReader(inputreader);


            int k = 0;
            String result = "";
            try {

                vector_all = new Vector();
                while (read.ready()) {

                    result = read.readLine();
                    vector_all.add(result);
                    jTextArea1.append(result + "\n");
                    k = k + 1;
                }


                String size = "" + k;


            } catch (IOException ex) {
            }




          tamamdir.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {




                if( bayrak2 )
                {  
                    if(Integer.parseInt(toplam_harf_sayisi.getText().toString())>8 || Integer.parseInt(toplam_harf_sayisi.getText().toString())<=1)
                    { 
                            toplam_harf_sayisi.setText("");
                            Dialog  dl=new Dialog(master.this);
                            dl.setTitle("hatalı giriş");
                            dl.setCanceledOnTouchOutside(true);
                            dl.show(); 
                            return;
                    }


                     int findwordlength = Integer.parseInt(toplam_harf_sayisi.getText().toString());

                        int k = 0;
                        String result = "";
                        jTextArea1.setText("");
                        InputStream  inputStream =  getResources().openRawResource(R.raw.sozluk);
                        try {
                              inputreader     = new InputStreamReader(inputStream,"utf-8");
                        } catch (UnsupportedEncodingException e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                        };
                        read = new BufferedReader(inputreader);

                        String resultword = "";
                        try {

                            vect = new Vector();



                             while (read.ready()) {

                                result = read.readLine();

                                if (result.length() == findwordlength) {

                                    vect.addElement(result);
                                    resultword = resultword + result + "\n";
                                    k = k + 1;
                                }
                                jTextArea1.setText("");
                            }



                            jTextArea1.append(resultword + "\n");

                            RandomKelime(vector_all,0 );



                        } catch (IOException ex) {
                        }

                        toplam_harf_sayisi.setEnabled(false);
                        girilen_sayi.setEnabled(true);
                        bayrak2=false;
                }
                else
                { 

                    progressDialog = ProgressDialog.show(master.this, "Bir Düşüneyim :D", "lütfen bekleyiniz...");
                    Thread thread = new Thread(new Runnable() {
                        public void run() {


                     mainGuessWord(column_number);


                     handler.sendEmptyMessage(0);
                        }
                    });
                    thread.start();  

                     girilen_sayi.setText("");

                         }



                        }




        });





    }

    private void mainGuessWord(int look) {
        int result_int = 0;
        String randomword = "";
        int randomword2 = 0;


        randomword = tahmini_kelime.getText().toString();


            result_int = Integer.parseInt(girilen_sayi.getText().toString());


        if (result_int == 0) {
            mevcut_degil(vect, randomword);
        } else {
            elemeAgaci(vect, randomword, result_int);
        }

    }


    public void elemeAgaci(Vector vect, String elem, int length) {
        String word = elem.toString();
        Vector cmp_vect;
        cmp_vect = new Vector();
        vect_end = new Vector();
        int count = 0;
        int countword = 0;  // toplam word sayısı
        int each_word_total = 0; // her kelimede bulunan harf sayısı
        jTextArea1.setText("");

            String compare = "";
            for (int i = 0; i < vect.size(); i++) {
                each_word_total = 0;
                compare = "";
                for (int j = 0; j < word.length(); j++) {

                    if(!compare.contains(""+word.charAt(j)))
                    {
                   for (int k = 0; k < vect.get(i).toString().length(); k++) {
                        if (vect.get(i).toString().charAt(k) == word.charAt(j)) {
                            each_word_total++;

                        }

                    }


                   compare=""+compare+word.charAt(j);
                    }

                }
                System.out.println("" + vect.get(i) + "  =>  " + each_word_total);

                if (length == each_word_total) {
                    cmp_vect.add(vect.get(i));
                    jTextArea1.append(vect.get(i) + "\n");
                    countword++;
                }

            }


            vect.clear();
            for (int l = 0; l < cmp_vect.size(); l++) {
                vect.add(cmp_vect.get(l));
            }




        if (countword == 1) {
                Dialog  dl=new Dialog(master.this);
                dl.setTitle("The Word id : "+jTextArea1.getText().toString());
                dl.setCanceledOnTouchOutside(true);
                dl.show(); 

        } else {
            column_number = column_number + 1;
            if(vect.size()<10){
            RandomKelime_Table(vect);
            }else{
            RandomKelime(vector_all, column_number);
            }
        }
    }

    public void mevcut_degil(Vector vect, String m) {
        char control[];
        control = m.toCharArray();
        boolean flag = false;
        int countword = 0;
        Vector detect;
        detect = new Vector();

        jTextArea1.setText("");
        for (int k = 0; k < vect.size(); k++) {
            flag = false;
            for (int s = 0; s < control.length; s++) {
                if (vect.get(k).toString().contains("" + control[s])) {
                    flag = true;
                }

            }
            if (!flag) {
                detect.addElement(vect.get(k));
                countword = countword + 1;
            }

        }
        vect.clear();
        for (int s = 0; s < detect.size(); s++) {
            vect.addElement(detect.get(s));
        }
        for (int a = 0; a < countword; a++) {
            jTextArea1.append(vect.get(a).toString() + "\n");
        }

        if (countword == 1) {
                Dialog  dl=new Dialog(master.this);
                dl.setTitle("The Word id : "+jTextArea1.getText().toString());
                dl.setCanceledOnTouchOutside(true);
                dl.show();
        } 

        else {
            column_number = column_number + 1;
            RandomKelime(vect, column_number);
        }
    }





    public void RandomKelime(Vector vector, int k)
    {
        String sesli[]={"a","e","ı","i","o","ö","u","ü"};

        Random a = new Random();

        if (k == 0) { 
            String passedword = "";
            passedword = vector_all.get((int) (Math.random() * vector_all.size())).toString();

            while (passedword.length() < 8) {
                passedword = vector_all.get((int) (Math.random() * vector_all.size())).toString();

            }

            tahmini_kelime.setText(passedword);
            recent_tahmin_kelime=passedword;

       // jTable1.setValueAt(vector_all.get((int) (Math.random() * vector_all.size())), k, 0);
        } else {
        recent_search.addElement(recent_tahmin_kelime );
        int say = 0;
        String design = "";
        String guess_words = "";
        String as="";
        int f=0;
        int count=0;
        int calculate_all=0;

        for (int u = 0; u < recent_search.size(); u++) {
        design = recent_search.get(u).toString();
        bayrak = false;
        as="";
        count=0;
        for(int  s=0;s<sesli.length;s++)
        {
        if(design.contains(""+sesli[s]) && count==0){
        as+=""+sesli[s];
        count++;
        }

        }

        guess_words = vector_all.get((int) a.nextInt(vector_all.size())).toString();

           while (guess_words.length() < 8) {
                guess_words = vector_all.get((int) (Math.random() * vector_all.size())).toString();

            }




        while (say < design.length()) {
          calculate_all=0;
        while (guess_words.contains("" + as) && !design.equals(guess_words)) {
        say = 0;
        calculate_all++;
        guess_words = vector_all.get( a.nextInt(vector_all.size())).toString();

          while (guess_words.length() < 8) {
                guess_words = vector_all.get((int) (Math.random() * vector_all.size())).toString();

            }



        f=f+1;
        System.out.println("Tahmın: " + guess_words + " => " + design);
        if(calculate_all>vect.size())
        {
        break;
        }
        }
        say++;
        System.out.println("coutn: " + say);
        }
        }


        if (true) {
        tahmini_kelime.setText(guess_words);
        }


        } 
    } 

     public void RandomKelime_Table(Vector vector ) {
            String passedword = "";
            Random a = new Random();

            try {


            passedword = vect.get(a.nextInt(vect.size())).toString();
            } catch (Exception e) {
                    Dialog  dl=new Dialog(master.this);
                    dl.setTitle("Hatalı Giriş.Yeniden Başlayın.");
                    dl.setCanceledOnTouchOutside(true);
                    dl.show(); 
                yeniden_basla();
            }
            tahmini_kelime.setText(passedword );

     }

     public void yeniden_basla()
     {  
         bayrak2=true;
         girilen_sayi.setEnabled(false);
         toplam_harf_sayisi.setEnabled(true);
         toplam_harf_sayisi.setText("");
         vect.clear();
         vector_all.clear();
         vect_end.clear();
         recent_search.clear();
         jTextArea1.setText("");
         recent_tahmin_kelime="";
         column_number=0;
         bayrak=true;
         InputStream  inputStream =  getResources().openRawResource(R.raw.sozluk);
            try {
                  inputreader     = new InputStreamReader(inputStream,"utf-8");
            } catch (UnsupportedEncodingException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            };
            read = new BufferedReader(inputreader);


            int k = 0;
            String result = "";
            try {

                vector_all = new Vector();
                while (read.ready()) {

                    result = read.readLine();
                    vector_all.add(result);
                    jTextArea1.append(result + "\n");
                    k = k + 1;
                }


                String size = "" + k;


            } catch (IOException ex) {
            }
     }



     private Handler handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {

                progressDialog.dismiss();


            }
        };  



}

this all of my code.

  • 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-03T15:22:51+00:00Added an answer on June 3, 2026 at 3:22 pm

    You don’t show where you create your handler (onCreate ? onStart ? somewhere else ?). Is it started from the main thread ? If so, you need to be provide a more complete stack trace so we can understand.

    If you’re starting it from another thread then that’s the issue because it’s attempting to change progressDialog and that must be done from the main thread.

    PS: if you used an AsyncTask you wouldn’t have to scratch your head around this as it’s designed to do exactly what you want and be thread safe.

    Post comment : use an AsyncThread : add the progress bar in onPreExecute(), change run() to doInBackground() and move the dismiss() to onPostExecute(

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

Sidebar

Related Questions

public class HSPTabletTestActivity extends Activity { private class MyPagerAdapter extends PagerAdapter { public int
package walmart.namespace; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView;
The setText() method returns null in my application why? public class GetValue extends Activity
public abstract class Master { public void printForAllMethodsInSubClass() { System.out.println (Printing before subclass method
In the following master.cs code: public partial class Default : System.Web.UI.MasterPage { protected void
Consider the following example: public class Sandbox { public interface Listener<T extends JComponent> {
public class Bird { private static int id = 0; private String kind; public
public class MyClass { public int Age; public int ID; } public void MyMethod()
public class Test { public static void main(String[] args) { } } class Outer
public class Item { ... } public class Order { public List<Item> Items ...

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.