<?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="ru.m9ru.test.MainActivity">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/input"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/output"
android:layout_below="@+id/input"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/btnCount"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:onClick="onClick"/>
</RelativeLayout>
06-28 23:21:40.394 1499-1499/ru.m9ru.test W/ResourceType: No package identifier when getting value for resource number 0x00000006
06-28 23:21:40.394 1499-1499/ru.m9ru.test D/AndroidRuntime: Shutting down VM
06-28 23:21:40.394 1499-1499/ru.m9ru.test W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4164fce0)
06-28 23:21:40.424 1499-1499/ru.m9ru.test E/AndroidRuntime: FATAL EXCEPTION: main
Process: ru.m9ru.test, PID: 1499
android.content.res.Resources$NotFoundException: String resource ID #0x6
at android.content.res.Resources.getText(Resources.java:265)
at android.support.v7.widget.ResourcesWrapper.getText(ResourcesWrapper.java:52)
at android.widget.TextView.setText(TextView.java:3888)
at ru.m9ru.test.MainActivity.onButtonClick(MainActivity.java:32)
at ru.m9ru.test.MainActivity$1.onClick(MainActivity.java:25)
at android.view.View.performClick(View.java:4445)
at android.view.View$PerformClick.run(View.java:18446)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private EditText input;
private TextView output;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
input = (EditText) findViewById(R.id.input);
output = (TextView) findViewById(R.id.output);
Button Count = (Button) findViewById(R.id.btnCount);
Count.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onButtonClick();
}
});
}
public void onButtonClick(){
String S = input.getText().toString();
output.setText(S.length());
}
}
import android.renderscript.ScriptGroup;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class AboutActivity extends AppCompatActivity {
private EditText input;
private TextView output;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
input = (EditText) findViewById(R.id.input);
output = (TextView) findViewById(R.id.output);
Button btnCount = (Button) findViewById(R.id.btnCount);
btnCount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onButtonClick((Button)view);
}
});
}
public void onButtonClick(Button view){
String S = input.getText().toString();
output.setText(S.length());
}
}
import android.renderscript.ScriptGroup;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class AboutActivity extends AppCompatActivity {
private EditText input;
private TextView output;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
input = (EditText) findViewById(R.id.input);
output = (TextView) findViewById(R.id.output);
}
public void btnCount(View view) {
String S = input.getText().toString();
output.setText(S.length());
}
}