@Override
public void bindView(View view, Context context, Cursor cursor) {
String s = null;
String am_pm = null;
String a = null;
String b = null;
int count = 0;
int newNum = 0;
int count2 = 0;
int position = cursor.getPosition();
String mTime = (cursor.getString(cursor
.getColumnIndex("records")));
am_pm = "AM";
if (mTime.length() == 3) {
a = mTime.substring(0, 1);
b = mTime.substring(1, 3);
s = a + ':' + b;
} else {
a = mTime.substring(0, 2);
b = mTime.substring(2, 4);
s = a + ':' + b;
}
if ((mTime.substring(0, 2).equals("12"))) {
count = cursor.getPosition() + 1;
count2 = count2 + 1;
newNum = count - count2;
}
if (position >= newNum && newNum != 0) {
am_pm = "PM";
}
String fullString = s + " " + am_pm;
((TextView) view.findViewById(R.id.timeList))
.setText(fullString);
}
}
startManagingCursor(cursor);
setListAdapter(new MyAdapter(this, cursor));
}
Variable wont stay as a certain value
Page 1 of 12 Replies - 125 Views - Last Post: 15 October 2011 - 05:06 AM
#1
Variable wont stay as a certain value
Posted 14 October 2011 - 10:21 PM
A have an IF statement where i need to check when something occurs and once it occurs i need to get that value to later test the rest of my values in my code. The trouble i am having is that my value wont stay as the number so it doesnt format the rest of my code correctly. Example: The value say it gets from my if statement is 11. I set that value to a variable then test later on any value that is greater than 11.Then it does something until the rest of the values are read. What is happening now tho is that it will set the variable to 11 but only for the IF statement is true that it goes back to zero which i dont want i need it to stay that certain value that it gets until its done reading values.
Replies To: Variable wont stay as a certain value
#2
Re: Variable wont stay as a certain value
Posted 15 October 2011 - 05:03 AM
I suspect this is a local scope issue. The info isn't really clear.
#3
Re: Variable wont stay as a certain value
Posted 15 October 2011 - 05:06 AM
I agree. With the information you are giving us, it sounds like you are binding to a method-scope variable and trying to use it in another method. You need to either pass the variable as an argument or set it to an instance variable.
If this is not your problem, can you phrase your question differently?
If this is not your problem, can you phrase your question differently?
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote








|