1. Are you ready for the Galaxy S20? Here is everything we know so far!

How to add random text to splash screen

Discussion in 'Android Development' started by nagamothu, May 30, 2019.

  1. nagamothu

    nagamothu Newbie
    Thread Starter

    Hi guys can anyone please tell me how to add random text on the splash image in the splash screen.the text on the image should change every time the app opens.How to do that guys,i got till adding text to splash image.but how to add random text which will change every time the app opens.
     



    1. Download the Forums for Android™ app!


      Download

       
  2. 23tony

    23tony Well-Known Member

    You should be able to set it in the onCreate for the Splash Screen Activity using setText - something like

    Code (Text):
    1. protected void onCreate(Bundle savedInstanceState) {
    2.     // other code here
    3.     String randomText = getRandomText(); // You will write this function to generate the random text
    4.     TextView splashScreenText = (TextView)findViewById(R.id.splashScreenText);
    5.     splashScreen.setText(randomText);
    6. }
    You can't make it part of the image, you'll need to use a TextView object, and you'll have to play around with the positioning to get it to look right.
     
Loading...
Similar Threads - add random text
  1. RennSter20
    Replies:
    3
    Views:
    315
  2. Alithir Elements
    Replies:
    0
    Views:
    437
  3. tinker123
    Replies:
    5
    Views:
    469
  4. tinker123
    Replies:
    0
    Views:
    317
  5. FlipperTime
    Replies:
    0
    Views:
    444
  6. swiatmar
    Replies:
    0
    Views:
    333
  7. jmmartins
    Replies:
    0
    Views:
    503
  8. midsms
    Replies:
    2
    Views:
    1,518
  9. Gobshyte
    Replies:
    1
    Views:
    404
  10. Google_is_the_Higgs_Boson
    Replies:
    1
    Views:
    1,510

Share This Page

Loading...