Array out of bounds error android - java

Hi I am new to andoid and keep getting the following error in my logcat but I can't find the problem in my java code. The app crashes after it goes round the array twice. I'm not sure where the array is out of bounds?
Logcat error:
05-04 14:46:22.947 3086-3086/com.example.Finished_app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.Finished_app, PID: 3086
java.lang.ArrayIndexOutOfBoundsException: length=6; index=6
at com.example.Finished_app.game1.onClick(game1.java:91)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Java code:
public class game1 extends Activity implements View.OnClickListener {
static Button next;
static ImageView mainpic;
static RadioGroup radioGroup;
static RadioButton option1;
static RadioButton option2;
static RadioButton option3;
static int[] mapPics = new int[]{R.drawable.america, R.drawable.england, R.drawable.australia, R.drawable.poland, R.drawable.sweden, R.drawable.spain};
static String[] answers = new String[]{"Spain", "Poland", "Sweden", "America", "England", "Australia"};
static int[] correctAnswer = new int[]{2, 1};
static int score = 0;
static int i = 0;
static int a = 0;
static int b = 1;
static int c = 2;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.game1);
next = (Button) findViewById(R.id.nextButton);
mainpic = (ImageView) findViewById(R.id.imageView);
mainpic.setImageResource(mapPics[i]);
next.setOnClickListener(this);
addListenerRadioGroup();
option1.setText(String.valueOf(answers[a]));
option2.setText(String.valueOf(answers[b]));
option3.setText(String.valueOf(answers[c]));
}//On Create
public void addListenerRadioGroup() {
option1 = (RadioButton) findViewById(R.id.radioButton);
option2 = (RadioButton) findViewById(R.id.radioButton2);
option3 = (RadioButton) findViewById(R.id.radioButton3);
radioGroup = (RadioGroup) findViewById(R.id.radioGroupAnswers);
radioGroup.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
radioGroup.getCheckedRadioButtonId();
}
});
}
#Override
public void onClick(View v) {
getSelectedAnswer();
i++;
a = a + 3;
b = b + 3;
c = c + 3;
if (i >= 1) {
Intent myIntent = new Intent(this, scores.class);
myIntent.putExtra("scores", score);
startActivity(myIntent);
}//if
mainpic.setImageResource(mapPics[i]);
option1.setText(String.valueOf(answers[a]));
option2.setText(String.valueOf(answers[b]));
option3.setText(String.valueOf(answers[c]));
mapPics[i] = null;
}//onClick
public void getSelectedAnswer() {
int index = radioGroup.indexOfChild(findViewById(radioGroup.getCheckedRadioButtonId()));
if (index == correctAnswer[i])
score++;
}//get selected answer
}//class

