小虾米资讯

AD1
当前位置:网站首页 / android / 正文

android:兄弟们帮忙看看呗,这bug快疯了

2020-12-04 10:56:25 / 我要吐槽 查看是否已被百度收录 查看是否已被谷歌收录 查看是否已被搜狗收录 查看是否已被360收录
AD2
隐式调用错了Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=sa (has extras) } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2120) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1746)

package com.example.intentdemo3;import androidx.appcompat.app.AppCompatActivity;import android.content.ComponentName;import android.content.Intent;import android.os.Bundle;import android.view.View;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 tx1=findViewById(R.id.text1); EditText tx2=findViewById(R.id.text2); Intent it=new Intent("sa"); //ComponentName cn=new ComponentName(this,sencondactivity.class); //it.setComponent(cn); //it.setAction("sa"); Bundle be=new Bundle(); be.putString("text1",tx1.getText().toString()); be.putString("text2",tx2.getText().toString()); it.putExtras(be); startActivity(it); }}

定义了action和默认的category啊,好奇怪

Powered By © 小虾米资讯 2015

(本站部分文章来源于网络或网友爆料,不代表本站观点,如有侵权请联系及时删除 )