Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java &引用;不幸的是,我的应用程序已停止;_Java_Android_Eclipse_Android Emulator_Syntax Error - Fatal编程技术网

Java &引用;不幸的是,我的应用程序已停止;

Java &引用;不幸的是,我的应用程序已停止;,java,android,eclipse,android-emulator,syntax-error,Java,Android,Eclipse,Android Emulator,Syntax Error,我正在为android创建一个应用程序,但发现一个错误“不幸的是,我的应用程序已停止”,请帮助我 AndroidManifest.xml SecondActivity.java 请帮助他解决问题 也请帮助我创建这样的简单应用??请帮帮我 图像:i.stack.imgur.com/20iUi.jpg清单文件中的包名在IMO中不累加。请首先尝试更正它们 package="com.example.techtips" 及 尝试将第二个更改为: <activity andro

我正在为android创建一个应用程序,但发现一个错误“不幸的是,我的应用程序已停止”,请帮助我

AndroidManifest.xml

SecondActivity.java

请帮助他解决问题

也请帮助我创建这样的简单应用??请帮帮我


图像:i.stack.imgur.com/20iUi.jpg

清单文件中的包名在IMO中不累加。请首先尝试更正它们

package="com.example.techtips"


尝试将第二个更改为:

 <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >


不,不,不,我的朋友。我们需要看看logcat,了解它为什么停止工作。此外,知道它何时停止工作也会有帮助(在启动时,尝试单击按钮等)。同意,这是太多的信息。Eclipse视图“LogCat”将向您显示应用程序的日志。您应该会看到一大块红色文本,这是堆栈跟踪(崩溃日志)。这些信息应该能让别人帮助你。我看你是新来的,所以需要一点帮助。尝试读取日志并查看错误发生的位置。发布日志,并对应用程序崩溃时正在执行的操作进行一些解释。发布您认为与崩溃相关的代码,而不是代码转储。如果我们认为需要更多的代码,我们会请求更多的代码。要找到LogCat,请转到窗口->显示视图->其他并搜索LogCata。非常感谢您
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

        <TextView

           android:id="@+id/textView1"
           android:layout_gravity="center_horizontal"
           android:textSize="23dp"
           android:layout_marginTop="150dp"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="This Is Fist Activity Activity"/>

        <Button
           android:id="@+id/button1"
           android:layout_gravity="center_horizontal"
           android:layout_marginTop="20dp"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="      Second Activity     " 
           android:onClick="startSecondActivity"/>


        </LinearLayout>
        package com.example.techtips;

        import android.os.Bundle;
        import android.app.Activity;
        import android.content.Intent;
        import android.util.Log;
        import android.view.View;
        import android.widget.Toast;


     public class MainActivity extends Activity {
         /** Called when the activity is first created. */

     @Override

       public void onCreate(Bundle savedInstanceState) 
     {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Toast.makeText(this, "On Create Called In First Activity",                  

    Toast.LENGTH_LONG).show();
        Log.i("FirstActivity", "Inside onCreate");        
    }   

   @Override

  protected void onStart() {
    // TODO Auto-generated method stub
    super.onStart();
    Toast.makeText(this, "On Start Called In First Activity",    

   Toast.LENGTH_LONG).show();
      Log.i("FirstActivity", "Inside onStart");

   }   

   @Override

    protected void onResume()

 {

       // TODO Auto-generated method stub

       super.onResume();

    Toast.makeText(this, "On Resume Called In First Activity",   

   Toast.LENGTH_LONG).show();
     Log.i("FirstActivity", "Inside onResume");
} 

@Override

protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    Toast.makeText(this, "On Pause Called In First Activity", 

Toast.LENGTH_LONG).show();
    Log.i("FirstActivity", "Inside onPause");
}

 @Override

protected void onStop() {
    // TODO Auto-generated method stub
    super.onStop();

    Toast.makeText(this, "On Stop Called In First Activity", Toast.LENGTH_LONG).show();
    Log.i("FirstActivity", "Inside onStop");
}

@Override

protected void onDestroy() 
 {
    // TODO Auto-generated method stub
    super.onDestroy();
    Toast.makeText(this, "On Destroy Called In First Activity", 

 Toast.LENGTH_LONG).show();
    Log.i("FirstActivity", "Inside onDestroy");

 }
 public void startSecondActivity(View V)
 {
    // create an new Intent and Start Second Activity
    Intent intent=new Intent(this,SecondActivity.class);
    startActivity(intent);
  }
}
  package com.example.techtips;

    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    import android.widget.Toast;


   public class SecondActivity extends Activity
{
  /** Called when the activity is first created. */


@Override

  public void onCreate(Bundle savedInstanceState) 
{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout2);
        Toast.makeText(this, "On Create Called In Second Activity", 

 Toast.LENGTH_LONG).show();
        Log.i("SecondActivity", "Inside onCreate");

}   

@Override

  protected void onStart() {
    // TODO Auto-generated method stub
    super.onStart();
    Toast.makeText(this, "On Start Called In Second Activity", 

   Toast.LENGTH_LONG).show();
    Log.i("SecondActivity", "Inside onStart");
}  

@Override

 protected void onResume()
{
    // TODO Auto-generated method stub
    super.onResume();

    Toast.makeText(this, "On Resume Called In Second Activity", 

    Toast.LENGTH_LONG).show();

           Log.i("SecondActivity", "Inside onResume");
}  

@Override

  protected void onPause() {
     // TODO Auto-generated method stub
    super.onPause();
    Toast.makeText(this, "On Pause Called In Second Activity", 

Toast.LENGTH_LONG).show();
     Log.i("SecondActivity", "Inside onPause");
 }


 @Override

protected void onStop() {
     // TODO Auto-generated method stub
    super.onStop();

    Toast.makeText(this, "On Stop Called In Second Activity",  

  Toast.LENGTH_LONG).show();

            Log.i("SecondActivity", "Inside onStop");
}

 @Override

 protected void onDestroy() 
{
    // TODO Auto-generated method stub
    super.onDestroy();
    Toast.makeText(this, "On Destroy Called In Second Activity", 

  Toast.LENGTH_LONG).show();
    Log.i("SecondActivity", "Inside onDestroy");    
   }
 }
package="com.example.techtips"
   <activity
        android:name="com.techblogon.activitylifecycleexample.MainActivity"
        android:label="@string/app_name" >
 <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >