2012-09-14 77 views
0

我是Android新手,所以只能在示例中学习和玩弄东西。目前,我正在通过Timer Task生成图像的示例,我陷入了一个困境,我真的需要专家的建议。下面是代码和它在哪里使用Log.i(“MARKER”,“* **”).....有些人可以告诉我为什么我在行的最后一节出错? ?与日志标记卡住

@Override 
    public void run() { 
     // TODO Auto-generated method stub 
     Log.i(“MARKER”,”******************************************”); 

     //int numViews = container.getChildCount(); 

     ImageView toAdd = new ImageView(ImagePlayActivity.this);   
     Drawable imgContent = ImagePlayActivity.this.getResources().getDrawable(R.drawable.icon); 
     toAdd.setImageDrawable(imgContent); 
     toAdd.setTag(“img”+counter++); 

     Random rndGen = new Random(); 

     LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,rndGen.nextInt(300),rndGen.nextInt(300)); 
     toAdd.setLayoutParams(lp); 
     toAdd.setBackgroundColor(Color.TRANSPARENT); 

     AlphaAnimation anim = new AlphaAnimation(0, 1); 
     anim.setDuration(1000); 
     container.addView(toAdd); 
     //container.invalidate(); 
     toAdd.startAnimation(anim); 



    } 
}; 

在此先感谢。

+2

看起来你正在使用针对双引号代替Log.i常规双引号(“标记”,” *************”) ; – Samuel

+0

显示堆栈跟踪错误日志 – Yahor10

+0

我只收到错误“令牌上的语法错误,请删除这些令牌”。 –

回答

1

由于您使用的是而不是",因此出现错误。 Java语言不承认为一组引号括字符串等在尝试改变该行:

Log.i("MARKER","******************************************"); 
+0

是的,但是当我这样做时,我在ImagePlayActivity和counter ++部分出现错误。你能告诉我为什么?非常感谢你的帮助。 –

+0

原因相同。你的报价是错误的。将它们更改为“ –

+0

Yup thats done and now error moved to ImagePlayActivity.this and counter ++ and it does not show both errors when quotes are not changed。 –