2013-07-01 84 views
0

我的應用程序的工作不錯,但分配按鈕bbtnsetOnClickListener後的應用程序不會在模擬器上加載並給了我以下錯誤:Android的幫助按鈕setOnclickListener

ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.Hawa.hawa_pro/.MainActivity } 
ActivityManager: Warning: Activity not started, its current task has been brought to the front 

代碼:

package com.Hawa.hawa_pro; 

import android.os.Bundle; 
import android.app.ActionBar.Tab; 
import android.app.Activity; 
import android.app.TabActivity; 
import android.content.Intent; 
import android.util.Log; 
import android.view.Menu; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.Button; 
import android.widget.TabHost; 
import android.content.res.Resources; 


public class MainActivity extends TabActivity { 

private TabHost mTabHost; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    Button bbtn= (Button) findViewById(R.id.button4); 
    bbtn.setOnClickListener(new OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      // TODO Auto-generated method stub 
      Intent i= new Intent(MainActivity.this,beauty.class); 
      startActivity(i); 
     } 
    }); 

    Resources res= getResources(); 
    mTabHost =getTabHost(); 
    TabHost.TabSpec spec; 
    Intent intent; 

    //Home Tab 
    intent= new Intent(this, Home.class); 

    spec = mTabHost.newTabSpec("Home") 
      .setIndicator("Home",res.getDrawable(R.drawable.homebtn)) 
      .setContent(intent); 
    mTabHost.addTab(spec); 

    //won tab 

intent= new Intent(this, About_wom.class); 

    spec = mTabHost.newTabSpec("About_wom") 
      .setIndicator("About Wom",res.getDrawable(R.drawable.aboutwombtn)) 
      .setContent(intent); 
    mTabHost.addTab(spec); 

intent= new Intent(this, Contact.class); 

    spec = mTabHost.newTabSpec("Contact") 
      .setIndicator("Contact",res.getDrawable(R.drawable.contactbtn)) 
      .setContent(intent); 
    mTabHost.addTab(spec); 
    mTabHost.setCurrentTab(0); 
} 
    } 
+0

這不是錯誤。它說你的當前代碼的輸出已經加載到你的設備/模擬器中。如果您更改或重新構建代碼,它將再次運行。 – Gunaseelan

+0

強制停止您的應用程序從您的模擬器中的設置 - >應用程序,然後運行您的應用程序。 – ryderz8

回答

1

首先退出模擬器上的當前應用程序,然後再次運行你的應用程序:)

0

強制停止你的應用程序從設置在你的模擬器&然後運行。

1

在代碼中的任何位置添加空格(在任何文件中)。只需保存該項目並運行即可。然後它將再次通過上傳和安裝過程。這是在不改變任何重要代碼的情況下最簡單的方法。

0

如果你運行你的Android應用程序項目,那麼它會在模擬器上安裝.apk文件,如果第一次運行項目,然後.apk文件安裝在模擬器上,那麼如果你再次運行項目沒有任何改變,你的上一個應用程序仍然在屏幕上它只是給出了這個警告,不需要擔心只是在項目中做一些改變然後再次運行。