ps大神帮忙p两张照片看看下面的编程错到哪了

[Android开发][Android 调试]哪位大神帮忙看下错在哪了,期末大作业,焦急。。。
[Android开发][Android 调试]哪位大神帮忙看下错在哪了,期末大作业,焦急。。。
更新: 23:26:32
06-04 15:08:52.679: D/dalvikvm(1518): GC_CONCURRENT freed 58K, 7% free K, paused 17ms+6ms, total 159ms
06-04 15:08:52.798: D/AndroidRuntime(1518): Shutting down VM
06-04 15:08:52.798: W/dalvikvm(1518): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
06-04 15:08:52.817: E/AndroidRuntime(1518): FATAL EXCEPTION: main
06-04 15:08:52.817: E/AndroidRuntime(1518): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.timemanager1/com.example.timemanager1.MainActivity}: java.lang.RuntimeException: Could not create tab content because could not find view with id
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.os.Handler.dispatchMessage(Handler.java:99)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.os.Looper.loop(Looper.java:137)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.ActivityThread.main(ActivityThread.java:5041)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at java.lang.reflect.Method.invokeNative(Native Method)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at java.lang.reflect.Method.invoke(Method.java:511)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at dalvik.system.NativeStart.main(Native Method)
06-04 15:08:52.817: E/AndroidRuntime(1518): Caused by: java.lang.RuntimeException: Could not create tab content because could not find view with id
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.widget.TabHost$ViewIdContentStrategy.&init&(TabHost.java:688)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.widget.TabHost$ViewIdContentStrategy.&init&(TabHost.java:679)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.widget.TabHost$TabSpec.setContent(TabHost.java:528)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at com.example.timemanager1.MainActivity.onCreate(MainActivity.java:42)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.Activity.performCreate(Activity.java:5104)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
06-04 15:08:52.817: E/AndroidRuntime(1518): & & & & ... 11 more
com.example.timemanager1.MainActivity.onCreate(MainActivity.java:42
这里出错了,找不到id
又改了下,还是运行不出来,只有个空白界面
这个是MainActivity
package com.example.timemanager3;
import android.app.TabA
import android.os.B
import android.view.LayoutI
import android.widget.TabH
@SuppressWarnings(&deprecation&)
public class MainActivity extends TabActivity {
& & & & protected void onCreate(Bundle savedInstanceState) {
& & & & & & & & super.onCreate(savedInstanceState);
& & & & & & & & TabHost tabHost= (TabHost)getTabHost();
& & & & & & & & tabHost.setup();
& & & & & & & &
& & & & & & & & LayoutInflater inflater = LayoutInflater.from(this);
& & & & & & & && & inflater.inflate(R.layout.activity_main, tabHost.getTabContentView(), true);
& && &&&tabHost.addTab(tabHost.newTabSpec(&tabTime&).
& && &&&& & & & & & & & setIndicator(&时钟&).setContent(R.id.tabTime));
& && &&&tabHost.addTab(tabHost.newTabSpec(&tabAlarm&).
& && &&&& & & & & & & & setIndicator(&闹钟&).setContent(R.id.tabAlarm));
& && &&&tabHost.addTab(tabHost.newTabSpec(&tabtimer&).
& && &&&& & & & & & & & setIndicator(&计时器&).setContent(R.id.tabtimer));
& && &&&tabHost.addTab(tabHost.newTabSpec(&tapstopwatch&).
& && &&&& & & & & & & & setIndicator(&秒表&).setContent(R.id.tapstopwatch));
& & & & & & & &
这个是TimeView.Java
package com.example.timemanager3;
import java.util.C
import android.annotation.SuppressL
import android.content.C
import android.os.H
import android.util.AttributeS
import android.view.V
import android.widget.LinearL
import android.widget.TextV
public class TimeView extends LinearLayout {
& & & & @SuppressLint(&NewApi&)
& & & & public TimeView(Context context, AttributeSet attrs,int defStyle) {
& & & & & & & & super(context, attrs, defStyle);
& & & & & & & &
& & & & public TimeView(Context context, AttributeSet attrs) {
& & & & & & & & super(context, attrs);
& & & & & & & &
& & & & public TimeView(Context context) {
& & & & & & & & super(context);
& & & & & & & &
& & & & @Override
& & & & protected void onFinishInflate(){
& & & & & & & & super.onFinishInflate();
& & & & & & & & tvTime=(TextView)findViewById(R.id.tvTime);
& & & & & & & & tvTime.setText(&hello&);
& & & & & & & & timerhandler.sendEmptyMessage(0);
& & & & //可见状态改变
& & & & public void onVisibilityChanged(View changedView,int visibility){
& & & & & & & & super.onVisibilityChanged(changedView, visibility);
& & & & & & & & if(visibility==View.VISIBLE){
& & & & & & & & & & & & timerhandler.sendEmptyMessage(0);
& & & & & & & & }else{
& & & & & & & & & & & & timerhandler.removeMessages(0);
& & & & & & & & }
& & & & private void refreshTime(){
& & & & & & & & System.out.print(&&&&&&&&&&);
& & & & & & & & Calendar c=Calendar.getInstance();
& & & & & & & & tvTime.setText(String.format(&%d;%d;%d&, c.get(Calendar.HOUR_OF_DAY),c.get(Calendar.MINUTE),c.get(Calendar.SECOND)));
& & & & private Handler timerhandler=new Handler(){
& & & & & & & & public void handleMessage(android.os.Message msg){
& & & & & & & & & & & & refreshTime();
& & & & & & & & & & & & if(getVisibility()==View.VISIBLE)
& & & & & & & & & & & & //1000ms以后在执行这个handleMessage方法
& & & & & & & & & & & & timerhandler.sendEmptyMessageAtTime(0,1000);
& & & & & & & & };
& & & & };
& & & & private TextView tvT
这是activity_main.xml
&?xml version=&1.0& encoding=&utf-8&?&
&FrameLayout xmlns:android=&/apk/res/android&
& & android:id=&@+id/FrameLayout01&& &
& & android:layout_width=&wrap_content&& &
& & android:layout_height=&wrap_content&
& & &TabHost
& && &&&android:id=&@android:id/tabhost&
& && &&&android:layout_width=&match_parent&
& && &&&android:layout_height=&match_parent& &
& && &&&&LinearLayout
& && && && &android:layout_width=&match_parent&
& && && && &android:layout_height=&match_parent&
& && && && &android:orientation=&vertical& &
& && && && &&TabWidget
& && && && && & android:id=&@android:id/tabs&
& && && && && & android:layout_width=&match_parent&
& && && && && & android:layout_height=&wrap_content& &
& && && && &&/TabWidget&
& && && && &&FrameLayout
& && && && && & android:id=&@android:id/tabcontent&
& && && && && & android:layout_width=&match_parent&
& && && && && & android:layout_height=&match_parent& &
& && && && && & &com.example.timemanager3.TimeView
& && && && && && &&&android:id=&@+id/tabTime&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && && &&&&TextView android:id=&@+id/tvTime&
& && && && && && && && &android:textAppearance=&?android:attr/textAppearanceLarge&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:layout_width=&fill_parent&
& && && && && && && && &android:layout_height=&fill_parent&/&
& && && && && & &/com.example.timemanager3.TimeView&
& && && && && & &LinearLayout
& && && && && && &&&android:id=&@+id/tabAlarm&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && && &&&&ListView
& && && && && && && && &android:id=&@+id/lvAlarmList&
& && && && && && && && &android:layout_height=&fill_parent&
& && && && && && && && &android:layout_width=&1dp&&
& && && && && && &&&&/ListView&
& && && && && && &&&&Button
& && && && && && && && &android:id=&@+id/btnAddAlarm&
& && && && && && && && &android:text=&@+string/Add_alarm&
& && && && && && && && &android:layout_width=&fill_parent&
& && && && && && && && &android:layout_height=&wrap_content&/&
& && && && && & &/LinearLayout&
& && && && && & &LinearLayout
& && && && && && &&&android:id=&@+id/tabtimer&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && & &/LinearLayout&
& && && && && &
& && && && && & &LinearLayout
& && && && && && &&&android:id=&@+id/tapstopwatch&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && & &/LinearLayout&
& && && && &&/FrameLayout&
& && &&&&/LinearLayout&
& & &/TabHost&
&/FrameLayout&
这个是AlarmView.Java
package com.example.timemanager3;
import java.util.D
import android.annotation.SuppressL
import android.content.C
import android.util.AttributeS
import android.view.V
import android.widget.ArrayA
import android.widget.B
import android.widget.LinearL
import android.widget.ListV
@SuppressLint(&NewApi&)
public class AlarmView extends LinearLayout {
& & & & public AlarmView(Context context, AttributeSet attrs, int defStyle) {
& & & & & & & & super(context, attrs, defStyle);
& & & & & & & &
& & & & public AlarmView(Context context, AttributeSet attrs) {
& & & & & & & & super(context);
& & & & & & & &
& & & & public AlarmView(Context context) {
& & & & & & & & super(context);
& & & & & & & &
& & & & @Override
& & & & protected void onFinishInflate(){
& & & & & & & & super.onFinishInflate();
& & & & & & & &
& & & & & & & & btnAddAlarm=(Button) findViewById(R.id.btnAddAlarm);
& & & && &&&lvAlarmList=(ListView)findViewById(R.id.lvAlarmList);
& & & && &&&adapter=new ArrayAdapter&AlarmView.AlarmDate&(getContext(),android.R.layout.simple_list_item_1);
& & & && &&&lvAlarmList.setAdapter(adapter);
& & & && &&&
& & & && &&&adapter.add(new AlarmDate(System.currentTimeMillis()));
& & & && &&&btnAddAlarm.setOnClickListener(new View.OnClickListener() {
& & & & & & & & & & & &
& & & & & & & & & & & & public void onClick(View v) {
& & & & & & & & & & & & & & & & addAlarm();
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & }
& & & & & & & & });
& & & & private void addAlarm(){
& & & & & & & &
& & & & private Button btnAddA
& & & & private ListView lvAlarmL
& & private ArrayAdapter&AlarmDate&
& & private static class AlarmDate{
& & & & & & private long time=0;
& & & & & & private String timeLabel=&&;
& && &&&private D
& & & & & &
& & & & & & & &
& & & & & & & & @SuppressWarnings(&deprecation&)
& & & & & & & & public AlarmDate(long time){
& & & & & & & & & & this.time=
& & & & & & & & & & date=new Date(time);
& & & & & & & & & & timeLabel=date.getHours()+&:&+date.getMinutes();
& & & & & & }
& & & & & & & &
& & & & & & & & public long getTime(){
& & & & & & & & & & & &
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public String toString(){
& & & & & & & & & & & & return getTimeLabel();
& & & & & & & & }
& & & & & & & & public String getTimeLabel(){
& & & & & & & & & & & & return timeL
& & & & & & & & }
& & & & & & & &
logcat里的
06-05 03:13:36.706: D/dalvikvm(1653): GC_CONCURRENT freed 354K, 19% free K, paused 8ms+20ms, total 124ms
06-05 03:13:39.456: D/dalvikvm(1653): GC_CONCURRENT freed 388K, 19% free K, paused 6ms+18ms, total 102ms
06-05 03:13:42.655: D/dalvikvm(1653): GC_CONCURRENT freed 389K, 19% free K, paused 7ms+22ms, total 113ms
06-05 03:13:48.636: D/dalvikvm(1653): GC_CONCURRENT freed 390K, 18% free K, paused 74ms+107ms, total 372ms
06-05 03:13:56.116: D/dalvikvm(1653): GC_CONCURRENT freed 406K, 17% free K, paused 120ms+26ms, total 517ms
06-05 03:14:01.656: D/dalvikvm(1653): GC_CONCURRENT freed 399K, 17% free K, paused 1635ms+23ms, total 1832ms
06-05 03:14:05.476: D/dalvikvm(1653): GC_CONCURRENT freed 395K, 17% free K, paused 71ms+23ms, total 198ms
06-05 03:14:09.506: D/dalvikvm(1653): GC_CONCURRENT freed 393K, 17% free K, paused 19ms+20ms, total 152ms
06-05 03:14:10.665: D/dalvikvm(1653): GC_FOR_ALLOC freed 148K, 19% free K, paused 46ms, total 49ms
06-05 03:14:10.665: I/dalvikvm-heap(1653): Grow heap (frag case) to 3.248MB for 196234-byte allocation
06-05 03:14:10.756: D/dalvikvm(1653): GC_FOR_ALLOC freed 128K, 21% free K, paused 83ms, total 83ms
06-05 03:14:23.496: E/Trace(1730): error opening trace file: No such file or directory (2)
06-05 03:14:24.476: D/dalvikvm(1730): GC_CONCURRENT freed 55K, 7% free K, paused 19ms+15ms, total 127ms
06-05 03:14:24.525: W/Resources(1730): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f040004}
06-05 03:14:27.206: D/dalvikvm(1730): GC_CONCURRENT freed 291K, 14% free K, paused 10ms+24ms, total 127ms
06-05 03:14:28.826: D/dalvikvm(1730): GC_CONCURRENT freed 382K, 16% free K, paused 6ms+25ms, total 111ms
06-05 03:14:30.126: D/dalvikvm(1730): GC_CONCURRENT freed 392K, 16% free K, paused 8ms+22ms, total 107ms
06-05 03:14:31.487: D/dalvikvm(1730): GC_CONCURRENT freed 393K, 17% free K, paused 9ms+29ms, total 115ms
com.example.timemanager1.MainActivity.onCreate(MainActivity.java:42
这里出错了,找不到id
com.example.timemanager1.MainActivity.onCreate(MainActivity.java:42)出错了
你不贴代码,只贴logcat只能看出是你的activity里面有问题,启动不了。
MainActivity.onCreate里面找不到指定的view,会不会是布局文件写的不对
com.example.timemanager1.MainActivity 第四十二行错误: could not find view
java.lang.RuntimeException: Could not create tab content because could not find view with id
com.example.timemanager1.MainActivity.onCreate(MainActivity.java:42)
明显是你的MainActivity的42行ID没找到。仔细看下,
com.example.timemanager1.MainActivity.onCreate(MainActivity.java:42)出错了
这行的id 没找到
Could not create tab content because could not find view with id
你这个 layout 里没找到对应的 View
AlarmView和TextView都有问题,我就先用了TextView,运行不出来
Could not create tab content because could not find view with id
你这个 layout 里没找到 ...
又改了下,还是运行不出来,只有个空白界面
这个是MainActivity
package com.example.timemanager3;
import android.app.TabA
import android.os.B
import android.view.LayoutI
import android.widget.TabH
@SuppressWarnings(&deprecation&)
public class MainActivity extends TabActivity {
& & & & protected void onCreate(Bundle savedInstanceState) {
& & & & & & & & super.onCreate(savedInstanceState);
& & & & & & & & TabHost tabHost= (TabHost)getTabHost();
& & & & & & & & tabHost.setup();
& & & & & & & &
& & & & & & & & LayoutInflater inflater = LayoutInflater.from(this);
& & & & & & & && & inflater.inflate(R.layout.activity_main, tabHost.getTabContentView(), true);
& && &&&tabHost.addTab(tabHost.newTabSpec(&tabTime&).
& && &&&& & & & & & & & setIndicator(&时钟&).setContent(R.id.tabTime));
& && &&&tabHost.addTab(tabHost.newTabSpec(&tabAlarm&).
& && &&&& & & & & & & & setIndicator(&闹钟&).setContent(R.id.tabAlarm));
& && &&&tabHost.addTab(tabHost.newTabSpec(&tabtimer&).
& && &&&& & & & & & & & setIndicator(&计时器&).setContent(R.id.tabtimer));
& && &&&tabHost.addTab(tabHost.newTabSpec(&tapstopwatch&).
& && &&&& & & & & & & & setIndicator(&秒表&).setContent(R.id.tapstopwatch));
& & & & & & & &
这个是TimeView.Java
package com.example.timemanager3;
import java.util.C
import android.annotation.SuppressL
import android.content.C
import android.os.H
import android.util.AttributeS
import android.view.V
import android.widget.LinearL
import android.widget.TextV
public class TimeView extends LinearLayout {
& & & & @SuppressLint(&NewApi&)
& & & & public TimeView(Context context, AttributeSet attrs,int defStyle) {
& & & & & & & & super(context, attrs, defStyle);
& & & & & & & &
& & & & public TimeView(Context context, AttributeSet attrs) {
& & & & & & & & super(context, attrs);
& & & & & & & &
& & & & public TimeView(Context context) {
& & & & & & & & super(context);
& & & & & & & &
& & & & @Override
& & & & protected void onFinishInflate(){
& & & & & & & & super.onFinishInflate();
& & & & & & & & tvTime=(TextView)findViewById(R.id.tvTime);
& & & & & & & & tvTime.setText(&hello&);
& & & & & & & & timerhandler.sendEmptyMessage(0);
& & & & //可见状态改变
& & & & public void onVisibilityChanged(View changedView,int visibility){
& & & & & & & & super.onVisibilityChanged(changedView, visibility);
& & & & & & & & if(visibility==View.VISIBLE){
& & & & & & & & & & & & timerhandler.sendEmptyMessage(0);
& & & & & & & & }else{
& & & & & & & & & & & & timerhandler.removeMessages(0);
& & & & & & & & }
& & & & private void refreshTime(){
& & & & & & & & System.out.print(&&&&&&&&&&);
& & & & & & & & Calendar c=Calendar.getInstance();
& & & & & & & & tvTime.setText(String.format(&%d;%d;%d&, c.get(Calendar.HOUR_OF_DAY),c.get(Calendar.MINUTE),c.get(Calendar.SECOND)));
& & & & private Handler timerhandler=new Handler(){
& & & & & & & & public void handleMessage(android.os.Message msg){
& & & & & & & & & & & & refreshTime();
& & & & & & & & & & & & if(getVisibility()==View.VISIBLE)
& & & & & & & & & & & & //1000ms以后在执行这个handleMessage方法
& & & & & & & & & & & & timerhandler.sendEmptyMessageAtTime(0,1000);
& & & & & & & & };
& & & & };
& & & & private TextView tvT
这是activity_main.xml
&?xml version=&1.0& encoding=&utf-8&?&
&FrameLayout xmlns:android=&/apk/res/android&
& & android:id=&@+id/FrameLayout01&& &
& & android:layout_width=&wrap_content&& &
& & android:layout_height=&wrap_content&
& & &TabHost
& && &&&android:id=&@android:id/tabhost&
& && &&&android:layout_width=&match_parent&
& && &&&android:layout_height=&match_parent& &
& && &&&&LinearLayout
& && && && &android:layout_width=&match_parent&
& && && && &android:layout_height=&match_parent&
& && && && &android:orientation=&vertical& &
& && && && &&TabWidget
& && && && && & android:id=&@android:id/tabs&
& && && && && & android:layout_width=&match_parent&
& && && && && & android:layout_height=&wrap_content& &
& && && && &&/TabWidget&
& && && && &&FrameLayout
& && && && && & android:id=&@android:id/tabcontent&
& && && && && & android:layout_width=&match_parent&
& && && && && & android:layout_height=&match_parent& &
& && && && && & &com.example.timemanager3.TimeView
& && && && && && &&&android:id=&@+id/tabTime&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && && &&&&TextView android:id=&@+id/tvTime&
& && && && && && && && &android:textAppearance=&?android:attr/textAppearanceLarge&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:layout_width=&fill_parent&
& && && && && && && && &android:layout_height=&fill_parent&/&
& && && && && & &/com.example.timemanager3.TimeView&
& && && && && & &LinearLayout
& && && && && && &&&android:id=&@+id/tabAlarm&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && && &&&&ListView
& && && && && && && && &android:id=&@+id/lvAlarmList&
& && && && && && && && &android:layout_height=&fill_parent&
& && && && && && && && &android:layout_width=&1dp&&
& && && && && && &&&&/ListView&
& && && && && && &&&&Button
& && && && && && && && &android:id=&@+id/btnAddAlarm&
& && && && && && && && &android:text=&@+string/Add_alarm&
& && && && && && && && &android:layout_width=&fill_parent&
& && && && && && && && &android:layout_height=&wrap_content&/&
& && && && && & &/LinearLayout&
& && && && && & &LinearLayout
& && && && && && &&&android:id=&@+id/tabtimer&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && & &/LinearLayout&
& && && && && &
& && && && && & &LinearLayout
& && && && && && &&&android:id=&@+id/tapstopwatch&
& && && && && && &&&android:orientation=&vertical&
& && && && && && &&&android:layout_width=&match_parent&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && & &/LinearLayout&
& && && && &&/FrameLayout&
& && &&&&/LinearLayout&
& & &/TabHost&
&/FrameLayout&
这个是AlarmView.Java
package com.example.timemanager3;
import java.util.D
import android.annotation.SuppressL
import android.content.C
import android.util.AttributeS
import android.view.V
import android.widget.ArrayA
import android.widget.B
import android.widget.LinearL
import android.widget.ListV
@SuppressLint(&NewApi&)
public class AlarmView extends LinearLayout {
& & & & public AlarmView(Context context, AttributeSet attrs, int defStyle) {
& & & & & & & & super(context, attrs, defStyle);
& & & & & & & &
& & & & public AlarmView(Context context, AttributeSet attrs) {
& & & & & & & & super(context);
& & & & & & & &
& & & & public AlarmView(Context context) {
& & & & & & & & super(context);
& & & & & & & &
& & & & @Override
& & & & protected void onFinishInflate(){
& & & & & & & & super.onFinishInflate();
& & & & & & & &
& & & & & & & & btnAddAlarm=(Button) findViewById(R.id.btnAddAlarm);
& & & && &&&lvAlarmList=(ListView)findViewById(R.id.lvAlarmList);
& & & && &&&adapter=new ArrayAdapter&AlarmView.AlarmDate&(getContext(),android.R.layout.simple_list_item_1);
& & & && &&&lvAlarmList.setAdapter(adapter);
& & & && &&&
& & & && &&&adapter.add(new AlarmDate(System.currentTimeMillis()));
& & & && &&&btnAddAlarm.setOnClickListener(new View.OnClickListener() {
& & & & & & & & & & & &
& & & & & & & & & & & & public void onClick(View v) {
& & & & & & & & & & & & & & & & addAlarm();
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & }
& & & & & & & & });
& & & & private void addAlarm(){
& & & & & & & &
& & & & private Button btnAddA
& & & & private ListView lvAlarmL
& & private ArrayAdapter&AlarmDate&
& & private static class AlarmDate{
& & & & & & private long time=0;
& & & & & & private String timeLabel=&&;
& && &&&private D
& & & & & &
& & & & & & & &
& & & & & & & & @SuppressWarnings(&deprecation&)
& & & & & & & & public AlarmDate(long time){
& & & & & & & & & & this.time=
& & & & & & & & & & date=new Date(time);
& & & & & & & & & & timeLabel=date.getHours()+&:&+date.getMinutes();
& & & & & & }
& & & & & & & &
& & & & & & & & public long getTime(){
& & & & & & & & & & & &
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public String toString(){
& & & & & & & & & & & & return getTimeLabel();
& & & & & & & & }
& & & & & & & & public String getTimeLabel(){
& & & & & & & & & & & & return timeL
& & & & & & & & }
& & & & & & & &
logcat里的
06-05 03:13:36.706: D/dalvikvm(1653): GC_CONCURRENT freed 354K, 19% free K, paused 8ms+20ms, total 124ms
06-05 03:13:39.456: D/dalvikvm(1653): GC_CONCURRENT freed 388K, 19% free K, paused 6ms+18ms, total 102ms
06-05 03:13:42.655: D/dalvikvm(1653): GC_CONCURRENT freed 389K, 19% free K, paused 7ms+22ms, total 113ms
06-05 03:13:48.636: D/dalvikvm(1653): GC_CONCURRENT freed 390K, 18% free K, paused 74ms+107ms, total 372ms
06-05 03:13:56.116: D/dalvikvm(1653): GC_CONCURRENT freed 406K, 17% free K, paused 120ms+26ms, total 517ms
06-05 03:14:01.656: D/dalvikvm(1653): GC_CONCURRENT freed 399K, 17% free K, paused 1635ms+23ms, total 1832ms
06-05 03:14:05.476: D/dalvikvm(1653): GC_CONCURRENT freed 395K, 17% free K, paused 71ms+23ms, total 198ms
06-05 03:14:09.506: D/dalvikvm(1653): GC_CONCURRENT freed 393K, 17% free K, paused 19ms+20ms, total 152ms
06-05 03:14:10.665: D/dalvikvm(1653): GC_FOR_ALLOC freed 148K, 19% free K, paused 46ms, total 49ms
06-05 03:14:10.665: I/dalvikvm-heap(1653): Grow heap (frag case) to 3.248MB for 196234-byte allocation
06-05 03:14:10.756: D/dalvikvm(1653): GC_FOR_ALLOC freed 128K, 21% free K, paused 83ms, total 83ms
06-05 03:14:23.496: E/Trace(1730): error opening trace file: No such file or directory (2)
06-05 03:14:24.476: D/dalvikvm(1730): GC_CONCURRENT freed 55K, 7% free K, paused 19ms+15ms, total 127ms
06-05 03:14:24.525: W/Resources(1730): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f040004}
06-05 03:14:27.206: D/dalvikvm(1730): GC_CONCURRENT freed 291K, 14% free K, paused 10ms+24ms, total 127ms
06-05 03:14:28.826: D/dalvikvm(1730): GC_CONCURRENT freed 382K, 16% free K, paused 6ms+25ms, total 111ms
06-05 03:14:30.126: D/dalvikvm(1730): GC_CONCURRENT freed 392K, 16% free K, paused 8ms+22ms, total 107ms
06-05 03:14:31.487: D/dalvikvm(1730): GC_CONCURRENT freed 393K, 17% free K, paused 9ms+29ms, total 115ms
木有找到id
木有找到id
& & & & 说的是MainActivity第42行setIndicator(&闹钟&).setContent(R.id.tabAlarm));,可是ativity_main.xml里android:id=&@+id/tabAlarm&有啊,应该注册到R文件里了,怎么还会找不到呢
查看原网页[0]&
举报本内容
&&&&&&&&&&&&&&&&&&&&&&&&&& 0:21:07
&&网站联系: qq: email:&
Android开发资料网

我要回帖

更多关于 帮忙看看我的阴唇 的文章

 

随机推荐