[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Help with Basic Java Code (braces)

Posted on 2010-09-03
4
Medium Priority
?
329 Views
Last Modified: 2013-11-23
Hi There,

Google Android basic development

For the life of me i can't get the braces to close properly in this code, can someone please help and show how the braces should be closed.

Thanks
package com.button;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;


public class button extends Activity {
	Button mybutton;
	TextView mylabel;
	WebView mwebview;
    /** Called when the activity is first created. */
    @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
     
       
   mybutton.setOnClickListener(new View.OnClickListener(){
        
   
      public void onClick(View v){
        		 mwebview = (WebView) findViewById(R.id.webview);
        		    mwebview.getSettings().setJavaScriptEnabled(true);
        		    mwebview.loadUrl("http://www.google.com");
      
      			}			
   }
   

Open in new window

                     
              
0
Comment
Question by:auschoc
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 33595152
public class button extends Activity {
      Button mybutton;
      TextView mylabel;
      WebView mwebview;

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

            mybutton.setOnClickListener(new View.OnClickListener() {

                  public void onClick(View v) {
                        mwebview = (WebView) findViewById(R.id.webview);
                        mwebview.getSettings().setJavaScriptEnabled(true);
                        mwebview.loadUrl("http://www.google.com");

                  }
            });

      }
}
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 33595160
try,
package com.button;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;


public class button extends Activity {
		Button mybutton;
		TextView mylabel;
		WebView mwebview;

		/** Called when the activity is first created. */
	   @Override
	   public void onCreate(Bundle savedInstanceState) {
		   super.onCreate(savedInstanceState);
		   setContentView(R.layout.main);
     
       
	   mybutton.setOnClickListener(new View.OnClickListener(){			
	   
			public void onClick(View v){
						 mwebview = (WebView) findViewById(R.id.webview);
							mwebview.getSettings().setJavaScriptEnabled(true);
							mwebview.loadUrl("http://www.google.com");
			  
			}			
	   	   
		}
   
	 }
}

Open in new window

0
 

Author Closing Comment

by:auschoc
ID: 33595174
Thanks!

could you possibly give me some advice when the following brace is needed

});
0
 
LVL 92

Expert Comment

by:objects
ID: 33595213
following marks where they were opened

            mybutton.setOnClickListener1(new View.OnClickListener() 2{

                  public void onClick(View v) {
                        mwebview = (WebView) findViewById(R.id.webview);
                        mwebview.getSettings().setJavaScriptEnabled(true);
                        mwebview.loadUrl("http://www.google.com");

                  }
            }2)1;
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, people trade privacy and security for convenience. However in today's concrete jungle, this is an extremely foolish decision considering the vast amount of technologies being used against consumer interest. First off, I won't waste any time e…
The case of the missing phone talks about the way a small electronic gadget (the mobile phone) has penetrated into our lives and has made us addicted to it.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question