我必须创建一个库,我将在jar文件中导出到客户端.有没有办法用它中的资源创建一个jar?
谷歌adMob有这样一个jar,其中包括资源文件,如R $ layout.class. 这个页面描述了一些方法,但是我无法准确理解我应该如何使用上面的方法将库项目导入应用程序.
我正在创建一个具有发送短信模块的应用程序.我正在使用2个广播接收器和待定意图,一个用于短信发送确认,另一个用于发送..短信发送广播接收器工作正常,但交付没有到来.
我在服务中使用以下代码.
        PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
                new Intent(SENT), 0);
        PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
                new Intent(DELIVERED), 0);
            //---when the SMS has been sent--- is working alright
            registerReceiver(new BroadcastReceiver()
            {
                public void onReceive(Context arg0, Intent arg1)
                {
                    switch (getResultCode())
                    {
                        case Activity.RESULT_OK:
                            Toast.makeText(getBaseContext(), "SMS sent", 
                                    Toast.LENGTH_SHORT).show();
                            break;
                        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                            Toast.makeText(getBaseContext(), "Generic failure", 
                                    Toast.LENGTH_SHORT).show();
                            break;
                        case SmsManager.RESULT_ERROR_NO_SERVICE:
                            Toast.makeText(getBaseContext(), "No service", 
                                    Toast.LENGTH_SHORT).show();
                            break;
                        case SmsManager.RESULT_ERROR_NULL_PDU:
                            Toast.makeText(getBaseContext(), "Null PDU", 
                                    Toast.LENGTH_SHORT).show();
                            break;
                        case SmsManager.RESULT_ERROR_RADIO_OFF:
                            Toast.makeText(getBaseContext(), "Radio off", 
                                    Toast.LENGTH_SHORT).show();
                            break;
                    }
                    unregisterReceiver(this);
                }
            }, new …sms android broadcastreceiver android-service android-pendingintent
我在我的活动中使用Android列表视图...
现在我需要获取从列表中选择的项目的名称...
这是我的菜单创建代码
public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {
       super.onCreateContextMenu(menu, v, menuInfo);         
     MenuInflater inflater = getMenuInflater();
     inflater.inflate(R.menu.activity_main, menu); //select layout which should pop up in context menu
     menu.add("Delete");
     menu.add("Rename");
}
我需要的是在以下函数中获取列表视图所选项目名称的方法,该函数捕获上下文菜单上的单击.
@Override
public boolean onContextItemSelected(MenuItem item) 
{
     super.onContextItemSelected(item);
    if(item.getTitle()=="Delete"){
       //slected item's name in string varible here??
    }
    if(item.getTitle()=="Rename"){
            //slected item's name in string varible here??
    }
    return true;
}