Problème Intent et Uri.parse
Salut.
J'ai un problème dans ce code où quand on appuie sur un bouton "btn_call", ça appelle le numero inscrit dans une zone de texte "number" :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
package com.mycompany.myapp2;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.content.Intent;
import android.net.Uri;
import android.view.View.*;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText number = (EditText)findViewById(R.id.number);
Button call = (Button)findViewById(R.id.btn_call);
call.setOnClickListener(new OnClickListener() {
public void onClick(View p1)
{
Uri telnumber = new Uri.parse("tel:" + number.getText());
Intent go = new Intent(Intent.ACTION_DIAL, telnumber);
startActivity(go);
}
});
}
} |
Or l'IDE me retourne l'erreur suivante :
Citation:
Unknow type "parse" of <android.net.Uri>
Pourtant j'avais vu ce code dans un tuto et ça marchait. Quelqu'un peut m'aider ?
Merci.