length=6; index=6
Arrays are 0 based.
If your array has 6 elements, the range is 0, ..., 5
[EDIT]
In your onClick, the value of i increases too much.
It arrives to a value (6) which exceeds the array length.
You should add a condition to verify if i > 5 then reset it to 0.
Or add a similar logic (I'm not entering the logic of your game).
Just to make sure that i is inside the range 0, ..., 5.

Related

Exception when trying to send a message to firebase server

Can you please find out what is wrong with this code?
public class NewMessageActivity extends AppCompatActivity {
private DatabaseReference mDatabaseReference;
String mDisplayName = "John";
EditText mNewMessageField;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final EditText mNewMessageField = (EditText) findViewById(R.id.newMessageText);
setContentView(R.layout.activity_new_message);
ImageButton mSendButton = (ImageButton) findViewById(R.id.sendButton);
mSendButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
sendMessage();
finish();
}
});
}
private void sendMessage(){
mDatabaseReference= FirebaseDatabase.getInstance().getReference();
String input = mNewMessageField.getText().toString();
SingleMessage singleMessage = new SingleMessage(input, mDisplayName);
mDatabaseReference.child("messages").push().setValue(singleMessage);
}
}
Immediately after I press the send button, the app stops working and I get this error message:
FATAL EXCEPTION: main
java.lang.NullPointerException
at com..NewMessageActivity.sendMessage(NewMessageActivity.java:42)
at com..NewMessageActivity.access$000(NewMessageActivity.java:14)
at com.***.NewMessageActivity$1.onClick(NewMessageActivity.java:33)
at android.view.View.performClick(View.java:4209)
at android.view.View$PerformClick.run(View.java:17457)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5341)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:929)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
at dalvik.system.NativeStart.main(Native Method)
11-28 20:05:51.566 508-527/? E/AppErrorDialog: Failed to get ILowStorageHandle instance
You need to call setContentView() before you search for the EditText widget. You also must use the instance of mNewMessageField declared at package level. Don't declare a new instance in onCreate().
setContentView(R.layout.activity_new_message);
mNewMessageField = (EditText) findViewById(R.id.newMessageText); // <= CHANGED
if (mNewMessageField == null) {
System.out.println("mNewMessageField is NULL");
}
To get more clues, add this debug output:
private void sendMessage(){
mDatabaseReference= FirebaseDatabase.getInstance().getReference();
if (mNewMessageField == null) {
System.out.println("mNewMessageField is NULL");
}
Editable ed = mNewMessageField.getText();
if (ed == null) {
System.out.println("Editable is NULL");
}
String input = mNewMessageField.getText().toString();
System.out.println("input=" + input);
SingleMessage singleMessage = new SingleMessage(input, mDisplayName);
mDatabaseReference.child("messages").push().setValue(singleMessage);
}

My simple "counter app" crashes when trying to move to another activity...why?

When trying to move to another activity the app crashes...
logcat
java.lang.RuntimeException: Unable to start activity ComponentInfo{myact.julianhernandez.com.counterapp/myact.julianhernandez.com.counterapp.CounterDisplay}: android.content.res.Resources$NotFoundException: String resource ID #0x0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
at android.content.res.Resources.getText(Resources.java:244)
at android.widget.TextView.setText(TextView.java:3888)
at myact.julianhernandez.com.counterapp.CounterDisplay.onCreate(CounterDisplay.java:31)
at android.app.Activity.performCreate(Activity.java:5231)
MainActivity.class Code
public class MainActivity extends AppCompatActivity {
Button moveActivity;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
moveActivity = (Button) findViewById(R.id.list1_button);
moveActivity.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent toCounter = new Intent(MainActivity.this , CounterDisplay.class);
startActivity(toCounter);
}
});
CounterDisplay.class Code
public class CounterDisplay extends AppCompatActivity {
private TextView countView;
private Button addButton;
private Button subtractButton;
//int initialCount = 0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_counter_display);
countView = (TextView) findViewById(R.id.currentCount);
addButton = (Button) findViewById(R.id.add);
subtractButton = (Button) findViewById(R.id.subtract);
countView.setText(0);
//increment counter by 1
addButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
int currentCount;// = initialCount;
for(currentCount=0;currentCount>=0;currentCount++){
countView.setText(currentCount);
}
}
});
}
}
Why does this code crash when switching activities?
Textview.setText(int) method takes a resource ID, not the text you are trying to display. Because there are no resource strings matching the ID you pass in (which is 0 on line 31), an exception gets thrown.
There are additional overloads of the setText() method that allow you to pass in a char[] if you don't want to use resource strings. View the documentation for more information. http://developer.android.com/reference/android/widget/TextView.html

How to show items in list of strings in textviews dynamically

