![](/img/trans.png)
[英]Warning: Activity not started , its current task has been brought to the front
[英]ActivityManager: Warning: Activity not started, its current task has been brought to the front. All the related answer I have read were not fruitful.
我嘗試編輯代碼,因為它將在模擬器上重新安裝該應用程序,但是我又一次又一次遇到相同的錯誤。
就是說編輯源查找路徑並顯示一個按鈕。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/images"
android:orientation="vertical" >
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Enter the text here"
android:textColor="#000000"
android:textSize="30dp" />
<EditText
android:id="@+id/textReader"
android:layout_width="match_parent"
android:layout_height="150dp"
android:inputType="textMultiLine"
/>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/startReading"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Start reading"
android:textSize="15dp" />
<Button
android:id="@+id/clearBox"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Clear Box"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="7.58" >
</RelativeLayout>
</LinearLayout>
<EditText
android:id="@+id/textDisplay"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
那就是上面的main.xml文件。
package a.fr.read;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class FastreaderActivity extends Activity {
/** Called when the activity is first created. */
Button startReading,clearBox;
EditText textReader;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startReading=(Button)findViewById(R.id.textReader);
clearBox=(Button)findViewById(R.id.textReader);
textReader=(EditText) findViewById(R.id.textReader);
clearBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
textReader.setText("");
}
});
startReading.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
}
}
這是java代碼。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="a.fr.read"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<activity
android:name=".FastreaderActivity"
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>
那是Android清單文件。
首先清理您的項目,並刷新該項目(在Eclipse-Project-clean中)以進行刷新(轉到該projectName(ListVeiwdemo),然后單擊鼠標右鍵並刷新選項。)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.