第一類:
public class GecmisGoruntule extends Activity
{
public static TextView t1;
TextView t2;
TextView t3;
TextView t4;
TextView t5;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.gecmisgoruntule);
t1=(TextView)findViewById(R.id.textView1);
t2=(TextView)findViewById(R.id.textView2);
t3=(TextView)findViewById(R.id.textView3);
t4=(TextView)findViewById(R.id.textView4);
t5=(TextView)findViewById(R.id.textView5);
}
}
我的第二類:
public class Tab3 extends Activity
{
yuksekPuanDb v;
Intent intent;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.tab3);
v=new yuksekPuanDb(this);
intent = new Intent().setClass(this, GecmisGoruntule.class);
liste.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
GecmisGoruntule.t1.setText("deneme");
startActivity(intent);
}
});
}
}
第一類有5個textviews。我從第二課的數據庫中獲取數據,並且想要更改我的textviews文本。Tab3我的第二課。
,但我得到的錯誤:
03-29 17:04:51.570: E/AndroidRuntime(24835): FATAL EXCEPTION: main
03-29 17:04:51.570: E/AndroidRuntime(24835): java.lang.NullPointerException
03-29 17:04:51.570: E/AndroidRuntime(24835): at com.its.android.Tab3$1.onItemClick(Tab3.java:56)
請張貼導致問題的代碼。 – dharms
顯示一些代碼人 – vlio20
看看行'Tab3.java:56' – donfuxx