Noob Android developer here I have more graphics than code, but I thought I would start doing more coding. Anyway, I have several buttons on my main activity page, and I want a different class / activity to open when I click the button. I tried all the methods that I was looking for and something still doesnβt work, when I press the button in the emulator, it just doesnβt do anything, is there ancestors or something is just nothing, someone is pointing me in the right direction you are welcome.
The code from the main page on which the button is located:
public class StartingPoint extends Activity { protected void onCreate(Bundle aim) { super.onCreate(aim); setContentView(R.layout.main); final Button bSL = (Button) findViewById(R.id.bSongList); bSL.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent SongList = new Intent(StartingPoint.this, SongList.class); StartingPoint.this.startActivity(SongList); } }); } }
manifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="myname.appname" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="10" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar" > <activity android:name=".Splash" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > <intent-filter> <action android:name="myname.appname.SPLASH" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".StartingPoint" android:label="@string/app_name" > <intent-filter> <action android:name="myname.appname.STARTINGPOINT" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name=".SongList" android:label="@string/app_name" > <intent-filter> <action android:name="myname.appname.SONGLIST" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest>
-L
Last 3 lines of logcat just after clicking the button in question. 01-02 21:59:50.473: I/ActivityManager(75): Starting: Intent { cmp=myname.appname/.SongList } from pid 681 01-02 21:59:52.953: I/ActivityManager(75): Displayed myname.appname/.SongList: +2s351ms 01-02 21:59:58.565: D/dalvikvm(348): GC_EXPLICIT freed 8K, 55% free 2591K/5703K, external 1625K/2137K, paused 520ms
source share