开发者

android application force close on this.startactivity(intent);

开发者 https://www.devze.com 2023-03-15 17:14 出处:网络
this is the source code i am using @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) {

this is the source code i am using

@Override public boolean onOptionsItemSelected(MenuItem item) { 
        switch (item.getItemId()) {
        case R.id.AndroidLogo: 开发者_开发问答
            Intent intent = new Intent(this, AddUser.class);
          this.startActivity(intent);
        break;
        case R.id.AndroidText: 
            Intent intent2 = new Intent(this, SearchUser.class);
              this.startActivity(intent2);
        break;
        } 
        return true; 
        }


I think you have not mentioned the classes in menifest you wanted to call ;Use these permission lines to call another activity in activity tag

 < android:enabled="true" android:name="AddUser"/> 

for one first and for second class use another activity tag

<android:enabled="true" android:name="SearchUser"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消