Note that there are some explanatory texts on larger screens.

plurals
  1. POopening a mapview on a button click from another class
    primarykey
    data
    text
    <p>I dont understand what seems to be the problem here...my app just crashes. And i get the followin logcat error: ERROR/dalvikvm(1270): Could not find class 'intentTest.xyz.com.second', referenced from method intentTest.xyz.com.intentTest$1.onClick</p> <p>1.intentTest.java:</p> <pre><code>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 the activity is 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); } }); } } </code></pre> <p>2.main.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="First screen" /&gt; &lt;Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="map" android:id="@+id/b" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>3.second.java:</p> <pre><code> 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 the activity is 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; } } </code></pre> <p>4.second.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" /&gt; </code></pre> <p>5.manifest.xml:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="intentTest.xyz.com" android:versionCode="1" android:versionName="1.0"&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".intentTest" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".second" android:label="@string/app_name"&gt; &lt;uses-library android:name="com.google.android.maps" /&gt; &lt;/activity&gt; &lt;/application&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;/manifest&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload