2010-02-02 15 views
6

शुरू नहीं करता है, मैं अपना पहला एंड्रॉइड एप्लिकेशन बना रहा हूं लेकिन यह बिल्कुल शुरू नहीं होता है।पहला एंड्रॉइड टेस्ट प्रोजेक्ट

मेरी src में> android.SampleApp मैं साथ Main.java नामक एक जावा फ़ाइल बनाई:

public class Main extends Activity { 

// Will be connected with the buttons via XML 
public void myClickHandler(View view) { 
    switch (view.getId()) { 
    case R.id.btn1: 
     ((EditText) findViewById(R.id.txtContent)).setText("Button 1 Clicked"); 
     break; 
    case R.id.btn2: 
     ((EditText) findViewById(R.id.txtContent)).setText("Button 2 Clicked"); 
     break; 

    } 
} 
} 

मेरी रेस में> लेआउट> main.xml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<TextView 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="@string/hello" android:id="@+id/txtContent"/> 
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button One" android:id="@+id/btn1"></Button> 
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button Two" android:id="@+id/btn2"></Button> 

मेरी AndroidManifest.xml सामग्री:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="android.SampleApp" 
    android:versionCode="1" 
    android:versionName="1.0"> 
<application android:icon="@drawable/icon" android:label="@string/app_name"> 


</application> 
<uses-sdk android:minSdkVersion="7" /> 
- एंड्रॉयड लॉन्च

  1. [SampleApp 2010-02-02 01:46:26]:

    मैं इस त्रुटि मिलती है!

  2. [2010-02-02 01:46:26 - नमूना ऐप] एडीबी सामान्य रूप से चल रहा है।
  3. [2010-02-02 01:46:26 - नमूना ऐप] कोई लॉन्चर गतिविधि नहीं मिली!
  4. [2010-02-02 01:46:26 - नमूना ऐप] लॉन्च केवल डिवाइस पर एप्लिकेशन पैकेज को सिंक करेगा!
  5. [2010-02-02 01:46:26 - SampleApp] समन्वयन निष्पादित

लाइन्स 3 और 4 लाल रंग से हाइलाइट किया गया है।

क्या कोई व्यक्ति मुझे एमुलेटर पर दिखाने के लिए सही दिशा में ले जा सकता है? ग्रहण

साथ

एंड्रॉयड 2.1 एसडीके

उत्तर

11

आप अपने मैनिफ़ेस्ट फ़ाइल में अपने <activity> टैग में निम्न याद कर रहे हैं:

 <intent-filter . . . > 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 

अधिक जानकारी के लिए here

+0

तुम मेरे ऊपर संपादित किया जा सका देख सकते हैं और दे पूरा टिंग क्योंकि मुझे नहीं पता कि कोड कहां रखना है। –

+2

यह '<गतिविधि एंड्रॉइड: नाम =" मुख्य ">' और ' 'के बीच जाता है, जो स्वयं आपके' ' टैग के अंदर जाता है। –

+0

यदि आप उस पृष्ठ के अंदर "android.intent.action.MAIN" खोजते हैं, तो आप एक अच्छा उदाहरण देखेंगे। –

संबंधित मुद्दे