I want to show the items in my list to textviews.
The wordslist.java is
public class WordsList {
List<String> set1 = new ArrayList<>(Arrays.asList("sane", "said",
"dean", "ideas", "deans", "anise", "naiades", "sand", "aide",
"dais", "saned", "aside", "sedan", "idea", "aids", "ands",
"naiad", "aides", "naiads"));
// 19 words
List<String> set2 = new ArrayList<>(Arrays.asList("doer", "lord",
"rode", "role", "drool", "older", "flooder", "odor", "lore",
"rood", "fore", "rodeo", "folder", "floored", "door", "roof",
"redo", "ford", "floor", "roofed"));
// 20 words
List<String> set3 = new ArrayList<>(Arrays.asList("mead", "dale",
"lead", "dual", "lamed", "mauled", "medulla", "lade", "male",
"alum", "maul", "mall", "ladle", "malled", "dame", "made", "lame",
"laud", "meal", "medal", "allude"));
// 21 words
Actually these are the answers of the puzzle, there about 25 puzzles(from set1 to set 25)
When the user clicks give Up. it goes to gameover activity in that activity i have button ' show missed words' ,now when this button is pressed , i want to show the items in the corresponding list.
for showing the words i created a xml layout with some textviews.
LinearLayout myLayout;
myLayout = (LinearLayout) findViewById(R.id.tvLayout); myTextViewList = new ArrayList<>(); for (int i = 0; i < myLayout.getChildCount(); i++) if (myLayout.getChildAt(i) instanceof TextView) myTextViewList.add((TextView) myLayout.getChildAt(i));
and when to set text
WordsList w = new WordsList(); TextView tv = myTextViewList.get(counter); tv.setText(w.set1);
Here is my logcat
01-28 20:29:42.105 11122-11122/rpa.screening.spellathon E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: rpa.screening.spellathon, PID: 11122
java.lang.NullPointerException
at rpa.screening.spellathon.GameOver_Screen$2.onClick(GameOver_Screen.java:44)
at android.view.View.performClick(View.java:4487)
at android.view.View$PerformClick.run(View.java:18746)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
at dalvik.system.NativeStart.main(Native Method)
EDIT 2 :
Gameover_screen
missedWords.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Intent iin = getIntent();
Bundle b = iin.getExtras();
if (b != null) {
String passed_score = (String) b.get("score");
displayScore.setText(passed_score);
int passed_set = (int) b.get("set"); // line 44
String s = Integer.valueOf(passed_set).toString();
Intent ii = new Intent(GameOver_Screen.this, MissedWords.class);
ii.putExtra("sEt", s);
startActivity(ii);
}
}
});
SOLVED MY QUESTION.
The actual problem is here,
tv.setText(w.set1);
but when i changed it to,
String set1 = w.set1.get(i);
tv.setText(set1);
the problem solved.

NullPointerException on startAnimation(anim)

