我在這裏有一個問題,我的代碼。 我想從一個活動傳遞給另一個按鈕。 這裏是我的代碼:Android意圖和意圖過濾器
MainActivity.class
ImageView imgsettings;
內onCreate()
imgsettings = (ImageView) findViewById(R.id.imgviewsettings);
imgsettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent("android.intent.action.SETTINGS"));
}
});
AndroidManifest
<activity
android:name=".AppSettings"
android:label="@string/title_activity_app_settings" >
<intent-filter>
<action android:name="android.intent.action.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
我真的無法發現問題。一切似乎都適合我。
你的問題是什麼?它自己的問題不清楚你想要什麼。 – RaMeSh
每當我運行應用程序,它給我一個錯誤: 致命異常:主要java.lang.RuntimeException:無法實例化活動ComponentInfo {com.example.oldie.AppSettings}:java.lang.NullPointexception –