Skip to content

Commit

Permalink
Merge pull request #6 from cuplv/strConstWorkaround
Browse files Browse the repository at this point in the history
Workaround for string constant issue
  • Loading branch information
chfont authored Mar 14, 2024
2 parents 0ed75d2 + 9a095cd commit 72cda82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ protected void onCreate(Bundle savedInstanceState) {
public void launchSecondActivity() {
Intent intent = new Intent(this, SecondActivity.class);
Log.i("histInstrumentation"," " + System.identityHashCode(intent) + " = new Intent " + System.identityHashCode(this) + " " + System.identityHashCode(SecondActivity.class));
String key = "extra_data";
String key = new String("extra_data");
String val = "Hello, SecondActivity!";
intent.putExtra(key,val);
Log.i("histInstrumentation","ci " + System.identityHashCode(intent) + " putExtra " + System.identityHashCode(key) + " " + System.identityHashCode(val));
startActivity(intent);
Log.i("histInstrumentation","ci " + System.identityHashCode(this) + " startActivity " + System.identityHashCode(intent));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected void onCreate(Bundle savedInstanceState) {
// Attempting to retrieve the extra data and display it
Intent tmp1 = getIntent();
Log.i("histInstrumentation",System.identityHashCode(tmp1) + " = ci " + System.identityHashCode(this) + " getIntent " );
String key = "extra_data";
String key = new String("extra_data");
String data = tmp1.getStringExtra(key); // This key is incorrect
Log.i("histInstrumentation",System.identityHashCode(data) + " = ci " + System.identityHashCode(tmp1) + " getStringExtra " + System.identityHashCode(key) );
TextView textView = findViewById(R.id.textView);
Expand Down

0 comments on commit 72cda82

Please sign in to comment.