I'm getting a NullPointerException on blah.startAnimation(anim), which is inside a LongClickListener. What I'm trying to do is get the number of children in a GridLayout on a DragListener, and set an animation to all of the children when you start to drag an imageview. For some reason this returns a NullPointerException,
Where it's coming from is:
#Override
public boolean onLongClick(View v) {
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);
v.startDrag(null, shadowBuilder, v, 0);
deleteAreaForAdapter.setVisibility(View.VISIBLE);
deleteAreaForAdapter.startAnimation(slide_in);
for(int i=0; i<middleViewForAdapter.getChildCount(); i++) {
int middleChildCount = middleViewForAdapter.getChildCount();
int middleChildCount1 = middleViewForAdapter.getChildCount();
int topChildCount = middleViewForAdapter.getChildCount();
int topChildCount1 = middleViewForAdapter.getChildCount();
int bottomChildCount = middleViewForAdapter.getChildCount();
LinearLayout topChild = (LinearLayout)topViewForAdapter.getChildAt(i);
LinearLayout topChild1 = (LinearLayout)topViewForAdapter1.getChildAt(i);
LinearLayout bottomChild = (LinearLayout)bottomViewForAdapter.getChildAt(i);
Context context = mContext;
Animation shakeAnim = AnimationUtils.loadAnimation(context, R.anim.shake);
// do stuff with child view
//ll.clearAnimation();
/*middleChild1.startAnimation(shakeAnim);
topChild.startAnimation(shakeAnim);
topChild1.startAnimation(shakeAnim);
bottomChild.startAnimation(shakeAnim);*/
if(middleChildCount > 0)
{
GridLayout hjk = middleViewForAdapter;
LinearLayout middleChild = (LinearLayout)hjk.getChildAt(i);
middleChild.startAnimation(shakeAnim);
ll.clearAnimation();
}
if(middleChildCount1 > 0)
{
GridLayout hjs = middleLayoutForAdapter1;
LinearLayout middleChild1 = (LinearLayout)hjs.getChildAt(i);
middleChild1.startAnimation(shakeAnim); //Line it's coming from!
ll.clearAnimation();
}
if(topChildCount > 0)
{
topChild.startAnimation(shakeAnim);
ll.clearAnimation();
}
if(topChildCount1 > 0)
{
topChild1.startAnimation(shakeAnim);
ll.clearAnimation();
}
}
v.setVisibility(View.INVISIBLE);
return true;
}
});
LogCat:
08-14 07:47:18.281 2078-2078/com.matt.cards.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.matt.cards.app, PID: 2078
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.startAnimation(android.view.animation.Animation)' on a null object reference
at com.matt.cards.app.DrawerLongClickListener$1.onLongClick(DrawerLongClickListener.java:169)
at android.view.View.performLongClick(View.java:4474)
at android.view.View$CheckForLongPress.run(View.java:18401)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
Thanks!
EDIT: Can anyone Help!?!?!?
you just have to use
Animation shakeAnim = AnimationUtils.loadAnimation(v.getContext(), R.anim.shake);
in place of
Animation shakeAnim = AnimationUtils.loadAnimation(context, R.anim.shake);
Answer was simple, I just had to create an instance of
for(int i=0; i<middleViewForAdapter.getChildCount(); i++) for every RelativeLayout I wanted it to work on (I was using RelativeLayout.getChildAt(i); for every relativeLayout I had).

NullPointerException in savedInstanceState Bundle

