java编译没错,但是打开程序报错

java代码如下
package com.example.changecolors;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;
public class FrameLayoutTest extends Activity {
private int current = 0;
final int[] colors = new int[] { R.color.color1, R.color.color2,
R.color.color3, R.color.color4, R.color.color5, R.color.color6,
R.color.color7 };
final int[] names = new int[] { R.id.view1, R.id.view2, R.id.view3,
R.id.view4, R.id.view5, R.id.view6, R.id.view7 };
TextView view[] = new TextView[7];
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
for (int i = 0; i < 7; i++) {
view[i] = (TextView) findViewById(names[i]);
}
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
if (msg.what == 0x1122) {
for (int i = 0; i < 7 - current; i++) {
view[i].setBackgroundResource(colors[i + current]);
}
for (int i = 7 - current, j = 0; j < 7; i++, j++) {
view[i].setBackgroundResource(colors[j]);
}
}
super.handleMessage(msg);
}
};
new Timer().schedule(new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
current++;
if (current >= 6) {
current = 0;
}
Message m = new Message();
m.what = 0x1122;
handler.sendMessage(m);
}
}, 0, 100);
}
}
xml配置如下:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/view1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff0000"
android:height="50px"
android:width="210px" />
<TextView
android:id="@+id/view2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#bb0000"
android:height="50px"
android:width="180px" />
<TextView
android:id="@+id/view3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#dd0000"
android:height="50px"
android:width="150px" />
<TextView
android:id="@+id/view4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#990000"
android:height="50px"
android:width="120px" />
<TextView
android:id="@+id/view5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#770000"
android:height="50px"
android:width="90px" />
<TextView
android:id="@+id/view6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#550000"
android:height="50px"
android:width="60px" />
<TextView
android:id="@+id/view7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#330000"
android:height="50px"
android:width="30px" />
</FrameLayout>
Manifest的如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.changecolors"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="14" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.changecolors.FrameLayoutTest"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
...全文
相关推荐
最好的java反编译工具可以直接打开jar包
这个是我见过最好的反编译工具,并且可以直接打开jar包,查看java代码,而且不需要安装绿色软件 exe文件
eclipse打开java类编译后的class文件所在目录
eclipse打开java类编译后的class文件所在目录批处理文件
java教程之java程序编译运行图解(java程序运行)
最近重新复习了一下java基础,在使用javap的过程中遇到了一些问题,这里便讲讲对于一个类文件如何编译、运行、反编译的。也让自己加深一下印象
apk反编译工具 可以直接打开class文件,也可生成java源码
很方便的apk 反编译 工具 可以直接打开class文件,也可生成java源码 可以同时打开多个文件 附有使用说明 适合android开发
java程序中指定某个浏览器打开的实现方法
最近工作中遇到一个需求,是要利用java打开指定浏览器,整理后发现有四种解决的方法,所以想着分享出来,下面这篇文章主要给大家介绍了java程序中指定某个浏览器打开的实现方法,,需要的朋友可以参考下。



