0
public void onItemClick( AdapterView<?> parent, View view, int pos, long id ) 
    {
        try
        {
            String sender = smsList.get( pos ).split("\n")[0];
            String encryptedData = smsList.get( pos ).split("\n")[1];
            String data = sender + "\n" + StringCryptor.decrypt( new String(SmsReceiver.PASSWORD), encryptedData );
            Toast.makeText( this, data, Toast.LENGTH_SHORT ).show();
        } 
        catch (Exception e) 
        {
            e.printStackTrace();
        }
    }

我想在每次进入应用程序时解密点击收到的短信,它只有在只有一条短信时才能解密,如果收到2条短信,就无法解密,因为每次点击时,它都点击了整个ListView

有谁知道如何逐行单独单击?

4

1 回答 1

0

你在做这样的事情吗?:
这应该有效

public class MyActivity extends Activity
    implements AdapterView.onItemClickListener {

    @Override
    public void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listr);

        ListView lv = (ListView) findViewById(R.id.list);
        lv.setOnItemClickListener(this);

        // Do whatever else you need to do
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        // Do whatever
    }
}
于 2013-01-23T02:36:56.080 回答