小编Gop*_*ena的帖子

如何从 onItemClicklistener 上的联系人 ListView 获取电话号码

我已经创建了一个有效的联系人列表,但是当我单击任何联系人时,我只能从 ListView 获得 Android 屏幕上第 1 个项目的联系人编号。

我想获得该职位点击联系人的电话号码。我在网上到处搜索,但没有得到任何解决方案,我试图解决这个问题过去 13 天,但我仍然无法解决这个问题,如果有人能解决这个问题,请回答。感谢兄弟/姐妹的帮助!


li.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

TextView txtNummber = li.findViewById(android.R.id.text2)
}
});
Run Code Online (Sandbox Code Playgroud)

java android android-contacts

6
推荐指数
1
解决办法
166
查看次数

如何在外部浏览器中打开 url 点击 android 推送通知?

当用户点击推送通知时,我试图用一个 url 打开浏览器,我在 stackoverflow 中搜索,我找到了这个

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        startActivity(browserIntent);
Run Code Online (Sandbox Code Playgroud)

但这对我不起作用。
我正在寻找过去 5 天的解决方案,但未能找到。
这是我的代码

public class MyFirebaseMessagingService extends FirebaseMessagingService {


@Override
public void onMessageReceived(RemoteMessage remoteMessage) {

// Intent notificationIntent = new Intent(this, HomeActivity.class);

Intent notificationIntent = new Intent(Intent.ACTION_VIEW);
notificationIntent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.example.android"));
startActivity(notificationIntent);


notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
final PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
PendingIntent.FLAG_ONE_SHOT);

int notificationId = new Random().nextInt(60000);
Bitmap bitmap = getBitmapfromUrl(remoteMessage.getData().get("image-url"));

Intent likeIntent = new Intent(Intent.ACTION_VIEW);
likeIntent.putExtra(NOTIFICATION_ID_EXTRA,notificationId);
likeIntent.putExtra(IMAGE_URL_EXTRA,remoteMessage.getData().get("image-url"));
PendingIntent likePendingIntent = PendingIntent.getService(this,
notificationId+1,likeIntent, PendingIntent.FLAG_ONE_SHOT);


Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
notificationManager = …
Run Code Online (Sandbox Code Playgroud)

java push-notification android-notifications firebase-cloud-messaging

6
推荐指数
1
解决办法
656
查看次数