On app launch intent is not null. I don't know why
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener{
/**
* Views
*/
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Bundle bundle = getIntent().getExtras();
if (bundle == null)
Log.d("***DEBUG****", "Intent was null");
else
Log.d("**** DEBUG ***", "Intent not null");
Close and reopen my application throw that intent is not null: D/***DEBUG****: Intent not null
通过添加 if(getIntent().getStringExtra("type")==null) 解决了我的问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.