RE: [android-developers] Web View Error

2011-08-25 Thread Lakshmi Priya
Hi Mark:

I am trying to locate this.  Could you confirm if the code is ok.

Thanks
..Priya

-Original Message-
From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Mark Murphy
Sent: Wednesday, August 24, 2011 10:45 PM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Web View Error

Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
LogCat and look at the stack trace associated with your error.

On Wed, Aug 24, 2011 at 1:12 PM, Lakshmi Priya
 wrote:
> Hi all:
>
>
>
> Please see attached the code I have written for web view..When I run the
> code I get the following error every time.
>
>
>
> Sorry The application WebViewDemo(process org.example.webviewdemo)has
> stopped unexpectedly.Please try again.
>
>
>
> Can someone help me please.
>
>
>
> Thanks
>
> ..Priya
>
>
>
> lakshmi_pr...@simply-logic.com
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Web View Error

2011-08-24 Thread Lakshmi Priya
Hi all:

 

Please see attached the code I have written for web view..When I run the
code I get the following error every time.

 

Sorry The application WebViewDemo(process org.example.webviewdemo)has
stopped unexpectedly.Please try again.

 

Can someone help me please.

 

Thanks

..Priya

 

lakshmi_pr...@simply-logic.com

 

 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=enpackage org.example.webviewdemo;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;


public class WebViewDemoActivity extends Activity {
private WebView webView;
private EditText urlField;
private Button search;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

 // Create reference to UI elements
webView  = (WebView) findViewById(R.id.webview_compontent);
webView.setWebChromeClient(new WebChromeClient());
   // webView.setWebViewClient(new HelloWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.google.com/";);
//urlField = (EditText)findViewById(R.id.url);


// workaround so that the default browser doesn't take over
webView.setWebViewClient(new MyWebViewClient());

// Setup click listener
search = (Button)findViewById(R.id.Search);
search.setOnClickListener( new OnClickListener() {
public void onClick(View view) {
openURL();
}
});

// Setup key listener
urlField.setOnKeyListener( new OnKeyListener() {
public boolean onKey(View view, int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_ENTER) {
openURL();
return true;
} else {
return false;
}
}
});
 
}

/** Opens the URL in a browser */
private void openURL() {
webView.loadUrl(urlField.getText().toString());
//webView.requestFocus();
}

private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;

}
public void onClick(View v)
{

String url=null;
// TODO Auto-generated method stub
// Otherwise, the link is not for a page on my site, so launch another 
Activity that handles URLs
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
//return true;

}
}
}
http://schemas.android.com/apk/res/android";
  package="org.example.webviewdemo"
  android:versionCode="1"
  android:versionName="1.0">













http://schemas.android.com/apk/res/android";
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>


  
   










  







[android-developers] Link to a website...

2011-08-08 Thread Lakshmi Priya
I am developing an app in android and the search button in the
application needs to be linked to a website. Can anyone help me with
this...

I have pasted the code below...

package com.apache;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class ApacheConnection extends Activity {

Button bt;
TextView textView1;
TextView textView2;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt = (Button) findViewById(R.id.button1);
textView1 = (TextView) findViewById(R.id.editText1);
textView2 = (TextView) findViewById(R.id.editText2);
bt.setOnClickListener(new OnClickListener() {
  @Override
public void onClick(View v) {
// TODO Auto-generated method stub
textView2.setText("");

 try {
/*Apache HttpClient Library*/
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://google.com";);
HttpResponse response = client.execute(request);
/* response code*/
BufferedReader rd = new BufferedReader(
  new
InputStreamReader(response.getEntity().getContent()));
   String line = "";
while ((line = rd.readLine()) != null) {
  Log.d("output:",line);
   }
  } catch (Exception exe) {
   exe.printStackTrace();
  }
}
 });

}
}

http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>



http://www.nancybishop.com/";
android:layout_height="wrap_content">



 



 



Thanks a lot
P

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: http connection to display a webpage

2011-08-08 Thread Lakshmi Priya


On Aug 8, 10:39 am, Ratheesh Valamchuzhy  wrote:
> Hi Arun
>
> While sending an http request we cant get (display the webpage)  we get a
> response such as xml or json , we need to parse the response and retrive th
> edata as needed.   if u want to display the we page u can use webview.
>
> thanks

Hi

Please let me know if the code below will link to a website or should
we use web view...

