Hi So I'm trying to make an application for a project I'm working on that involves google cloud Api. Basically the application will scan the name of a game (Could be anything but using games as an example in this case) and the activity it moves to will populate with a textview based on the game name scanned. I'll provide code below but basically all I have at this moment is that the application scans the logo and it'll appear in the ActionBar of the next activity, is there a way to populate the TextView's that I'm going to place in based on the Title returned to the Action bar? Or is there a way to set it based on the text sent in the intent?
Code for the logo sender. This is just the intent basically. The variable text is the text that's passed in through the cloud vision API.
public void run() {
Toast.makeText(getApplicationContext(),
text.getText(), Toast.LENGTH_LONG).show();
Intent intent = new Intent(LogoDetectionActivity.this, GameInfoActivity.class);
intent.putExtra("TITLE", text.getText());
startActivity(intent);
}
Code from the new activity to set to actionbar:
public class GameInfoActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game_info);
String title = getIntent().getExtras().getString("TITLE");
getSupportActionBar().setTitle(title);
}
public void goToLogoDetection(View view) {
Intent intent = new Intent(this, LogoDetectionActivity.class);
startActivity(intent);
}
}
If anyone could help me out here it'd be greatly appreciated!
EDIT: Just because I seemed to of caused some confusion, what I want is to have the contents of a TextView change based on the Title, but more than just the title into the Textview. For example if the Title was to do with mario the contents of the textview would include information about Mario and not jsut the title "Mario". Same for any other game. Of course I know I'd have to program in this text of what goes into it myself but thats another story.