Exchange

Intent putExtra and getExtra in Android Studio

putExtra 

@Override
public void onClick(View view) {
Intent intent = new Intent(mContext, ProductActivity.class);
intent.putExtra("productId", model.getId());
mContext.startActivity(intent);
}

getExtra

Intent intent = getIntent();
String pid = intent.getStringExtra("productId");



Post a Comment

0 Comments