Hello Everybody,

Whats the problem with this code?

private ListView lv1;
 private String
lv_arr[]={"Android","iPhone","BlackBerry","AndroidPeople","J2ME",
"Listview","ArrayAdapter","ListItem","Us","UK","India"};
 @Override
public void onCreate(Bundle icicle)
 {
super.onCreate(icicle);
 setContentView(R.layout.main);
lv1=(ListView)findViewById(R.id.ListView01);
 lv1.setAdapter(new
ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr));
 lv1.setTextFilterEnabled(true);
lv1.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long
arg3) {
 // TODO Auto-generated method stub
AlertDialog.Builder adb=new
AlertDialog.Builder(ListviewOnclickExample.this);
 adb.setTitle("LVSelectedItemExample");
adb.setMessage("Selected Item is = "+lv1.getItemAtPosition(position));
 adb.setPositiveButton("Ok", null);
adb.show();
 }
});
 }

i got this issue when i try  to run it
[2011-07-03 02:30:05 - ddms]null
java.lang.NullPointerException
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
 at com.android.ddmlib.Client.sendAndConsume(Client.java:574)
at com.android.ddmlib.HandleHello.sendHELO(HandleHello.java:142)
 at com.android.ddmlib.HandleHello.sendHelloCommands(HandleHello.java:65)
at com.android.ddmlib.Client.getJdwpPacket(Client.java:671)
 at
com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:317)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)

Thanks, Ariel.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to