Jump to content

  • Log In with Google      Sign In   
  • Create Account


First adroid app wont work *SOLVED*


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 NUCLEAR RABBIT   Members   -  Reputation: 247

Like
0Likes
Like

Posted 03 April 2013 - 08:59 PM

Hello, So I coded a portion of my first app, its not 100% done, but I wanted to test what I had learned thus far. Im coding in eclipse, have no errors and i load up my emulator. I cant find the app icon on the phone, but if I click on the emulator and go to applications/sd& applications/manage applications/downloaded it shows up there and when I click it, I dont have an option to open it, just uninstall. Can anyone please help me understand why this is occuring?! been trying to get this going for 2 days :|

 

MainActivity.java

package com.bwall.thenumbergame;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View;
import com.bwall.thenumbergame.R;

public class MainActivity extends Activity {
	
	int number = 0;
	
	TextView textField = (TextView) findViewById(R.id.textField);
	TextView result = (TextView) findViewById(R.id.resultView);
	EditText gameObjective = (EditText) findViewById(R.string.gameObjective);
	Button button = (Button) findViewById(R.string.submitButton);
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		button.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				number = textField.getInputType();
				result.setText("Your Number is " + number + ", bitch!");
			}
		});
		
		
	}
}

 

Attached Thumbnails

  • Screen Shot 2013-04-03 at 6.42.34 PM.png

------------------------My band: RISE OVER ME!

Sponsor:

#2 abhi_100   Members   -  Reputation: 109

Like
2Likes
Like

Posted 04 April 2013 - 02:03 AM

Include the intent filter in ur Androidmanifest file for your main activity  


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

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



#3 dsm1891   Members   -  Reputation: 595

Like
0Likes
Like

Posted 04 April 2013 - 03:38 AM

if ^ doesn't work (and assuming you are running eclipse, Re-run the emulator, I, and many of my friends found, that there can be a slight bug with the emulator where it seems to run a previous instance of it self, I.E. before you made that app, thus it not showing

 

--edit--

:/ sorry, just re-read you post, prob wont be this, but ill leave it here, for future reference, because its darn annoying.


Edited by dsm1891, 04 April 2013 - 03:42 AM.


#4 NUCLEAR RABBIT   Members   -  Reputation: 247

Like
0Likes
Like

Posted 04 April 2013 - 12:50 PM

Include the intent filter in ur Androidmanifest file for your main activity  


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

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

 

 

I tried adding this to the androidmanifiest file but still no luck :(

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bwall.thenumbergame"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.bwall.thenumbergame.MainActivity"
            android:label="@string/title_activity_main" >
        </activity>

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

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

</manifest>

------------------------My band: RISE OVER ME!

#5 NUCLEAR RABBIT   Members   -  Reputation: 247

Like
0Likes
Like

Posted 04 April 2013 - 12:57 PM

Include the intent filter in ur Androidmanifest file for your main activity  


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

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

 

 

I tried adding this to the androidmanifiest file but still no luck sad.png

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bwall.thenumbergame"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.bwall.thenumbergame.MainActivity"
            android:label="@string/title_activity_main" >
        </activity>

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

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

</manifest>

 

 

Also shows this in the debugger

ScreenShot2013-04-04at115429AM.png


------------------------My band: RISE OVER ME!

#6 Cornstalks   Crossbones+   -  Reputation: 6966

Like
0Likes
Like

Posted 04 April 2013 - 01:01 PM


Include the intent filter in ur Androidmanifest file for your main activity  

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

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

 
 
I tried adding this to the androidmanifiest file but still no luck sad.png


That's because it needs to go *inside* the activity node, like this:
 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bwall.thenumbergame"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.bwall.thenumbergame.MainActivity"
            android:label="@string/title_activity_main" >

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

</manifest>
 
[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

#7 NUCLEAR RABBIT   Members   -  Reputation: 247

Like
0Likes
Like

Posted 04 April 2013 - 01:22 PM

 

Include the intent filter in ur Androidmanifest file for your main activity  

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

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

 
 
I tried adding this to the androidmanifiest file but still no luck sad.png

 

That's because it needs to go *inside* the activity node, like this:
 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bwall.thenumbergame"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.bwall.thenumbergame.MainActivity"
            android:label="@string/title_activity_main" >

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

</manifest>
 

 

 

Thanks a BUNCH! biggrin.png

 

just got to figure out why it exits right when I start the app now! Exits unexpectedly...Ill be back if I cannot figure this problem out!


------------------------My band: RISE OVER ME!

#8 adt7   Members   -  Reputation: 425

Like
0Likes
Like

Posted 05 April 2013 - 07:25 AM

It exits unexpectedly because the following lines of code need to be moved to onCreate, after the call to SetContentView.

 

 

 

 

TextView textField = (TextView) findViewById(R.id.textField);
TextView result = (TextView) findViewById(R.id.resultView);
EditText gameObjective = (EditText) findViewById(R.string.gameObjective);
Button button = (Button) findViewById(R.string.submitButton);
 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS