Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help needed - Please!

  1. #1
    Junior Member
    Join Date
    Dec 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help needed - Please!

    Hello,

    I a very new to this.. I mean totally new. I am learning how to build an App from an online course (video). I guess the course is older so not everything is the same in the updated version of the Android Studio. In the activity we are supposed to create a Toast. When the instructor types Toast and click on create Toast it automatically adds "MainActivity.this". Mine does not. All I get is Toast.makeText(this, "", Toast.LENGTH_SHORT).show();. So I only get "this". If I try to add MainActivity manually it doesn't seem to work.

    If anyone can help me to understand the problem I would really appreciate it. I am stuck in my progress until I resolve it. Please remember that these few lines of code is all I know, so speak to me like you would to a child...and not a smart one!


    public class MainActivity extends AppCompatActivity {

    public void clickFunction(View view) {

    Toast.makeText(this, "", Toast.LENGTH_SHORT).show();

    EditText myTextField = (EditText) findViewById(R.id.myTextField);

    Log.i("info", myTextField.getText().toString());

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Help needed - Please!

    it doesn't seem to work.
    Please explain.
    If you get error messages, copy the full text and paste it here.

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. help needed!
    By Hannah Smith <3 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 24th, 2014, 03:04 PM
  2. Help needed
    By Unlimit3dInc in forum What's Wrong With My Code?
    Replies: 8
    Last Post: February 10th, 2014, 06:30 AM
  3. Grails Developer Needed - URGENTLY NEEDED *WORK FROM HOME*
    By IngeniumR in forum Paid Java Projects
    Replies: 0
    Last Post: February 5th, 2013, 07:19 AM
  4. help needed again
    By 5achowdhury in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 28th, 2013, 08:06 AM
  5. [SOLVED] Help needed!
    By subhvi in forum Web Frameworks
    Replies: 4
    Last Post: February 18th, 2010, 09:26 AM