I have a very simple android project. I got the following error message when I try to run it. The emulator is running but the application doesn't come up. I couldn't find any useful information online. Can anyone help me?
Warning: Activity not started, its current task has been brought to the front
public class Profile extends Activity { /*Button button1; CheckBox check1, check2; EditText text1;*/ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
<EditText android:text="@+id/EditText01" android:id="@+id/EditText01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:enabled="false"></ EditText><CheckBox android:text="@+id/CheckBox03" android:id="@+id/ CheckBox03" android:layout_width="fill_parent" android:layout_height="wrap_content"> </CheckBox> <CheckBox android:text="@+id/CheckBox02" android:id="@+id/CheckBox02" android:layout_width="fill_parent" android:layout_height="wrap_content"> </CheckBox> <CheckBox android:text="@+id/CheckBox01" android:id="@+id/CheckBox01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:checked="true"> </CheckBox> </LinearLayout> <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.seiservices.blending" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/ app_name"> <activity android:name=".Profile" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="8" /> </manifest>
i. addFlags(Intent. FLAG_ACTIVITY_REORDER_TO_FRONT) ; which brings back the activity to front.
You opened the new activity from another activity with startActivityForResult. In that case you can just call the finishActivity() function from your code and it'll take you back to the previous activity.
It is not an error message, it is a warning. It means that (a task of) the application is running and that even though a 'startActivity' request was made to run that task, or another activity in the application. The system is just bringing the current task of that application to the foreground. (This can occur if you are running in Eclipse or AndroidStudio with the emulator.)
What the system is trying to tell you: The application on the device is the same as your application in Eclipse. And because the application is already running on the device, the system tells you that it is not going to kill and restart it, but bring the activity of your already running app into the foreground. This is pretty normal. ;-)
The warning will not continue if you edit your code and run it (because the app is then killed, reinstalled and started) or if you kill your process on the phone, e.g. via the DDMS.
I've seen this before - you want to re-run your app even though you may not have made any code changes. On the emulator, click the back button (to the right of the menu button) and then run your app as usual from Eclipse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With