mardi 8 décembre 2015

Using Text Only Once Through Random Method

I am new to Android. I am showing Text in the TextView on Button click Randomly. On 1st Textview the Heading and on 2nd the explaination of that heading. I am able to show the Heading and Explaination Randomly and now I want if the Text is shown once should not be shown again means it will be removed. This is the point where I stuck. I am not able to remove the texts. Any help will be appreciated. I am posting my code here.

MainActivity.java

TextView text_heading,text_explain;
Button click;
Random random;
int[] array_heading,array_explain;
int int_text;

public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    text_heading = (TextView) findViewById(R.id.text_heading);
    text_explain = (TextView) findViewById(R.id.text_explain);
    click = (Button) findViewById(R.id.click);

    click.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            text_heading.setText(array_heading[int_text]);
            text_explain(array_explain[int_text]);
        }
    });

    random = new Random();

    array_heading = new int[]{R.string.source_text1, R.string.source_text2, R.string.source_text3,
            R.string.source_text6, R.string.source_text5, R.string.source_text4, R.string.source_text7,
            R.string.source_text8, R.string.source_text9};

    array_explain = new int[]{R.string.source_text1_explain, R.string.source_text2_explain, R.string.source_text3_explain,
            R.string.source_text4_explain, R.string.source_text5_explain, R.string.source_text6_explain, R.string.source_text7_explain,
            R.string.source_text8_explain, R.string.source_text9_explain};

       int_text = random.nextInt(array_heading.length - 1);
     }
   }

string.xml

<string name="source_text1">PSYCHIC\nATTACK</string>
<string name="source_text1_explain">Although this sounds quite ominous,it really isn’t.No one has the power to attack us unless
    we give them that power.However, more often than we care to believe we tend to give our own power away to others.In the case
    of Psychic Attack, you need to find out if it is directed at you or if you are doing it yourself.The Universal Law of Cause
    and Effect states that everything we send out comes back to us, so if we are unwittingly sending out anger, rage, or hate in
    the direction of another, it can and will return to bite us!</string>
<string name="source_text2">PAST LIFE</string>
<string name="source_text2_explain"> These cards are only pulled if you desire to know where you lived in a past life,or where
    an ancestor lived.If you want more detail, ask yes/no questions to determine the exact state/city/county.If you are really
    curious you can ask for time frames as well.</string>
<string name="source_text3">THIS\nLIFETIME</string>
<string name="source_text3_explain">The associated SET-UP for this blockage occurred in your lifetime, so question to find out
    how old you were.I use groups of numbers to facilitate this.For example,was I under eight years of age,under 15,etc.,
    to narrow down the search until I determine the exact age when the trauma took place.</string>
<string name="source_text4">SELF-SABOTAGE\nTO AVOID\nTRANSFORMATION</string>
<string name="source_text4_explain"> Fear is the greatest “gotcha” that we deal with in our lifetimes, and it is generally what
    holds us back from success and personal growth.We have the ability to create the largest stumbling blocks for ourselves to
    block our forward progress and keep us from realizing our dreams.</string>
<string name="source_text5">PARALLEL OR\nFUTURE LIFE</string>
<string name="source_text5_explain">This block was set up in another reality, but not in a past incarnation.I believe our souls
    can exist in multiple realities at the same time. I’ve located up to five concurrent lives in a session.These may or may not
    be taking place on this planet,but rather in the celestial or angelic dimensions.</string>
<string name="source_text6">OVERWHELMED BY\nAN AUTHORITY\nFIGURE</string>
<string name="source_text6_explain">This blockage is being generated because you have given your power away to another,usually a person you see as
    one of authority.This person could be a parent,a boss,a teacher,a minister or a guru.Sometimes this card comes up in
    association with the Psychic Attack card.</string>
<string name="source_text7">VEIL OF DEATH</string>
<string name="source_text7_explain">The soul knows when it is leaving this plane, and it will try to gain closure with those souls
    closest to it.This happens at a subconscious level, but it can have a profound effect on your life, creating anger, sadness,
    even chaos for no logical reason.This same impact can be felt when a soul group member has already transitioned and wants
    closure with you.</string>
<string name="source_text8">CONCEPTION,\nGESTATION\nOR BIRTH</string>
<string name="source_text8_explain">One of the hardest sources to understand is the trauma and associated damage that occurs to
    the fetus at the time of conception, during pregnancy or at the moment of birth.If there is no true emotional intimacy between
    the birth parents at the moment of conception, the child will grow into adulthood searching for intimacy everywhere outside
    itself, setting up relationship difficulties that will continue throughout one’s life.Resentment and fear felt by the mother
    during pregnancy is transferred to the infant as well.In fact, a woman who makes a conscious decision to give her baby up for
    adoption, begins the process of emotional separation from that child as soon as that decision is made, leaving the child
    (and later the adult) missing important lessons concerning the primary emotions and skills that are needed for interpersonal
    relationships.</string>
<string name="source_text9">ANCESTRAL</string>
<string name="source_text9_explain">Forces or blocks that were set up on the Earth plane and must be cleared on the Earth plane.
    When we transition from this dimension,we leave behind our “baggage” genetically encoded into our descendants.In the Bible it
    is said that the “sins of the fathers are visited upon the sons unto the seventh generation.”The number seven is a generic
    number, and ancestral issues can go back much deeper than seven generations,waiting for someone to “wake up” and do the work
    required to lift the block.</string>




Aucun commentaire:

Enregistrer un commentaire