Source are :
MainActivity.java-
package com.amostrone.akash.safebrowser;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
public final static String EXTRA_MESSAGE = "com.amostrone.akash.safebrowser.MESSAGE";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void search(View view) {
Intent intent = new Intent(this, Browser.class);
EditText editText = (EditText) findViewById(R.id.editText);
String message = editText.getText().toString();
if(message == null || message.trim().equals("")) {
Toast.makeText(this, "No Input", Toast.LENGTH_SHORT).show();
message = "http://www.android.com"; // TODO Add your own WEBSITE
}
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
MainActivity.xml`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
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="com.amostrone.akash.safebrowser.MainActivity">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textWebEmailAddress"
android:ems="10"
android:id="#+id/editText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Search here." />
<Button
android:text="#string/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:id="#+id/button"
android:onClick="search" />
</RelativeLayout>
Browser.java
package com.amostrone.akash.safebrowser;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class Browser extends AppCompatActivity {
static String message;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browser);
Intent intent = getIntent();
message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
if (!((message.substring(0, 11)).equals("http://www.") || (message.substring(0, 12)).equals("https://www.")))
check();
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl(message);
}
void check() {
// WWW
if(message.substring(0,4).equals("www."))
{
message = "http://" + message;
return;
}
// Google Search
message = "https://www.google.co.in/search?q=" + message + "&rct=j" ;
}
}
Browser.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_browser"
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="com.amostrone.akash.safebrowser.Browser">
<WebView
android:id="#+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" />
</RelativeLayout>
So my problem is that when i enter any text like "http://www.google.con.in" or just "www.google.co.in", everything works fine but when i enter just simple text like "stackoverflow" app crashes.It crashes even before system call the button "search" function "search(View view)".
Please help--
The problem may be that you are executing a substring on your message String, but it's too short.
As example:
message.substring(0, 11)
This will do a substring from index zero to 11, but what happens if the string have only a length of 4? There will be a exception.
You should extract the checks into an new method and do the length checks on the string before calling the substring method.
if(message.length() > 10){
message.substring(0,11);
}
Related
And this is how the Java code looks:
package com.example.admin.testingwebview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void go(View view){
EditText editText = (EditText) findViewById(R.id.editText);
WebView webView = (WebView) findViewById(R.id.webView);
webView.loadUrl(editText.getText().toString());
}
}
The layout XML File:
<?xml version="1.0" encoding="utf-8"?>
<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="com.example.admin.testingwebview.MainActivity">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Go"
android:id="#+id/button"
android:layout_below="#+id/editText"
android:layout_centerHorizontal="true"
android:onClick="go" />
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/webView"
android:layout_centerHorizontal="true"
android:layout_below="#+id/button" />
</RelativeLayout>
I tried it on an emulator as well as real device.
The EditText and Button part are A-OK, But the Web View shows nothing . . . .
What am I doing wrong?
You need something like this
EditText data = (EditText) findViewbyId(R.id.edittext);
String result = data.getText().toString(); //Take URL from edittext
if (!result.startsWith("http://") && !result.startsWith("https://"))
result = "http://" + result;
If you don't set the http after the link string nothing is shown in the webview, same for intent that start the BrowserWeb
I'm trying to create a button to reload a Webview but ( sorry I'm new in android developement ) I didn't find a way to do it ( even in stackoverflow )
Here is the Mainactivity.java
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import android.widget.Button;
import static com.d4rkunicorn.partyhard.R.id.webView;
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("url");
}
}
The webview.xml :
<?xml version="1.0" encoding="utf-8"?>
<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:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin" tools:context=".MainActivity"
android:id="#+id/webview.xml">
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="REFRESH"
android:id="#+id/button" />
</RelativeLayout>
Thanks for helping
In Activity class :
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import android.widget.Button;
import static com.d4rkunicorn.partyhard.R.id.webView;
public class MainActivity extends ActionBarActivity {
WebView webview;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("url");
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
webview.reload();
}
});
}
}
In Layout XML :
<?xml version="1.0" encoding="utf-8"?>
<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:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin" tools:context=".MainActivity"
android:id="#+id/webview.xml">
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:id="#+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="REFRESH"
android:id="#+id/button" />
</RelativeLayout>
There many possible way to reload your webview:
you can use webview.loadUrl( "javascript:window.location.reload( true )" ); inside any method/action event
webview.loadUrl(webview.toString); //getting the webview URL and use to reload ur web page
webview.loadUrl(url); // you can use your desire URL to reload your web page
webview.loadUrl( "onclick=\"window.history.back()"\");
You can reload your web view or you can use below code :
yourActivity.this.webView.loadUrl(url);
on your button click.
Hello im making an assignment list with database to add assignments. When i push on the add button i can type my assignment. But i only see half of it. When i click add, it correctly adds the new assignment to the list and i can see the whole text.
How can i solve this ?
This is my XML layout file
<?xml version="1.0" encoding="utf-8"?>
<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:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="be.ehb.android.arnojansens.DetailGroupsActivity"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ListView
android:id="#+id/listDetails"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="4.60"></ListView>
<EditText
android:id="#+id/editDetails"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:hint="Details Assignment"/>
<Button
android:id="#+id/btnAddDetailsOpdracht"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Add Details Assignment"/>
</LinearLayout>
</RelativeLayout>
And this is the java of the class
package be.ehb.arnojansens.fragmentexampleii;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import java.util.ArrayList;
public class DetailGroupsActivity extends Activity implements View.OnClickListener {
static Dbhelper opdrDbHelper;
static Button btnAddDetailsOpdracht;
static EditText editDetails;
static ListView listDetails;
static ArrayList<Detail> details;
static long detailId;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_groups);
btnAddDetailsOpdracht = (Button)findViewById(R.id.btnAddDetailsOpdracht);
editDetails = (EditText)findViewById(R.id.editDetails);
listDetails = (ListView)findViewById(R.id.listDetails);
btnAddDetailsOpdracht.setOnClickListener(this);
opdrDbHelper = new Dbhelper(this);
detailId = (Long)getIntent().getSerializableExtra("detailId");
String opdrachtName = (String)getIntent().getStringExtra("opdrachtName");
this.setTitle(opdrachtName);
if(detailId != -1)
details = opdrDbHelper.findDetailsForOpdracht(detailId);
else
details = new ArrayList<Detail>();
loadDetails();
}
public void loadDetails(){
ArrayAdapter<Detail> adapter =
new ArrayAdapter<Detail>(
this,
android.R.layout.simple_list_item_1,
details);
listDetails.setAdapter(adapter);
}
#Override
public void onClick(View v) {
String detailString = editDetails.getText().toString();
editDetails.setText("");
Detail alb = opdrDbHelper.addAlbum(detailId,detailString);
details.add(alb);
loadDetails();
}
}
Sound to me like the text doesn't fit in the EditText container. Make it wrap_content instead of a fixed size:
<EditText
android:id="#+id/editDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Details Assignment"/>
Also keep in mind that fill_parent was deprecated, use match_parent instead.
From looking online, I know there is some problem with my XML file but not sure what it is. I've tried remaking the entire button from scratch but the error persists. The following is the code in the activity.
package com.example.linked1n;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.example.linked1n.R;
public class MainActivity extends ActionBarActivity implements View.OnClickListener{
Button login;
int counter;
EditText username, password;
String success;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
counter = 3;
username = (EditText)findViewById(R.id.getEmail);
password = (EditText)findViewById(R.id.getPassword);
login = (Button)findViewbyId(R.Id.login);
login.setOnClickListener(this);
}
private void loginClick() {
Intent intent = new Intent(this, ScreenAftLog.class );
startActivity(intent);
}
public void onClick (View v) {
switch (v.getId()) {
case R.Id.login:
loginClick();
break;
}
}
This is the XML code:
<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="com.example.linked1n.MainActivity" >
<Button
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:onClick="loginClick"
android:text="#string/yayaya" />
<EditText
android:id="#+id/getEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="62dp"
android:ems="10"
android:inputType="textWebEmailAddress" />
<EditText
android:id="#+id/getPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/getEmail"
android:layout_marginTop="32dp"
android:ems="10"
android:inputType="textPassword" >
<requestFocus />
</EditText>
</RelativeLayout>
Any help will be appreciated!
Edit: adding doesn't fix it
It is not R.Id.login, it should be R.id.login
You wrote ID in caps in your switch statement. id is a reserved word and needs to be in small letter, change the R.Id.login to R.id.login, then run :)
End tag is missing for the parent layout ...
Add </RelativeLayout> tag at the end. If the problem still persists, let us know.
Remove the last line - </EditText>
Below is your XML file which i build successfully. Try this.
<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="com.example.linked1n.MainActivity" >
<Button
android:id="#+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:onClick="loginClick"
android:text="Sample" />
<EditText
android:id="#+id/getEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="62dp"
android:ems="10"
android:inputType="textWebEmailAddress" />
<EditText
android:id="#+id/getPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/getEmail"
android:layout_marginTop="32dp"
android:ems="10"
android:inputType="textPassword" />
<requestFocus />
</RelativeLayout>
java file
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends ActionBarActivity implements View.OnClickListener{
Button login;
int counter;
EditText username, password;
String success;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
counter = 3;
username = (EditText)findViewById(R.id.getEmail);
password = (EditText)findViewById(R.id.getPassword);
login = (Button)findViewById(R.id.login);
login.setOnClickListener(this);
}
private void loginClick() {
Intent intent = new Intent(this, ScreenAftLog.class );
startActivity(intent);
}
public void onClick (View v) {
switch (v.getId()) {
case R.id.login:
loginClick();
break;
}
}
}
So,
I am building a basic app which has 2 activivities. Now, the first one works well, the second one does not. It does not show any errors while I edit the codes, but when I run the app and when I am in the second acitivity it gives me an annoying error. Saying "Stops unexpectedly...." You know. I tried debugging but failed. In the second activity called Troll.java I should be able to check a checkbox and when I do that a text is supposed to change to something else. It says stops unexpe.....
main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:padding="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
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" >
<include
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="#layout/resuable_pizza_layout" />
<TextView
android:id="#+id/display"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="105dp"
android:text="#string/display"
android:textColor="#FFFFFF"
android:textSize="18sp" />
<ImageView
android:id="#+id/lol"
android:onClick="onlol"
android:contentDescription="#string/lol2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/display"
android:layout_centerHorizontal="true"
android:layout_marginTop="66dp"
android:src="#drawable/lol" />
troll.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF69B4"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<CheckBox
android:id="#+id/box1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onChecked1"
android:text="#string/ch1"
android:textColor="#000000" />
<CheckBox
android:id="#+id/box2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onChecked2"
android:text="#string/ch2"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="0.26" >
<TextView
android:id="#+id/textView1"
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/trollFace"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</LinearLayout>
mainActitvity.java :
package com.example.pizza2;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
public class MainActivity extends Activity {
CheckBox pepp, cheese;
TextView tv;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pepp = (CheckBox) findViewById(R.id.check1);
cheese = (CheckBox) findViewById(R.id.check2);
tv = (TextView) findViewById(R.id.display);
}
public void onShow(View view){
StringBuilder str = new StringBuilder();
if (pepp.isChecked() && cheese.isChecked()){
str.append("Pepperoni, extra cheese pizza!");
}
else if (pepp.isChecked()){
str.append("Pepperoni pizza!");
}
else if (cheese.isChecked()){
str.append("Extra cheese pizza!");
}
tv.setText(str);
}
public void onlol(View view){
Intent intent = new Intent(this, Troll.class);
startActivity(intent);
}
#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;
}
}
Troll.java:
package com.example.pizza2;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
public class Troll extends Activity{
CheckBox box11, box22;
TextView tv;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.troll);
box11 = (CheckBox) findViewById(R.id.box1);
box22 = (CheckBox) findViewById(R.id.box2);
tv = (TextView) findViewById(R.id.display);
}
public void onChecked1(View view){
StringBuilder str = new StringBuilder();
if(box11.isChecked()){
str.append("Lol bro!");
}
tv.setText(str);
}//end of "onChecked1"
public void onChecked2(View view){
StringBuilder str = new StringBuilder();
if(box22.isChecked()){
str.append("XD XD Kaki");
}
tv.setText(str);
} //end of "onChecked2"
}