简体   繁体   中英

ActivityManager: Warning: Activity not started, its current task has been brought to the front. All the related answer I have read were not fruitful.

I have tried editing the code as it would re-install the application on the emulator but again I'm getting the same error again and again.

It's saying edit source lookup path and showing a button for it.

    <?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>

That was the main.xml file above.

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

            }
        });
    }
}

And this is the java code.

<?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>

And that was Android manifest file.

首先清理您的项目,并刷新该项目(在Eclipse-Project-clean中)以进行刷新(转到该projectName(ListVeiwdemo),然后单击鼠标右键并刷新选项。)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM