Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Problem with OnItemClickListener
    primarykey
    data
    text
    <p>I am a beginner Android developer. I am trying to create an SMS application.</p> <p>I have created a <code>TabHost</code> with three <code>TabSpect(ListView,ListView,TextView)</code> which prints me <code>INBOX</code>, <code>Send</code> and in <code>TextView</code> it prints some useful information.</p> <p>Now if I am trying to click on any item in <code>ListView</code>, it will open the SMS manager, where it will be filled with the <code>phoneNumber</code> of the SMS I clicked.</p> <p>Every time I try this I receive an error.</p> <pre><code>list1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg, View view, int position,long id) { Uri uriSMSURIs = Uri.parse("content://sms/inbox"); String pos = String.valueOf(position); Log.d(TAG, "value: " + pos); Cursor c = getContentResolver().query(uriSMSURIs, null, pos, null, null); Log.e(TAG, "value: " + c); String phoneNumber = c.getString(c.getColumnIndex("address")); Log.e(TAG, "Value: " + phoneNumber; Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("address", phoneNumber); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent); } }); </code></pre> <p><code>pos</code> is returning the position of the selected item but if I use <code>pos</code> in </p> <pre><code>Cursor c = getContentResolver().query(uriSMSURIs, null, pos, null, null); </code></pre> <p>it throws this error:</p> <blockquote> <p>04-02 07:53:15.504: ERROR/SMSManager(328): value: android.content.ContentResolver$CursorWrapperInner@43e2b800.</p> </blockquote> <p>I dont know if I can do that this way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload