public class ExpandableListAdapter extends BaseExpandableListAdapter {
----
--SOME SET OF CODE--
----
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String childText = (String) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_item, null);
}
TextView txtListChild = (TextView) convertView.findViewById(R.id.lblListItem);
txtListChild.setText(childText);
Button btn_submit = (Button)convertView.findViewById(R.id.button1);
btn_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String myConst = null;
TextView txtListChild = (TextView) v.findViewById(R.id.lblListItem);
TextView PhoneNo = (TextView) v.findViewById(R.id.editText1);
// TODO Auto-generated method stub
Log.v(myConst, "Read string"+childText);
-------
---SMS MANAGER NOT WORKING ----
-------
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(PhoneNo.toString(),null,childText,null,null);
-------
---SMS MANAGER NOT WORKING ----
-------
} catch (Exception ex) {
Log.v(myConst, "Read string"+ex.getStackTrace());
ex.printStackTrace();
}
//Log.v(myConst, "Message sent"+PhoneNo.toString());
}
});
return convertView;
}
-----
--SOME SET OF CODE---
-----
}
短信管理员不在JAVA CLASS中工作,但这个相同的代码在活动类中工作正常。
SmsManager smsManager = SmsManager.getDefault();
请告知。