这里是我在谷歌地图android api v2中添加标记的代码。 我的问题是我不能从我的EditText片段获取字符串值。代码.getText()。toString()不能获取字符串值,只能发送null。 请帮帮我。.getText()。toString()给出NullPointerException
0
A
回答
0
添加以下代码
onMapLongClick()
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.alertlayout, parent, false);
0
你得到空指针,因为你没有实现getter和setter为编辑文本值,您需要按照这个..
正确膨胀你的布局..
LayoutInflater mInflater =(LayoutInflater)context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.alertlayout,null);
2.Crate ViewHolder类包含该编辑文本的getter和setter。
convertView.setTag(holder);
创建像
holder = (ViewHolder) convertView.getTag();
持有者对象,现在你可以得到holder.get....();
相关问题
- 1. Java getText NullPointerException
- 2. 当我使用“.getText()。toString();”
- 3. 编辑文本getText()。toString()返回空白
- 4. FirefoxDriver给出NullPointerException异常
- 5. FontImage给出NullPointerException异常
- 6. MyLinearLayout.getDrawingCache()给出一个NullPointerException
- 7. System.console()在NetBeans中给出NullPointerException
- 8. Swing中的.getText()出错,在java中获得NullPointerException
- 9. JavaFX访问控制器给出nullpointerexception
- 10. DatePicker在设置日期时给出NullPointerException
- 11. ActionBar给予nullPointerException?
- 12. hiddenText = ca.a.getText();给NullPointerException?
- 13. getText()。toString()常量和资源类型不匹配
- 14. Setonitemclicklistener与AsyncTask给NullPointerException
- 15. WebDriver getText抛出异常
- 16. Android:OnClickListener抛出NullPointerException
- 17. RestClient抛出NullPointerException?
- 18. Jfreechart.draw()抛出Nullpointerexception
- 19. ActionBar抛出NullPointerException
- 20. JTextField.setText()抛出NullPointerException
- 21. Hibernate抛出nullpointerexception
- 22. Lint4J从命令行给NullPointerException
- 23. 给我的Class.getResource(className)NullPointerException
- 24. SipDemo的onReceive()SipAudioCall NullPointerException给
- 25. .setAdapter(adapter);给NullPointerException异常
- 26. RemoteServiceServlet与春天autowired给nullpointerexception
- 27. PriorityQueue poll()抛出NullPointerException
- 28. JavaFx - TextField.setText()抛出nullpointerException
- 29. ReflectionUtil getField抛出NullPointerException
- 30. Hibernate抛出NullPointerException - processFkSecondPassInOrder
认沽XML文件! – 2013-03-01 06:50:44