如果您对java–setContentView上的另一个资源$NotFoundException感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于java–setContent
如果您对java – setContentView上的另一个资源$NotFoundException感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于java – setContentView上的另一个资源$NotFoundException的详细内容,我们还将为您解答java setcontenttype的相关问题,并且为您提供关于Adapter.getView上的参数convertView上的IllegalArgumentException、android – java.lang.RuntimeException:无法实例化活动ComponentInfo / java.lang.ClassNotFoundException、android – java.lang.RuntimeException:无法实例化活动ComponentInfo … java.lang.ClassNotFoundException、android.content.ActivityNotFoundException: No Activity found to handle Intent的有价值信息。
本文目录一览:- java – setContentView上的另一个资源$NotFoundException(java setcontenttype)
- Adapter.getView上的参数convertView上的IllegalArgumentException
- android – java.lang.RuntimeException:无法实例化活动ComponentInfo / java.lang.ClassNotFoundException
- android – java.lang.RuntimeException:无法实例化活动ComponentInfo … java.lang.ClassNotFoundException
- android.content.ActivityNotFoundException: No Activity found to handle Intent
java – setContentView上的另一个资源$NotFoundException(java setcontenttype)
Stack Overflow上有很多资源$NotFoundException问题,我已经审阅了它们,并尝试了各种建议无济于事.
我有一个完美的工作布局,显示一些图形与下面的一些按钮,我修改了一些按钮,并开始得到这个错误.我没有看到我的更改有什么问题,但只是为了缩小它我删除了所有按钮,所以现在我只有一个带有ImageView的LinearLayout,我仍然得到错误.我的Java:
try {
setContentView(R.layout.graphics);
}
catch (Exception e) {
Log.d("DGraphActivity", "setContentView crash");
}
我的XML:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/image2"
android:layout_width="0px"
android:layout_weight="2"
android:layout_height="match_parent"
android:scaleType="fitCenter">
</ImageView>
</LinearLayout>
错误说android.content.res.Resources $NotFoundException:资源ID#0x7f030005.
在R.java文件中,资源用图形标识. . .
public static final class layout {
public static final int addcomment=0x7f030000;
public static final int areyousure=0x7f030001;
public static final int downarrow=0x7f030002;
public static final int downleftarrow=0x7f030003;
public static final int downrightarrow=0x7f030004;
public static final int graphics=0x7f030005;
public static final int infofromoperator=0x7f030006;
我删除了gen文件夹并做了一个干净的项目没有任何改进.我还重新启动了我的电脑并明确关闭了该项目. graphics.xml文件没有明显的错误 – 它存在于与我所有其他XML文件相同的文件夹中;它没有写保护或隐藏. Eclipse不会标记任何错误或警告.
提前致谢.
解决方法:
我在Android开发者谷歌小组得到了答案,我也发布了这个问题.这位富有洞察力的程序员是“Bob Smith”,只是为了给予应有的信用额度.
我的错误是它正在寻找的资源不在正确的res文件夹中.我的应用在平板电脑上以横向模式运行.在清单中,一切都被限制为以这种方式运行(实际上在代码中,它被限制为在公司随产品提供的一个特定平板电脑上运行).所有资源和布局文件都存在于layout-land中.鲍勃不知道这些,但他问了一个关键问题:我的资源文件真的在正确的res文件夹中吗?
Adapter.getView上的参数convertView上的IllegalArgumentException
java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter convertView
Adapter.getView
at android.widget.AbsListView.obtainView(AbsListView.java:2346)
at android.widget.ListView.makeAndAddView(ListView.java:1876)
at android.widget.ListView.fillDown(ListView.java:702)
at android.widget.ListView.fillFromTop(ListView.java:763)
at android.widget.ListView.layoutChildren(ListView.java:1671)
at android.widget.AbsListView.onLayout(AbsListView.java:2148)
这是android的logcat.
我尝试使用Java正常工作的基本适配器,在Adapter或其他适配器中出了点问题.
我尝试使用公共构造函数,并且发现数组列表计数3已检查.总是在getView崩溃
MyAdapter代码::
inner class MyAppAdapter constructor(private val parkingList: ArrayList<App>, private val mContext: Context) : BaseAdapter() {
override fun getCount(): Int {
return this.parkingList.size
}
override fun getItem(position: Int): Any {
return position
}
override fun getItemId(position: Int): Long {
return position.toLong()
}
override fun getView(position: Int, convertView: View, parent: ViewGroup): View? {
val viewHolder: ViewHolder
var rowView: View? = convertView
if (rowView == null) {
rowView = LayoutInflater.from(mContext).inflate(R.layout.item_more_apps, parent, false)
viewHolder = ViewHolder()
viewHolder.appIcon = rowView.findViewById(R.id.appIcon)
viewHolder.appName = rowView.findViewById(R.id.appName)
viewHolder.appDescription = rowView.findViewById(R.id.appDescription)
rowView.tag = viewHolder
} else {
viewHolder = convertView.tag as ViewHolder
}
viewHolder.appName!!.text = String.format("%s", this.parkingList[position].name)
viewHolder.appDescription!!.text = String.format("%s", this.parkingList[position].description)
Glide.with(applicationContext).load(this.parkingList[position].icon).into(viewHolder.appIcon!!)
rowView?.setonClickListener {
try {
startActivity(Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + this@MyAppAdapter.parkingList[position].link)))
} catch (e: ActivityNotFoundException) {
startActivity(Intent("android.intent.action.VIEW", Uri.parse("http://play.google.com/store/apps/details?id=" + this@MyAppAdapter.parkingList[position].link)))
}
}
return rowView
}
inner class ViewHolder {
var appDescription: TextView? = null
var appIcon: ImageView? = null
var appName: TextView? = null
}
}
在AsyncTask中使用-> onPostExecute
myAppAdapter = MyAppAdapter(appArrayList, applicationContext)
lvPoses!!.adapter = myAppAdapter
像这样清除变量
lateinit var myAppAdapter: MyAppAdapter
private val appArrayList = ArrayList<App>()
private var lvPoses: ListView? = null
解决方法:
如果尚未创建视图,则convertView可以为null.修复参数声明:
override fun getView(position: Int, convertView: View?, parent:
ViewGroup): View? {
...
}
android – java.lang.RuntimeException:无法实例化活动ComponentInfo / java.lang.ClassNotFoundException
我忍不住注意到我的MainActivity图标在树的左上角有一个灰色的十字架.
logcat的:
E/AndroidRuntime: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{carpedujourproductions.quickpronote/carpedujourproductions.quickpronote.MainActivity}: java.lang.classNotFoundException: Didn't find class "carpedujourproductions.quickpronote.MainActivity" on path: DexPathList[[zip file "/data/app/carpedujourproductions.quickpronote-2.apk"],nativeLibraryDirectories=[/data/app-lib/carpedujourproductions.quickpronote-2,/vendor/lib,/system/lib]] at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2157) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2281) at android.app.ActivityThread.access$600(ActivityThread.java:148) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1263) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5124) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:110) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.classNotFoundException: Didn't find class "carpedujourproductions.quickpronote.MainActivity" on path: DexPathList[[zip file "/data/app/carpedujourproductions.quickpronote-2.apk"],/system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53) at java.lang.classLoader.loadClass(ClassLoader.java:501) at java.lang.classLoader.loadClass(ClassLoader.java:461) at android.app.Instrumentation.newActivity(Instrumentation.java:1061) at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:2148) ... 12 more
随意浏览AndroidManifest,MainActivity.java,FirstRun.java等代码here.
解决方法
<file url="file://$PROJECT_DIR$/src/carpedujourproductions/quickpronote/MainActivity.java" />
来自.idea / compiler.xml文件的excludeFromCompile部分(或者您可以从IDE设置执行此操作).
android – java.lang.RuntimeException:无法实例化活动ComponentInfo … java.lang.ClassNotFoundException
我有一个问题,我正在处理三天,我试图阅读不同的答案,但它没有帮助.
也有人可以帮助我!
我将Ancdroid应用程序作为客户端编写为一个安静的Web服务.我可以从数据库中获取数据而没有问题,但我的问题是我使用的2个活动来处理来自数据库的这个文件.
主要活动
public class MainActivity extends Activity {
private static final String SERVICE_URL = "http://10.0.2.2:8080/.....";
private static final String TAG = "AndroidRESTClientActivity";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void retrieveSampleData(View vw) {
EditText idTxt = (EditText) findViewById(R.id.id_textfield);
String id = idTxt.getText().toString();
String sampleURL = SERVICE_URL +"daten/"+id ;
Log.d("getrespond()", "service calling");
String url =sampleURL;
RestClient client = new RestClient(url);
try{
client.Execute(RestClient.RequestMethod.GET,this.getApplicationContext());
}
catch (Exception e) {
String error = String.valueOf(e);
Log.d("**********client.Execute(RequestMethod.GET);***********",error);
}
try {
if(client.getResponseCode() == 200) {
Log.d("Response is 200", String.valueOf(client.getResponse().length()));
System.out.println(this.getFilesDir().getPath().toString());
File daten= client.getResponse();
System.out.println(daten.getName());
Toast.makeText(this.getApplicationContext(), "Responce is "+String.valueOf(client.getResponseCode()), 2000).show();
} else {
String error = String.valueOf(client.getResponse());
Log.d("Response*********** not 200 ************", String.valueOf(client.getResponse()));
}
}catch (Exception e) {
e.printstacktrace();
Log.d("EXCEPTIONI IS 3", e.toString());
// Todo: handle exception
}
startActivity(new Intent("android.intent.action.LINEGRAPH"));
我从主要开始的另一项活动:
public class lineGraph extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_line_graph);
}
@Override
protected void onResume() {
super.onResume();
if (mChartView == null) {
LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
try {
mChartView = ChartFactory.getLineChartView(this, getDemoDataset(),
getDemoRenderer());
} catch (IOException e) {
// Todo Auto-generated catch block
e.printstacktrace();
}
layout.addView(mChartView, new LayoutParams
(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
} else {
mChartView.repaint();
}
}
的Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.praktikum.androidcrestclient"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.praktikum.androidcrestclient.LineGraph"
android:label="@string/title_activity_line_graph" >
<intent-filter>
<action android:name="android.intent.action.LINEGRAPH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="org.achartengine.GraphicalActivity"/>
</application>
</manifest>
在这里我的LogCat
10-08 09:23:10.140: D/AndroidRuntime(4706): Shutting down VM
10-08 09:23:10.140: W/dalvikvm(4706): threadid=1: thread exiting with uncaught exception (group=0x40015560)
10-08 09:23:10.161: E/AndroidRuntime(4706): FATAL EXCEPTION: main
10-08 09:23:10.161: E/AndroidRuntime(4706): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.praktikum.androidcrestclient/com.praktikum.androidcrestclient.LineGraph}: java.lang.classNotFoundException: com.praktikum.androidcrestclient.LineGraph in loader dalvik.system.PathClassLoader[/data/app/com.praktikum.androidcrestclient-1.apk]
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:1569)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.os.Handler.dispatchMessage(Handler.java:99)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.os.Looper.loop(Looper.java:123)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-08 09:23:10.161: E/AndroidRuntime(4706): at java.lang.reflect.Method.invokeNative(Native Method)
10-08 09:23:10.161: E/AndroidRuntime(4706): at java.lang.reflect.Method.invoke(Method.java:507)
10-08 09:23:10.161: E/AndroidRuntime(4706): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-08 09:23:10.161: E/AndroidRuntime(4706): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-08 09:23:10.161: E/AndroidRuntime(4706): at dalvik.system.NativeStart.main(Native Method)
10-08 09:23:10.161: E/AndroidRuntime(4706): Caused by: java.lang.classNotFoundException: com.praktikum.androidcrestclient.LineGraph in loader dalvik.system.PathClassLoader[/data/app/com.praktikum.androidcrestclient-1.apk]
10-08 09:23:10.161: E/AndroidRuntime(4706): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
10-08 09:23:10.161: E/AndroidRuntime(4706): at java.lang.classLoader.loadClass(ClassLoader.java:551)
10-08 09:23:10.161: E/AndroidRuntime(4706): at java.lang.classLoader.loadClass(ClassLoader.java:511)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
10-08 09:23:10.161: E/AndroidRuntime(4706): at android.app.ActivityThread.performlaunchActivity(ActivityThread.java:1561)
10-08 09:23:10.161: E/AndroidRuntime(4706): ... 11 more
10-08 09:23:10.180: W/ActivityManager(89): Force finishing activity com.praktikum.androidcrestclient/.LineGraph
10-08 09:23:10.180: W/ActivityManager(89): Force finishing activity com.praktikum.androidcrestclient/.MainActivity
10-08 09:23:10.690: W/ActivityManager(89): Activity pause timeout for HistoryRecord{4094eea0 com.praktikum.androidcrestclient/.LineGraph}
10-08 09:23:12.330: I/Process(4706): Sending signal. PID: 4706 SIG: 9
10-08 09:23:12.350: I/ActivityManager(89): Process com.praktikum.androidcrestclient (pid 4706) has died.
10-08 09:23:12.360: E/Inputdispatcher(89): channel '4065ae98 com.praktikum.androidcrestclient/com.praktikum.androidcrestclient.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
10-08 09:23:12.360: E/Inputdispatcher(89): channel '4065ae98 com.praktikum.androidcrestclient/com.praktikum.androidcrestclient.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
10-08 09:23:12.490: I/WindowManager(89): WIN DEATH: Window{4065ae98 com.praktikum.androidcrestclient/com.praktikum.androidcrestclient.MainActivity paused=true}
10-08 09:23:12.500: I/WindowManager(89): WIN DEATH: Window{406c1140 Toast paused=false}
10-08 09:23:12.600: W/InputManagerService(89): Got remoteexception sending setActive(false) notification to pid 4706 uid 10034
10-08 09:23:12.660: E/Inputdispatcher(89): Received spurIoUs receive callback for unkNown input channel. fd=168, events=0x8
10-08 09:23:16.820: D/dalvikvm(396): GC_EXPLICIT freed 7K, 54% free 2537K/5511K, external 1625K/2137K, paused 43ms
10-08 09:23:21.626: W/ActivityManager(89): Activity destroy timeout for HistoryRecord{4094e768 com.praktikum.androidcrestclient/.MainActivity}
10-08 09:23:21.626: W/ActivityManager(89): Activity destroy timeout for HistoryRecord{4094eea0 com.praktikum.androidcrestclient/.LineGraph}
10-08 09:23:21.900: D/dalvikvm(299): GC_EXPLICIT freed 12K, 55% free 2589K/5703K, external 1625K/2137K, paused 73ms
10-08 09:23:26.950: D/dalvikvm(407): GC_EXPLICIT freed 4K, 55% free 2532K/5511K, external 1625K/2137K, paused 57ms
10-08 09:24:54.097: D/SntpClient(89): request time Failed: java.net.socketException: Address family not supported by protocol
10-08 09:29:54.106: D/SntpClient(89): request time Failed: java.net.socketException: Address family not supported by protocol
10-08 09:34:54.130: D/SntpClient(89): request time Failed: java.net.socketException: Address family not supported by protocol
你能帮我找一下为什么它找不到这个其他的活动.
谢谢
解决方法:
在此声明中将类的名称更改为“LineGraph”而不是“lineGraph”:
public class LineGraph extends Activity{
android.content.ActivityNotFoundException: No Activity found to handle Intent
log:
12-07 14:35:20.541: I/System.out(272): 1:00
12-07 14:35:20.561: D/AndroidRuntime(272): Shutting down VM
12-07 14:35:20.561: W/dalvikvm(272): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-07 14:35:20.581: E/AndroidRuntime(272): FATAL EXCEPTION: main
12-07 14:35:20.581: E/AndroidRuntime(272): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.iStudy.Studying (has extras) }
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Activity.startActivityForResult(Activity.java:2817)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Activity.startActivity(Activity.java:2923)
12-07 14:35:20.581: E/AndroidRuntime(272): at com.iStudy.Study.Main$1.onClick(Main.java:77)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.view.View.performClick(View.java:2408)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.view.View$PerformClick.run(View.java:8816)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.os.Handler.handleCallback(Handler.java:587)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.os.Handler.dispatchMessage(Handler.java:92)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.os.Looper.loop(Looper.java:123)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-07 14:35:20.581: E/AndroidRuntime(272): at java.lang.reflect.Method.invokeNative(Native Method)
12-07 14:35:20.581: E/AndroidRuntime(272): at java.lang.reflect.Method.invoke(Method.java:521)
12-07 14:35:20.581: E/AndroidRuntime(272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-07 14:35:20.581: E/AndroidRuntime(272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-07 14:35:20.581: E/AndroidRuntime(272): at dalvik.system.NativeStart.main(Native Method)
MainFest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.iStudy.Study" android:versionCode="1" android:versionName="0.1 beta" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/AppName" > <activity android:name=".Main"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Studying" android:exported="false"> <intent-filter> <action android:name="com.iStudy.Study.Studying" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest>
出错的JAVA文件:
package com.iStudy.Study; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.Window; import android.widget.TextView; public class Studying extends Activity{ static int minute = -1; static int second = -1; final static String tag = "tag"; TextView timeview; Timer timer; TimerTask timertask; Handler handler = new Handler(){ public void handleMessage(Message msg) { System.out.println("Handle!"); if (minute == 0) { if (second == 0) { timeview.setText("学习成功!"); if (timer != null) { timer.cancel(); timer = null; } if (timertask != null) { timertask = null; } }else { second--; if (second >= 10) { timeview.setText("0"+minute + ":" + second); }else { timeview.setText("0"+minute + ":0" + second); } } }else { if (second == 0) { second =59; minute--; if (minute >= 10) { timeview.setText(minute + ":" + second); }else { timeview.setText("0"+minute + ":" + second); } }else { second--; if (second >= 10) { if (minute >= 10) { timeview.setText(minute + ":" + second); }else { timeview.setText("0"+minute + ":" + second); } }else { if (minute >= 10) { timeview.setText(minute + ":0" + second); }else { timeview.setText("0"+minute + ":0" + second); } } } } }; }; @Override protected void onCreate(Bundle savedInstanceState) { Log.v(tag, "log---------->onCreate!"); requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.studying); timeview = (TextView)findViewById(R.id.Time); if (minute == -1 && second == -1) { Intent intent = getIntent(); ArrayList<Integer> times = intent.getIntegerArrayListExtra("times"); minute = times.get(0); second = times.get(1); } timeview.setText(minute + ":" + second); timertask = new TimerTask() { @Override public void run() { Message msg = new Message(); msg.what = 0; handler.sendMessage(msg); } }; timer = new Timer(); timer.schedule(timertask,0,1000); } @Override protected void onDestroy() { Log.v(tag, "log---------->onDestroy!"); if (timer != null) { timer.cancel(); timer = null; } if (timertask != null) { timertask = null; } minute = -1; second = -1; super.onDestroy(); } @Override protected void onStart() { Log.v(tag, "log---------->onStart!"); super.onStart(); } @Override protected void onStop() { Log.v(tag, "log---------->onStop!"); super.onStop(); } @Override protected void onResume() { Log.v(tag, "log---------->onResume!"); super.onResume(); } @Override protected void onRestart() { Log.v(tag, "log---------->onRestart!"); super.onRestart(); } @Override protected void onPause() { Log.v(tag, "log---------->onPause!"); super.onPause(); } }源码下载地址: http://www.kuaipan.cn/file/id_47491729724613150.htm
关于java – setContentView上的另一个资源$NotFoundException和java setcontenttype的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于Adapter.getView上的参数convertView上的IllegalArgumentException、android – java.lang.RuntimeException:无法实例化活动ComponentInfo / java.lang.ClassNotFoundException、android – java.lang.RuntimeException:无法实例化活动ComponentInfo … java.lang.ClassNotFoundException、android.content.ActivityNotFoundException: No Activity found to handle Intent的相关知识,请在本站寻找。
本文标签: