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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:14:39+00:00 2026-05-31T13:14:39+00:00

How can I make my app keep checking for this? Meaning by keep checking

  • 0

How can I make my app keep checking for this? Meaning by keep checking if there is text in there

String str1, str2;

str1 = word.getText().toString();
str2 = answer.getText().toString();

if(!(str1.equals("")) && !(str2.equals("")))
{
  teach.setEnabled(true);
}
else
{
  teach.setEnabled(false);
}

Here is my java code where would i put the fixed code that makes it check and every thing?? Please help!

public class TeachmeDialog extends Activity implements OnClickListener {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.teachme);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    Button teach = (Button)findViewById(R.id.btn_teach_send);
    teach.setOnClickListener(this);


}



@Override
public void onClick(View v) {
    switch(v.getId())
    {
        case R.id.btn_teach_send:
        {
            // Create a new HttpClient and Post Header
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("http://monaiz.net/get.php");

            String responseStr = "";

            try {
                TextView word = (TextView)findViewById(R.id.tv_teach_request);
                TextView answer = (TextView)findViewById(R.id.tv_teach_response);

                // Add your data
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
                nameValuePairs.add(new BasicNameValuePair("word", word.getText().toString()));
                nameValuePairs.add(new BasicNameValuePair("answer", answer.getText().toString()));
                nameValuePairs.add(new BasicNameValuePair("action", "teach"));
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                HttpResponse response = httpclient.execute(httppost);
                HttpEntity entity = response.getEntity( );

                responseStr = EntityUtils.toString( entity );

            } catch (Exception e) {
                // TODO Auto-generated catch block
            }

            if( responseStr.equals("ok") )
            {
                Toast.makeText(getApplicationContext(), "Poco just learned a new word!", Toast.LENGTH_LONG).show();
                try {
                    this.finish();
                } catch (Throwable e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}

}

  • 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-31T13:14:40+00:00Added an answer on May 31, 2026 at 1:14 pm

    Use TextWatcher instead. Your “word” seems to be an EditText. So you can do something like this-

    word.addTextChangedListener(new TextWatcher() {
    
            @Override
            public void onTextChanged(CharSequence s, int start, int before,
                    int count) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count,
                    int after) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void afterTextChanged(Editable s) {
                      teach.setEnabled(true);
                }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys how can I make an app keep playing an mp3 after pressed
I have an app that can make modify images. In some cases, this makes
Just wondering how I can make my app open automatically at login, but make
The calender app does it... How can I make an app icon change based
A single Rails command can make lots of changes in an app - creating
I have a small app, where user can make some calculations and solve equations.
Ok, let's see if I can make this make sense. I have a program
Background info I have an app where users can make microsites ala http://myname.the_app.com .
We can make Webservice call in android app by creating HttpURLConnection and POST request.
My users can change the Locale within the app (they may want to keep

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.