我的菜单xml代码menu.xml:
<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Single menu item
Set id, icon and Title for each menu item
-->
<item android:id="@+id/back"
android:icon="@drawable/back1"
android:showAsAction="never"
android:title="Back" />
<item android:id="@+id/My_Profile"
android:icon="@drawable/myprofile"
android:showAsAction="never"
android:title="My Profile" />
<item android:id="@+id/Job_Alert"
android:icon="@drawable/jobalert4"
android:showAsAction="never"
android:title="Job Alert !" />
<item android:id="@+id/saved_job"
android:icon="@drawable/jobapplied"
android:title="Saved Jobs"
/>
<item android:id="@+id/Logout"
android:icon="@drawable/logout"
android:title="Logout" />
</menu>
Run Code Online (Sandbox Code Playgroud)
我正在调用这样的菜单xml
PopupMenu popup = new PopupMenu(getBaseContext(), v);
popup.getMenuInflater().inflate(R.menu.menu, popup.getMenu());
popup.show();
Run Code Online (Sandbox Code Playgroud)
但它没有显示图标.
如何在弹出菜单上设置图标?
我有一个列表视图,每行有两个文本视图和一个编辑文本,列表视图setOnItemClickListener()不起作用.
这里是我的Java代码.
public class CreateChallan extends Activity {
ListView lstCreate;
String[] strmainItemCode;
String[] strItem;
String[] strQuantity;
Context context=this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.createchallan);
lstCreate= (ListView) findViewById(R.id.createlist);
lstCreate.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
strmainItemCode= new String[]{"555551","255555","355555","455555","555555"};
strItem =new String[]{"A","B","C","D","F"};
strQuantity =new String[]{"100","200","30","400","500"};
CreateAdapter adapter= new CreateAdapter(this, strmainItemCode, strItem, s trQuantity);
lstCreate.setAdapter(adapter);
lstCreate.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position1, long id) {
// TODO Auto-generated method stub
Toast.makeText(context, "Position", Toast.LENGTH_LONG).show();
}
});
}
// Create List Adapter
class CreateAdapter …Run Code Online (Sandbox Code Playgroud) 我的Java代码更新数据库表
String qq="UPDATE ChallanItems SET Recieve ="+str+" WHERE ItemNo = "+code;
Log.d("Qry", qq);
myDbHelper.updatequery(qq);
Run Code Online (Sandbox Code Playgroud)
updatequery方法
public void updatequery(String qry)
{
Cursor c = myDataBase.rawQuery(qry, null);
Log.d("Up", ""+c.getCount());
}
Run Code Online (Sandbox Code Playgroud)
当我更新数据库时,计数返回0并且表未更新
我正在使用这个但是没有工作
String qq="UPDATE ChallanItems SET Recieve ="+str+" WHERE ItemNo = "+"'"+code+"'";
Run Code Online (Sandbox Code Playgroud)
请帮助我如何解决这个问题
提前致谢