Ich versuche, mit Listenansicht zu arbeiten und auf klicken Sie auf eine andere Aktivität öffnen, aber wenn ich die App auf Mobile laufen es zwingen zu stoppen. Unten ist mein Code für HaupttätigkeitForce Stop, wenn App in Moblie ausgeführt
public class MainActivity extends AppCompatActivity implements
AdapterView.OnItemClickListener {
String TopicList[]={"jan","Feb"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView listView=(ListView) findViewById(R.id.topic);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,TopicList);
listView.setAdapter(adapter);
listView.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position==0){
Intent myInternt= new Intent(view.getContext(),Vlookup.class);
startActivityForResult(myInternt,0);
}
if (position==1){
Intent myInternt= new Intent(view.getContext(),Hlookup.class);
startActivityForResult(myInternt,1);
}
}
}
Blockquote
unterhalb meiner Maindest.xml Datei `
Code hier eingeben
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Vlookup" />
<activity android:name=".Hlookup"></activity>
</application>
die Stack-Trace Ausnahme Post – elmorabea
stellen Sie sicher, Vlookup.class und Hlookup.class werden in Manifest deklariert. –
poste deine 'logcat' –