单击textview时出现错误

时间:2017-03-10 06:38:20

标签: java android

点击TextView

时出现错误

这是java文件

public class ANTISLIPRUBBERSHEETINGSMain extends AppCompatActivity {
AppCompatTextView txt_asrs5;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_antisliprubbersheetingsmain);
       txt_asrs5= (AppCompatTextView) findViewById(R.id.txt_asrs51);
       txt_asrs5.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.checkardrubbersheet);
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
            byte[] byteArray = stream.toByteArray();
            Intent i= new Intent(ANTISLIPRUBBERSHEETINGSMain.this,ProductList.class);

            startActivity(i);
        }
    });}}

这是xml文件代码

<android.support.v7.widget.AppCompatTextView
    android:id="@+id/txt_asrs51"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_below="@id/txt_asrs4"
    android:layout_marginTop="20dp"
    android:text="CHECKARD RUBBER SHEET"
    android:textColor="#000"
    android:onClick="checkard"
    android:textSize="17dp"
    />

此错误即将到来当点击文本时它将返回到后页

IO Error creating local socket at com.example.bcs.aonerubberproject
java.io.IOException: Address already in use
at android.net.LocalSocketImpl.bindLocal(Native Method)
at android.net.LocalSocketImpl.bind(LocalSocketImpl.java:306)
at android.net.LocalServerSocket.<init>(LocalServerSocket.java:48)
at com.android.tools.fd.runtime.Server.<init>(Server.java:94)
at com.android.tools.fd.runtime.Server.create(Server.java:88)
at    com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:359)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)03-10 12:10:58.723 2188-4508/com.google.android.gms.persistent E/GCoreUlr: Bad errorId configuring silent feedback

请建议我如何解决问题

0 个答案:

没有答案