Chaos Project

Game Development => Sea of Code => Topic started by: Kiwa on August 29, 2015, 01:06:33 am

Title: Java
Post by: Kiwa on August 29, 2015, 01:06:33 am
Hey guys,

By now I'm sure by now some of you regulars probably know me enough to see my focus always changing.

I've put my RMXP project on a short halt to study programming a bit more seariously. I really want to learn this stuff inside out.
I'm working on an android app in Java to understand classes and such.

I'm trying to use WebView to load a page and inject text into the HTML text boxes. how I would assume to do it is use the textbox or variable name like
box.text
or something. but I can't seem to figure it out.


/* Resources */

package com.mycompany.myapp3;

import android.app.*;
import android.os.*;
import android.view.*;
import android.webkit.*;
import android.widget.*;

/* Main Body */
public class MainActivity extends Activity //used to be "protected" class not "public"
{
public static void main(){
//Toaster popUp = new Toaster();
//popUp.toaster("hello, im in main");

}/*end main Method*/


/* Bundle Initialization */
@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    /* Set myWebView Object */
WebView myWebView = (WebView) findViewById(R.id.webview); //set WebView to myWebView Object.
myWebView.loadUrl("http://google.com");
myWebView.setWebViewClient(new WebViewClient());
CookieManager.getInstance().setAcceptCookie(true);
myWebView.loadUrl("javascript:enable();");
myWebView.loadUrl("javascript: window.confirm('ALERT!');");

/* Set WebView Settings */
WebSettings myWebViewSettings = myWebView.getSettings();
        myWebViewSettings.setJavaScriptEnabled(true);
myWebViewSettings.setDomStorageEnabled(true);
        myWebViewSettings.setAllowFileAccessFromFileURLs(true);
        myWebViewSettings.setAllowUniversalAccessFromFileURLs(true);
Toast.makeText(this, "Bundle initialization Complete!", Toast.LENGTH_LONG).show();

}





/* Start Button */
public void onStartClick(View view){


//Toast.makeText(this, "Start Button was Clicked", Toast.LENGTH_LONG).show();
}

/* Finish Button */
public void onFinishClick(View view){
finish();
}
} /* End of Mainactivity class */

/***********************************************************************************************************/


/* Added class for Toast */
class Toaster extends Activity{
public Toaster(String txt){
Toast.makeText(this, txt, Toast.LENGTH_LONG).show();
}

}


this is the code. some of it is playing around for testing still. but for example I want to insect text into the search bar. or other pages modify drop boxes and auto click buttons.

any guidance would be appreciated.

thanks!