package com.apache;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class ApacheConnection extends Activity {

Button bt;
TextView textView1;
TextView textView2;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt = (Button) findViewById(R.id.button1);
textView1 = (TextView) findViewById(R.id.editText1);
textView2 = (TextView) findViewById(R.id.editText2);
bt.setOnClickListener(new OnClickListener() {
  @Override
public void onClick(View v) {
// TODO Auto-generated method stub
textView2.setText("");

 try {
/*Apache HttpClient Library*/
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://google.com";);
HttpResponse response = client.execute(request);
/* response code*/
BufferedReader rd = new BufferedReader(
  new
InputStreamReader(response.getEntity().getContent()));
   String line = "";
while ((line = rd.readLine()) != null) {
  Log.d("output:",line);
   }
  } catch (Exception exe) {
   exe.printStackTrace();
  }
}
 });

}
}

http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>



http://www.nancybishop.com/";
android:layout_height="wrap_content">



 



 



Thanks a lot
P

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Link to a website...

2011-08-08 Thread Lakshmi Priya
Hi:

 

I am developing an app in android and the search button in the application
needs to be linked to a website and I am unable to do that - Can anyone help
me with this... 

 

I have pasted the code below...

 

package com.apache;

 

import java.io.BufferedReader;

import java.io.InputStreamReader;

 

import org.apache.http.HttpResponse;

import org.apache.http.client.HttpClient;

import org.apache.http.client.methods.HttpGet;

import org.apache.http.impl.client.DefaultHttpClient;

 

import android.app.Activity;

import android.os.Bundle;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

import android.widget.TextView;

 

public class ApacheConnection extends Activity {

 

  Button bt;

  TextView textView1;

  TextView textView2;

 

  /** Called when the activity is first created. */

  @Override

  public void onCreate(Bundle savedInstanceState) {

   super.onCreate(savedInstanceState);

   setContentView(R.layout.main);

   bt = (Button) findViewById(R.id.button1);

   textView1 = (TextView) findViewById(R.id.editText1);

   textView2 = (TextView) findViewById(R.id.editText2);

  bt.setOnClickListener(new OnClickListener() {

@Override

   public void onClick(View v) {

   // TODO Auto-generated method stub


   textView2.setText("");

  

 try {

/*Apache HttpClient Library*/

   HttpClient client = new DefaultHttpClient();

   HttpGet request = new HttpGet("http://google.com";);

HttpResponse response = client.execute(request);

   /* response code*/

   BufferedReader rd = new BufferedReader(

new
InputStreamReader(response.getEntity().getContent()));

   String line = "";

   while ((line = rd.readLine()) != null) {

 Log.d("output:",line);

   }

 } catch (Exception exe) {

  exe.printStackTrace();

  }

   }

   });

 

  }

}



http://schemas.android.com/apk/res/android";

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

>







http://www.nancybishop.com/"; 

android:layout_height="wrap_content">



 



 



 



 

 



 

Thanks a lot

P

 

 

 

Thanks

..Priya

 

Simply-Logic Technologies

Chennai 600 044, India

Tel:+91-44-22410162

Mobile:+91-98410-85872

 

www.simply-logic.com

For the Right Reasons

 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Android Application Development

2011-08-08 Thread Lakshmi Priya
I am developing an app in android and the search button in the
application needs to be linked to a website.  Instead of the website
opening up on the android emulator the source code appears.  Can
anyone help me with this...

I have pasted the code below...

package com.apache;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class ApacheConnection extends Activity {

Button bt;
TextView textView1;
TextView textView2;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt = (Button) findViewById(R.id.button1);
textView1 = (TextView) findViewById(R.id.editText1);
textView2 = (TextView) findViewById(R.id.editText2);
bt.setOnClickListener(new OnClickListener() {
  @Override
public void onClick(View v) {
// TODO Auto-generated method stub
textView2.setText("");

 try {
/*Apache HttpClient Library*/
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://google.com";);
HttpResponse response = client.execute(request);
/* response code*/
BufferedReader rd = new BufferedReader(
  new
InputStreamReader(response.getEntity().getContent()));
   String line = "";
while ((line = rd.readLine()) != null) {
  Log.d("output:",line);
   }
  } catch (Exception exe) {
   exe.printStackTrace();
  }
}
 });

}
}

http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>



http://www.nancybishop.com/";
android:layout_height="wrap_content">



 



 



Thanks a lot
P

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en