java - opening a mapview on a button click from another class -
i dont understand seems problem here...my app crashes. , followin logcat error: error/dalvikvm(1270): not find class 'intenttest.xyz.com.second', referenced method intenttest.xyz.com.intenttest$1.onclick
1.intenttest.java:
package intenttest.xyz.com; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; public class intenttest extends activity { button b; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); b = (button) findviewbyid(r.id.b); b.setonclicklistener( new view.onclicklistener() { public void onclick(view view) { intent intent = new intent(intenttest.this,second.class ); startactivity(intent); } }); } }
2.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="first screen" /> <button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="map" android:id="@+id/b" /> </linearlayout>
3.second.java:
package intenttest.xyz.com; import com.google.android.maps.mapactivity; import com.google.android.maps.mapview; import android.os.bundle; public class second extends mapactivity{ mapview map; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.second); map = (mapview) findviewbyid(r.id.map); } @override protected boolean isroutedisplayed() { // todo auto-generated method stub return false; } }
4.second.xml:
<?xml version="1.0" encoding="utf-8"?> <com.google.android.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apikey="0ujyc9tw2cyvypeciktqik0pwul-upa_sh4bpiw" />
5.manifest.xml:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="intenttest.xyz.com" android:versioncode="1" android:versionname="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".intenttest" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".second" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> </activity> </application> <uses-permission android:name="android.permission.internet" /> </manifest>
never mind...i rewrote whole code....step step...complied , got out put....probably complier problem
Comments
Post a Comment