- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
06-20 22:53:42.240: E/AndroidRuntime(657): FATAL EXCEPTION: main
06-20 22:53:42.240: E/AndroidRuntime(657): java.lang.NullPointerException
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:355)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.AbsListView.obtainView(AbsListView.java:1430)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.ListView.measureHeightOfChildren(ListView.java:1216)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.ListView.onMeasure(ListView.java:1127)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.View.measure(View.java:8313)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.View.measure(View.java:8313)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.View.measure(View.java:8313)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.View.measure(View.java:8313)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.View.measure(View.java:8313)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.os.Handler.dispatchMessage(Handler.java:99)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.os.Looper.loop(Looper.java:123)
06-20 22:53:42.240: E/AndroidRuntime(657): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-20 22:53:42.240: E/AndroidRuntime(657): at java.lang.reflect.Method.invokeNative(Native Method)
06-20 22:53:42.240: E/AndroidRuntime(657): at java.lang.reflect.Method.invoke(Method.java:507)
06-20 22:53:42.240: E/AndroidRuntime(657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-20 22:53:42.240: E/AndroidRuntime(657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-20 22:53:42.240: E/AndroidRuntime(657): at dalvik.system.NativeStart.main(Native Method)
06-20 22:53:44.380: I/Process(657): Sending signal. PID: 657 SIG: 9
public class Timetablledisplay extends Activity {
ListView lv;
TextView tv;
TextView td;
Gallery myHorizontalListView1;
Gallery myHorizontalListView2;
Gallery myHorizontalListView3;
Gallery myHorizontalListView4;
Gallery myHorizontalListView5;
Gallery myHorizontalListView6;
static int position;
int datepos=0;
Button back,front;
TextView e1,e2,e3,e4,e5,e6;
String p0[]={"Free","Free","Free","Free","Free","Free"};
String p01[]={"Free","Free","Free","Free","Free","Free"};
String p1[]=new String[40];
String p2[]=new String[40];
String p3[]=new String[40];
String p4[]=new String[40];
String p5[]=new String[40];
String p6[]=new String[40];
String sub[]=new String[40];
String sub1[]=new String[40];
String sub2[]=new String[40];
String sub3[]=new String[40];
String sub4[]=new String[40];
String sub5[]=new String[40];
String[] sw=new String[23];
String restoredText,restoredText1,restoredText2;
String x[]={"Attended","Bunked","Free Hour"};
String x1[]={"Attended","Bunked","Holiday"};
Calendar c = Calendar.getInstance();
Date newDate1;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.timetabledisplay);
try{
getSettings();
getTimeTablesetting();
Log.d("ERRRRRORRR",""+p1[0]);
lv=(ListView)findViewById(R.id.listView1);
tv=(TextView)findViewById(R.id.textdate);
td=(TextView)findViewById(R.id.textday);
c.add(Calendar.DATE, 0);
newDate1 = c.getTime();
td.setText(setdate(newDate1.getDay()));
try{
int i;
//get it from database
for(i=0;i<ProjectBunkitActivity.pos;i++){
p1[i]=sub[i];
p2[i]=sub1[i];
p3[i]=sub2[i];
p4[i]=sub3[i];
p5[i]=sub4[i];
p6[i]=sub5[i];
}
Log.d("ERRRRRORRR",""+p1[0]);
dateUpdate();
Log.d("DATEUPDATE", "HGJVVM");
front=(Button)findViewById(R.id.fwdarrow);
back=(Button)findViewById(R.id.bckarrow);
Log.d("DBBBBBBPOSITION5",""+position);
Calendar cal=Calendar.getInstance();
Date newd=cal.getTime();
Log.d("date",""+newd.getDay());
try{
if(setdate(newDate1.getDay())=="MON")
{
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p1);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="TUE"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p2);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="WED"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p3);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="THU"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p4);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="FRI"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p5);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="SAT"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p6);
lv.setAdapter(adapter);
}
else
{
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p1);
lv.setAdapter(adapter);
}
}catch (Exception e) {
// TODO: handle exception
}
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, final int arg2,
long arg3) {
// TODO Auto-generated method stub
AlertDialog.Builder builder = new AlertDialog.Builder(Timetablledisplay.this);
builder.setTitle("Pick a choice");
builder.setSingleChoiceItems(x, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
//Toast.makeText(getApplicationContext(), x[item], Toast.LENGTH_SHORT).show();
if(newDate1.getDay()==1){
changeLabel(arg2, item, p1, 1);
}
else if(newDate1.getDay()==2){
changeLabel(arg2, item, p2, 2);
}
else if(newDate1.getDay()==3){
changeLabel(arg2, item, p3, 3);
}
else if(newDate1.getDay()==4){
changeLabel(arg2, item, p4, 4);
}
else if(newDate1.getDay()==5){
changeLabel(arg2, item, p5, 5);
}
else if(newDate1.getDay()==6){
changeLabel(arg2, item, p6, 6);
}
else{
changeLabel(arg2, item, p0, 7);
}
updateview();
dialog.dismiss();
DBmanager(attendance(),newDate1);
//defaultview();
Log.d("aaaaaaaaaaaaaaaaaaaaa","bbbbbbbbbbbbbbbbbbbbbbbb");
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
newDate1.setDate(newDate1.getDate()-1);
update(newDate1);
if(updateViewUsingDB()==null){
defaultview();
}
else
{
switch (newDate1.getDay())
{
case 0:
p0=updateViewUsingDB();
break;
case 1:
p1=updateViewUsingDB();
break;
case 2:
p2=updateViewUsingDB();
break;
case 3:
p3=updateViewUsingDB();
break;
case 4:
p4=updateViewUsingDB();
break;
case 5:
p5=updateViewUsingDB();
break;
case 6:
p6=updateViewUsingDB();
break;
default:
}
}
updateview();
DBmanager(attendance(),newDate1);
}
});
front.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
newDate1.setDate(newDate1.getDate()+1);
update(newDate1);
if(updateViewUsingDB()==null){
defaultview();
}
else
{
switch (newDate1.getDay())
{
case 0:
p0=updateViewUsingDB();
break;
case 1:
p1=updateViewUsingDB();
break;
case 2:
p2=updateViewUsingDB();
break;
case 3:
p3=updateViewUsingDB();
break;
case 4:
p4=updateViewUsingDB();
break;
case 5:
p5=updateViewUsingDB();
break;
case 6:
p6=updateViewUsingDB();
break;
default:
}
}
updateview();
DBmanager(attendance(),newDate1);
}
});
Log.d("DBBBBBBPOSITION2JGH",""+position);
DBmanager(attendance(),newDate1);
}catch (Exception e) {
// TODO: handle exception
}
}catch (Exception e) {
// TODO: handle exception
Log.d("ERRRRRORRR","DONE");
}
}
public void defaultview(){
try{
for(int i=0;i<ProjectBunkitActivity.pos;i++){
p1[i]=sub[i];
p2[i]=sub1[i];
p3[i]=sub2[i];
p4[i]=sub3[i];
p5[i]=sub4[i];
p6[i]=sub5[i];
}
}catch (Exception e) {
// TODO: handle exception
}
}
public String attendance(){
String attn=null;
try{
switch (newDate1.getDay())
{
case 0:
attn=stringConcat(p0);
break;
case 1:
attn=stringConcat(p1);
break;
case 2:
attn=stringConcat(p2);
break;
case 3:
attn=stringConcat(p3);
break;
case 4:
attn=stringConcat(p4);
break;
case 5:
attn=stringConcat(p5);
break;
case 6:
attn=stringConcat(p6);
break;
default:
attn=stringConcat(p0);
}
}catch (Exception e) {
// TODO: handle exception
}
return attn;
}
public void DBmanager(String attendance,Date theDate){
try{
Random rand=new Random();
int i=newDate1.getDate();
String s=setdate(newDate1.getDay());
String mnth=setmon(newDate1.getMonth());
long timevar=newDate1.getTime();
int k;
k=(100*newDate1.getDate())+newDate1.getMonth();
SQLiteDatabase db=openOrCreateDatabase("bunkDBNxTGeN", MODE_PRIVATE, null);
ContentValues cv= new ContentValues();
cv.put("curId", position);
cv.put("curPos",k);
cv.put("curDay",s);
cv.put("curDate",i);
cv.put("curMnth",mnth);
cv.put("curAttend",attendance);
cv.put("curTime", timevar);
position=rand.nextInt(10000-0)+0;
db.execSQL("CREATE TABLE IF NOT EXISTS theTable(curId INT(3),curPos INT(3),curTime INT(20),curDate INT(2),curDay VARCHAR,curMnth VARCHAR,curAttend VARCHAR);");
db.insert("theTable",null, cv);
Cursor c=db.rawQuery("SELECT * FROM theTable", null);
c.moveToLast();
Log.d("DB Message1", c.getString(c.getColumnIndex("curId")));
Log.d("DB Message1", c.getString(c.getColumnIndex("curPos")));
Log.d("DB Message2", c.getString(c.getColumnIndex("curDate")));
Log.d("DB Message3", c.getString(c.getColumnIndex("curDay")));
Log.d("DB Message4", c.getString(c.getColumnIndex("curMnth")));
Log.d("DB Message5", c.getString(c.getColumnIndex("curAttend")));
Log.d("DB Message6", c.getString(c.getColumnIndex("curTime")));
db.execSQL("CREATE TABLE temp AS SELECT * FROM theTable ORDER BY curTime");
db.execSQL("DROP TABLE theTable");
db.execSQL("ALTER TABLE temp RENAME TO theTable");
db.execSQL("DELETE FROM theTable WHERE curId NOT IN (SELECT curId FROM theTable GROUP BY curPos);");
c.close();
db.close();
}catch (Exception e) {
// TODO: handle exception
Log.d("DB Message Error",e.toString());
}
}
@SuppressWarnings("finally")
public String stringConcat(String [] arr){
String str = "";
try{
for (int i = 0;i<arr.length; i++) {
str = str+arr[i];
if(i<arr.length-1){
str = str+",";
}
}
}catch (Exception e) {
// TODO: handle exception
}
finally{
return str;
}
}
@SuppressWarnings("finally")
public String [] stringUncat(String str)
{
String[] arr=null;
try{
arr= str.split(",");
}catch (Exception e) {
// TODO: handle exception
}
finally{
return arr;
}
}
public String[] updateViewUsingDB(){
int curDate;
curDate=(100*newDate1.getDate())+newDate1.getMonth();
String s12=null;
String s123[];
int index,x;
SQLiteDatabase db=openOrCreateDatabase("bunkDBNxTGeN", MODE_PRIVATE, null);
try{
if (db == null) {
Log.d("Database", "Not Found!!!");
}
else {
Cursor c=db.rawQuery("SELECT * FROM theTable", null);
c.moveToFirst();
index=c.getColumnIndex("curPos");
x=Integer.parseInt(c.getString(index));
while(index!=-1)
{
if(x==curDate)
{
s123=stringUncat(c.getString(c.getColumnIndex("curAttend")));
db.close();
return s123;
}
else{
c.moveToNext();
index=c.getColumnIndex("curPos");
x=Integer.parseInt(c.getString(index));
}
}
Log.d("DATABASE","UREAKAAAAAAAAAAAAAAAA"+s12);
}
db.close();
}catch (Exception e) {
// TODO: handle exception
Log.d("DATABASE INFO",e.toString());
db.close();
}
db.close();
return null;
}
public void updateview()
{
Log.d("DATEUPDATAVSCXZVAQAndlekdn", p1[0]);
try{
Log.d("DATEUPDAfSFSffdsFSDFAFkSDACDCSDndlekdn", p1[0]);
if(setdate(newDate1.getDay())=="MON")
{
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p1);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="TUE"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p2);
lv.setAdapter(adapter);
Log.d("DATEUPDATFwegfegewgRGSggekndlekdn", p1[0]);
}
else if(setdate(newDate1.getDay())=="WED"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p3);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="THU"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p4);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="FRI"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p5);
lv.setAdapter(adapter);
}
else if(setdate(newDate1.getDay())=="SAT"){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p6);
lv.setAdapter(adapter);
}
else
{
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listarray, android.R.id.text1, p0);
lv.setAdapter(adapter);
}
Log.d("DATEUPDAEFWEGFRHTkndlekdn", p1[0]);
}
catch (Exception e) {
// TODO: handle exception
}
}
public void dateUpdate(){
try{
int m;
Calendar c = Calendar.getInstance();
Date newDate = c.getTime();
Log.d("DateXXX","heyyy");
String s=setdate(newDate.getDay());
String x=setmon(newDate.getMonth());
Log.d("DATEEEEE",""+newDate.getDate());
m=newDate.getDate();
td.setText(s);
tv.setText(x+","+m);
updateview();
}
catch (Exception e) {
Log.d("HEY THEREs An ERROR",e.toString());
}
}
public void update(Date p)
{
try{
int m;
String s=setdate(p.getDay());
String x=setmon(p.getMonth());
m=p.getDate();
td.setText(s);
tv.setText(x+","+m);
}
catch (Exception e) {
Log.d("HEY THERE An ERROR",e.toString());
}
}
private String setmon(int month) {
// TODO Auto-generated method stub
String d=null;
try{
switch (month){
case 0:d="JAN";
break;
case 1:d="FEB";
break;
case 2:d="MAR";
break;
case 3:d="APL";
break;
case 4:d="MAY";
break;
case 5:d="JUN";
break;
case 6:d="JULY";
break;
case 7:d="AUG";
break;
case 8:d="SEP";
break;
case 9:d="OCT";
break;
case 10:d="NOV";
break;
case 11:d="DEC";
break;
default:d="JAN";
}
}catch (Exception e) {
// TODO: handle exception
}
return d;
}
private String setdate(int day) {
// TODO Auto-generated method stub
String d=null;
try{
switch (day)
{
case 0:d="SUN";
break;
case 1:d="MON";
break;
case 2:d="TUE";
break;
case 3:d="WED";
break;
case 4:d="THU";
break;
case 5:d="FRI";
break;
case 6:d="SAT";
break;
default:d="MON1";
}
}catch (Exception e) {
// TODO: handle exception
}
return d;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
try{
MenuInflater inflater = getMenuInflater(); //
inflater.inflate(R.menu.menu, menu); //
}catch (Exception e) {
// TODO: handle exception
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
try{
switch (item.getItemId()) {
case R.id.itemPrefs:
startActivity(new Intent(this, ProjectBunkitActivity.class));
break;
case R.id.itemPrefs1:
startActivity(new Intent(this,Display.class));
}
}catch (Exception e) {
// TODO: handle exception
}
return super.onOptionsItemSelected(item);
}
public String[] changeLabel(int i,int j,String[] p,int l) {
// TODO Auto-generated method stub
//p6[arg2]=x[item];
try{
String storage[][]={
sub,
sub1,
sub2,
sub3,
sub4,
sub5,p01};
//Toast toast = Toast.makeText(Timetablledisplay.this,storage[l-1][i],Toast.LENGTH_SHORT);
//toast.show();
switch (j) {
case 0:
p[i]=storage[l-1][i];
break;
case 1:p[i]="BNK";
break;
case 2:p[i]="FREE";
break;
default:
break;
}
DBmanager(attendance(),newDate1);
}catch (Exception e) {
// TODO: handle exception
}
return p;
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
try{
Calendar ca=Calendar.getInstance();
ca.add(Calendar.DATE, 0);
Date dres=ca.getTime();
newDate1=dres;
Log.d("DATEUPDATE", "DONE");
dateUpdate();
}
catch (Exception e) {
// TODO: handle exception
Log.d("DATEUPDATE", e.toString());
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
try{
super.onPause();
Log.d("DATqewDATE", "jhwedhjkebjd");
}catch (Exception e) {
// TODO: handle exception
}
// SharedPreferences.Editor editor = getPreferences(0).edit();
// editor.putInt("position",position);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onRestoreInstanceState(savedInstanceState);
Log.d("DATEUPDATE", "HGJVVM");
try{
p1=savedInstanceState.getStringArray("mond");
p2=savedInstanceState.getStringArray("tued");
p3=savedInstanceState.getStringArray("wedd");
p4=savedInstanceState.getStringArray("thud");
p5=savedInstanceState.getStringArray("frid");
p6=savedInstanceState.getStringArray("satd");
Calendar ca=Calendar.getInstance();
ca.add(Calendar.DATE, 0);
Date dres=ca.getTime();
newDate1=dres;
Log.d("DATEUPDATE1212", "DONE");
dateUpdate();
}catch (Exception e) {
// TODO: handle exception
}
}
@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onSaveInstanceState(savedInstanceState);
try{
savedInstanceState.putStringArray("mond", p1);
savedInstanceState.putStringArray("tued", p2);
savedInstanceState.putStringArray("wedd", p3);
savedInstanceState.putStringArray("thud", p4);
savedInstanceState.putStringArray("frid", p5);
savedInstanceState.putStringArray("satd", p6);
}catch (Exception e) {
// TODO: handle exception
}
}
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
}
public void getSettings(){
try{
SharedPreferences prefs = getSharedPreferences("myfile",0);
restoredText = prefs.getString("text", null);
restoredText1 = prefs.getString("cpd", null);
restoredText2= prefs.getString("nos", null);
int pos1=prefs.getInt("pos",1);
int l=0;
if (restoredText != null) {
Log.d("HHHHH", "Here"+pos1);
try{
for(int j=0;j<=pos1-1;j++)
{
sw[l]=prefs.getString("sub"+l,null);
Log.d("DATA FROM PREFS",sw[l]);
l++;
}
}
catch(Exception e)
{
Toast toast = Toast.makeText(Timetablledisplay.this,e.toString()+"5",Toast.LENGTH_SHORT);
toast.show();
}
getTimeTablesetting();
}
}catch (Exception e) {
// TODO: handle exception
}
}
public void getTimeTablesetting(){
SharedPreferences prefs = getSharedPreferences("myTime",0);
try{
if(ProjectBunkitActivity.pos==prefs.getInt("pos",0)){
if(prefs.getString("sub"+2, null) != null)
{
for(int i=0;i<prefs.getInt("pos",0);i++)
{
sub[i] = prefs.getString("sub"+i, null);
sub1[i] = prefs.getString("sub1"+i, null);
sub2[i] = prefs.getString("sub2"+i, null);
sub3[i] = prefs.getString("sub3"+i, null);
sub4[i] = prefs.getString("sub4"+i, null);
sub5[i] = prefs.getString("sub5"+i, null);
Log.d("DATA FROM PREFS FOR TIME TABLE",sub[i]+i);
}
}
}
}catch (Exception e) {
// TODO: handle exception
Log.d("DATA FROM PREFS FOR TIME TABLE","ERROR");
}
}
}
最佳答案
该NullPointerException
可能只有两种可能的原因:
id
输入了错误的TextView
。ArrayAdapter<...>(Context, R.layout.layout_file, R.id.textview, List data);
R.id.textview
不是
id
中存在的
View
的
R.layout.layout_file
。
null
/List
中有一个array
值,它表示传递给适配器TextView
布局文件中是否有带有
id
@android:id/text1
的
R.layout.listarray
?如果不是,那就是问题的根源。
p1
和
p2
数组上。您声明它们的大小为
40
,但是您是否填写了其中的所有职位?您是否有
40
值可放入这些数组中?如果没有,那么在某些时候您将只有
null
值,而适配器不喜欢这样。
logcat
,并查看这些数组中是否有
null
值。如果这样做,则很可能是您遇到的问题。
关于android - 生成 ListView 时出现错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11125089/
我一直在读到,如果一个集合“被释放”,它也会释放它的所有对象。另一方面,我还读到,一旦集合被释放,集合就会释放它的对象。 但最后一件事可能并不总是发生,正如苹果所说。系统决定是否取消分配。在大多数情况
我有一个客户端-服务器应用程序,它使用 WCF 进行通信,并使用 NetDataContractSerializer 序列化对象图。 由于服务器和客户端之间传输了大量数据,因此我尝试通过微调数据成员的
我需要有关 JMS 队列和消息处理的帮助。 我有一个场景,需要针对特定属性组同步处理消息,但可以在不同属性组之间同时处理消息。 我了解了特定于每个属性的消息组和队列的一些知识。我的想法是,我想针对
我最近开始使用 C++,并且有一种强烈的冲动 #define print(msg) std::cout void print(T const& msg) { std::cout void
我已经为使用 JGroups 编写了简单的测试。有两个像这样的简单应用程序 import org.jgroups.*; import org.jgroups.conf.ConfiguratorFact
这个问题在这里已经有了答案: Firebase messaging is not supported in your browser how to solve this? (3 个回答) 7 个月前关
在我的 C# 控制台应用程序中,我正在尝试更新 CRM 2016 中的帐户。IsFaulted 不断返回 true。当我向下钻取时它返回的错误消息如下: EntityState must be set
我正在尝试通过 tcp 将以下 json 写入 graylog 服务器: {"facility":"GELF","file":"","full_message":"Test Message Tcp",
我正在使用 Django 的消息框架来指示成功的操作和失败的操作。 如何排除帐户登录和注销消息?目前,登录后登陆页面显示 已成功登录为“用户名”。我不希望显示此消息,但应显示所有其他成功消息。我的尝试
我通过编写禁用qDebug()消息 CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT 在.pro文件中。这很好。我想知道是否可以
我正在使用 ThrottleRequest 来限制登录尝试。 在 Kendler.php 我有 'throttle' => \Illuminate\Routing\Middleware\Throttl
我有一个脚本,它通过die引发异常。捕获异常时,我想输出不附加位置信息的消息。 该脚本: #! /usr/bin/perl -w use strict; eval { die "My erro
允许的消息类型有哪些(字符串、字节、整数等)? 消息的最大大小是多少? 队列和交换器的最大数量是多少? 最佳答案 理论上任何东西都可以作为消息存储/发送。实际上您不想在队列上存储任何内容。如果队列大部
基本上,我正在尝试创建一个简单的 GUI 来与 Robocopy 一起使用。我正在使用进程打开 Robocopy 并将输出重定向到文本框,如下所示: With MyProcess.StartI
我想将进入 MQ 队列的消息记录到数据库/文件或其他日志队列,并且我无法修改现有代码。是否有任何方法可以实现某种类似于 HTTP 嗅探器的消息记录实用程序?或者也许 MQ 有一些内置的功能来记录消息?
我得到了一个带有 single_selection 数据表和一个命令按钮的页面。命令按钮调用一个 bean 方法来验证是否进行了选择。如果不是,它应该显示一条消息警告用户。如果进行了选择,它将导航到另
我知道 MSVC 可以通过 pragma 消息做到这一点 -> http://support.microsoft.com/kb/155196 gcc 是否有办法打印用户创建的警告或消息? (我找不到谷
当存在大量节点或二进制数据时, native Erlang 消息能否提供合理的性能? 情况 1:有一个大约 50-200 台机器的动态池(erlang 节点)。它在不断变化,每 10 分钟大约添加或删
我想知道如何在用户登录后显示“欢迎用户,您已登录”的问候消息,并且该消息应在 5 秒内消失。 该消息将在用户成功登录后显示一次,但在同一 session 期间连续访问主页时不会再次显示。因为我在 ho
如果我仅使用Welcome消息,我的代码可以正常工作,但是当打印p->client_name指针时,消息不居中。 所以我的问题是如何将消息和客户端名称居中,就像它是一条消息一样。为什么它目前仅将消
我是一名优秀的程序员,十分优秀!