tags:

views:

15

answers:

0

Hi all, I want to open Url when I entered in Edit TExt and when Button is pressed i should get the browser in my app else directly I sg=hould get browser with WebView can anyone clear my problem below is my code

package com.zsl.Bimobile3; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Shared3 extends Activity { private String Uri=null; public static final String PREFS_NAME = "Shared3"; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.case1); final EditText edit=(EditText)findViewById(R.id.EditText01);

    Button connect = (Button)findViewById(R.id.Button01);
    //SharedPreferences setting = getSharedPreferences(PREFS_NAME, Context.MODE_WORLD_WRITEABLE);
    //SharedPreferences.Editor editor = setting.edit();
    connect.setOnClickListener(new OnClickListener(){
        public void onClick(View v) {
            if(edit==null)
            {                   
                Intent intent = new Intent(Shared3.this,WebView3.class);
                startActivity(intent);
        }
            else{
                String test= edit.getText().toString();

            }
                }
    });
    Button cancel = (Button)findViewById(R.id.Button02);
    cancel.setOnClickListener(new OnClickListener(){

        public void onClick(View v) {
            Context context = getApplicationContext();
            Toast toast = Toast.makeText(context,"Enter the URL",5);
            toast.show();
        }

    });
    }

}