I am getting a NullPointerException when my code tries to access the value in a key/value pair created by onSaveInstanceState method of Activity class.
I set break points and I know for fact my Bundle is not null and it contains references to my key/values. I dont understand why I am getting this runtime error. Here are my codes for onSaveInstanceState
#Override
protected void onSaveInstanceState(Bundle outState) {
int mPoints = winCount;
int hPoints = loseCount;
String reTextView = resultsTextView.getText().toString();
String pTextView = pointsTextView.getText().toString();
String roTextView = rollTextView.getText().toString();
outState.putInt("MY_POINTS", mPoints);
outState.putInt("HOUSE_POINTS", hPoints);
outState.putString("RESULTS", reTextView);
outState.putString("POINTS", pTextView);
outState.putString("ROLL", roTextView);
super.onSaveInstanceState(outState);
}
and here is my code to restore the state on the onCreate method
// check if app just started or is being restored from memory
if ( savedInstanceState == null ) // the app just started running
{
winCount = 0;
loseCount = 0;
}
else
{
winCount = savedInstanceState.getInt("MY_POINTS");
loseCount = savedInstanceState.getInt("HOUSE_POINTS");
resultsTextView.setText(String.valueOf(savedInstanceState.getString("RESULTS")));
pointsTextView.setText(String.valueOf(savedInstanceState.getString("POINTS")));
rollTextView.setText(String.valueOf(savedInstanceState.getString("ROLL")));
}
I get the runtime error on line that starts with resultsTextView.setText... and here is contents of the savedInstanceState Bundle retrieved from break points in debug mode
Bundle[{RESULTS=Roll Again, MY_POINTS=2, POINTS=Your Point is 8,
HOUSE_POINTS=2,
android:viewHierarchyState=Bundle[{android:Panels=android.util.SparseArray#421c5560,
android:views=android.util.SparseArray#421c5358,
android:ActionBar=android.util.SparseArray#421c57f8}], ROLL=You Rolled
Easy Four}]
as you can see all my strings have a value, the interesting thing is that I dont get the NullPointerException runtime error on int variables (winCount and loseCount) but I am getting it at string values. I appreciate any help.
Update: here is the whole error log from log cat, I have resultsTextView.setText... at line 68 (within the else block on onCreat())
W/dalvikvm(27797): threadid=1: thread exiting with uncaught exception (group=0x418b6700)
E/AndroidRuntime(27797): FATAL EXCEPTION: main
E/AndroidRuntime(27797): java.lang.RuntimeException: Unable to start activity ComponentInfo{…}: java.lang.NullPointerException
E/AndroidRuntime(27797): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
E/AndroidRuntime(27797): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
E/AndroidRuntime(27797): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3740)
E/AndroidRuntime(27797): at android.app.ActivityThread.access$700(ActivityThread.java:141)
E/AndroidRuntime(27797): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
E/AndroidRuntime(27797): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(27797): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(27797): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime(27797): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(27797): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(27797): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime(27797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(27797): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(27797): Caused by: java.lang.NullPointerException
E/AndroidRuntime(27797): at app.package.onCreate(AppName.java:68)
E/AndroidRuntime(27797): at android.app.Activity.performCreate(Activity.java:5133)
E/AndroidRuntime(27797): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime(27797): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
E/AndroidRuntime(27797): ... 12 more
here is my whole onCreate method, since many commentators requested to see the whole method. Hope it helps!
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
// check if app just started or is being restored from memory
if ( savedInstanceState == null ) // the app just started running
{
winCount = 0;
loseCount = 0;
}
else
{
winCount = savedInstanceState.getInt("MY_POINTS");
loseCount = savedInstanceState.getInt("HOUSE_POINTS");
resultsTextView.setText(savedInstanceState.getString("RESULTS"));
pointsTextView.setText(savedInstanceState.getString("POINTS"));
rollTextView.setText(savedInstanceState.getString("ROLL"));
}
die1 = (ImageView) findViewById(R.id.imageView1);
die2 = (ImageView) findViewById(R.id.imageView2);
dealButton = (Button) findViewById(R.id.dealButton);
resetButton = (Button) findViewById(R.id.resetButton);
resultsTextView = (TextView) findViewById(R.id.resultsTextView);
myPointsTextView = (TextView) findViewById(R.id.myPointstTextView);
housePointsTextView = (TextView) findViewById(R.id.housePointsTextView);
pointsTextView = (TextView) findViewById(R.id.pointsTextView1);
rollTextView = (TextView) findViewById(R.id.rollTextView);
dealButton.setOnClickListener(dealButtonListener);
resetButton.setOnClickListener(resetButtonLinstener);
//on shake event
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mShakeDetector = new ShakeDetector(new OnShakeListener() {
#Override
public void onShake() {
game(rollDice());
}
});
resultsTextView.setTextColor(Color.BLACK);
myPointsTextView.setText(String.format("%s", winCount));
housePointsTextView.setText(String.format("%s", loseCount));
}
You should initialize your TextViews before calling setText method. So onCreate should be like this:
setContentView(R.layout.activity);
die1 = (ImageView) findViewById(R.id.imageView1);
die2 = (ImageView) findViewById(R.id.imageView2);
dealButton = (Button) findViewById(R.id.dealButton);
resetButton = (Button) findViewById(R.id.resetButton);
resultsTextView = (TextView) findViewById(R.id.resultsTextView);
myPointsTextView = (TextView) findViewById(R.id.myPointstTextView);
housePointsTextView = (TextView) findViewById(R.id.housePointsTextView);
pointsTextView = (TextView) findViewById(R.id.pointsTextView1);
rollTextView = (TextView) findViewById(R.id.rollTextView);
// check if app just started or is being restored from memory
if ( savedInstanceState == null ) // the app just started running
{
winCount = 0;
loseCount = 0;
}
else
{
winCount = savedInstanceState.getInt("MY_POINTS");
loseCount = savedInstanceState.getInt("HOUSE_POINTS");
resultsTextView.setText(savedInstanceState.getString("RESULTS"));
pointsTextView.setText(savedInstanceState.getString("POINTS"));
rollTextView.setText(savedInstanceState.getString("ROLL"));
}
...

Categories

Resources