Question

I am trying to build an app that automatically logs you into web mail after entering in a username and password. This is my first time and I've been playing around with some eclipse tutorials and trying to build off them. What I have right now is two .java files one that has two text fields for the user to enter their username and password. once they hit send it loads up the webpage. The problem I am having is that I cant seem to paste the values into the fields in the webpage. I was hoping for someone to help me figure out what I am doing wrong. Any help would be appreciated. (This is the code from the second page that loads the web page and variables. The first page works fine. I am able see the variables using textview.)

    public class DisplayMessageActivity extends Activity {


    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    Intent intent = getIntent();
    String username = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    Intent intent1 = getIntent();
    String password = intent1.getStringExtra(MainActivity.EXTRA_MESSAGE1);

    String url = "#############"; 
    Uri uri = Uri.parse(url);
    Intent i= new Intent(Intent.ACTION_VIEW, uri);
    startActivity(i);

No correct solution

OTHER TIPS

You need to add javascript methods to the webpage you want to insert data into that accepts values and stores them in the form...

WebView wv = ...
wv.loadUrl("javascript:setUsername('"+username+"')");

and in your html page...

function setUsername(username){
    document.loginForm.username.value=username;
}

<form name="loginForm">
   <input name="username" type="text">
</form>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top