Hello guys, I have been teaching my self to "code" in the android language and java over the past few day. So I am new to this so please be patient.
Basically, my problem is I am trying to get a button on my form to open a web page.
Here is my java file.
I am getting errors on the following lines in order:
Line 15
- Button cannot be resolved to a type
Line 16
- Syntax error on token "}", { expected
Line 18
- View cannot be resolved to a type
Line 23
- Syntax error, insert "}" to complete MethodBody and Line breakpoint:WalmartSchedule [line: 23] - onCreate
Line 25
- Syntax error, insert ";" to complete BlockStatements and Cannot make a static reference to the non-static method loadUrl(String) from the type WebView
Line 26
- Syntax error, insert "}" to complete ClassBody
Here is my main.xml
Any help would be greatly appriciated!
Basically, my problem is I am trying to get a button on my form to open a web page.
Here is my java file.
Code:
package com.error33.test;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
public class test extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button loginBtn = (Button) findViewById(R.id.login_Button);
}
}
loginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View pV) {
LoginActivity.this.login();
}
});
private void login() {
WebView.loadUrl("http://www.google.com")
}
Line 15
Code:
Button loginBtn = (Button) findViewById(R.id.login_Button)
Line 16
Code:
}
Line 18
Code:
loginBtn.setOnClickListener(new View.OnClickListener() {
Line 23
Code:
});
Line 25
Code:
WebView.loadUrl("http://www.google.com")
Line 26
Code:
}
Here is my main.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="@+id/widget0"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<Button
android:id="@+id/login_Button"
android:layout_width="300px"
android:layout_height="wrap_content"
android:text="Goto Login Page"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#ffffff00"
android:layout_x="10px"
android:layout_y="120px"
>
</Button>
<Button
android:id="@+id/schedule_Button"
android:layout_width="300px"
android:layout_height="wrap_content"
android:text="View Schedule"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="#ffffff00"
android:layout_x="10px"
android:layout_y="297px"
>
</Button>
<TextView
android:id="@+id/Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wal-Mart Schedule"
android:textSize="25sp"
android:typeface="sans"
android:textStyle="bold"
android:textColor="#ff0033ff"
android:layout_x="40px"
android:layout_y="36px"
>
</TextView>
<EditText
android:id="@+id/monthInput"
android:layout_width="50px"
android:layout_height="wrap_content"
android:text="#"
android:textSize="18sp"
android:layout_x="48px"
android:layout_y="220px"
>
</EditText>
<EditText
android:id="@+id/dayInput"
android:layout_width="50px"
android:layout_height="wrap_content"
android:text="#"
android:textSize="18sp"
android:layout_x="131px"
android:layout_y="220px"
>
</EditText>
<EditText
android:id="@+id/yearInput"
android:layout_width="70px"
android:layout_height="wrap_content"
android:text="#"
android:textSize="18sp"
android:layout_x="210px"
android:layout_y="220px"
>
</EditText>
<TextView
android:id="@+id/monthTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Month"
android:layout_x="50px"
android:layout_y="190px"
>
</TextView>
<TextView
android:id="@+id/dayTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Day"
android:layout_x="141px"
android:layout_y="190px"
>
</TextView>
<TextView
android:id="@+id/yearTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Year"
android:layout_x="227px"
android:layout_y="190px"
>
</TextView>
<TextView
android:id="@+id/widget224"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Created by: "
android:layout_x="149px"
android:layout_y="410px"
>
</TextView>
</AbsoluteLayout>