1
package com.quinnco.PakageName;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebView;




public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    WebView myWebView = (WebView) findViewById(R.id.Feed);
    myWebView.loadUrl("link two");
    WebSettings websettings=myWebView.getSettings();
    WebSettings.setJavaScriptEnabled(true);
    WebView myWebView = (WebView) findViewById(R.id.Chat);
    myWebView.loadUrl("link one");
} 

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

<WebView
    android:id="@+id/Chat"
    android:layout_width="fill_parent"
    android:layout_height="175dp"
    android:layout_alignLeft="@+id/Feed"
    android:layout_alignParentTop="true" />

<WebView
    android:id="@+id/Feed"
    android:layout_width="fill_parent"
    android:layout_height="175dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/Chat" />

</RelativeLayout>

I made this so that It wont get stolen just in case All link and pakage names are changed I know that just help wiht the main ActivityMain.Java The two webviews are on the same page and I dont know how to do this. Please help

  • Could you please describe what you are having problems with? – Exoit Sep 08 '13 at 00:23
  • I am trying to make the double Webivew and it says this Duplicate local variable myWebView for WebView myWebView = (WebView) findViewById(R.id.Chat); this line – user2755971 Sep 08 '13 at 00:25

1 Answers1

1

You are trying to use the same name for two different webviews. Change one of them to something else, like myWebView_Bottom or something

Katana24
  • 8,706
  • 19
  • 76
  • 118
  • Hey thanks that worked can you help me with this JAVA Error as well This is the error Multiple markers at this line - Line breakpoint:MainActivity [line: 22] - onCreate(Bundle) - Cannot make a static reference to the non-static method setJavaScriptEnabled(boolean) from the type WebSettings – user2755971 Sep 08 '13 at 00:35
  • @user2755971 this previous question should shed some light on the problem: http://stackoverflow.com/questions/4969171/cannot-make-a-static-reference-to-the-non-static-method – Katana24 Sep 08 '13 at 17:30