jjzjj

putExtra

全部标签

android - ImageView 不刷新/反射(reflect)更改

我正在使用照片选择器Intent选择图像并将其写入应用程序专用文件。我的大部分重要源代码如下所示。一旦我按下一个按钮并执行第一个图像选择Intent,它就会成功更新ImageView。但是,一旦我再次按下图像选择按钮(在同一个Activity中),ImageView就不会更新,除非我退出并重新启动Activity。所以我知道图片保存成功了,但是为什么布局中的ImageView不会刷新或更新呢?publicvoidonResume(){super.onResume();ImageViewmyImageView=(ImageView)findViewById(R.id.contact_im

android - 待定 Intent 中的intent.putExtra()不起作用

我正在通过服务类的警报接收器传递待处理的Intent。但是,在pendingIntent触发后,broadcastreceiver类没有接收到intent.putExtra()信息。这是我触发pendingIntent的代码Intentaint=newIntent(getApplicationContext(),AlarmReceiver.class);PendingIntentpendingIntent=PendingIntent.getBroadcast(getApplicationContext(),id,aint,PendingIntent.FLAG_UPDATE_CURREN

android - 待定 Intent 中的intent.putExtra()不起作用

我正在通过服务类的警报接收器传递待处理的Intent。但是,在pendingIntent触发后,broadcastreceiver类没有接收到intent.putExtra()信息。这是我触发pendingIntent的代码Intentaint=newIntent(getApplicationContext(),AlarmReceiver.class);PendingIntentpendingIntent=PendingIntent.getBroadcast(getApplicationContext(),id,aint,PendingIntent.FLAG_UPDATE_CURREN

android - 如何在 Android 应用程序中使用 putExtra() 和 FLAG_ACTIVITY_REORDER_TO_FRONT?

我有一个应用程序,调用“App1”。在我的App1中,我调用了相机应用程序。intent=newIntent(Intent.ACTION_MAIN);intent.setComponent(newComponentName("com.android.camera","com.android.camera.Camera"));startActivity(intent);之后,我使用FileObserver来监听用户是否拍照。发生这种情况时,我会打电话Contextctx=App1.this.getApplicationContext();Intentj=newIntent(ctx,App

android - 如何在 Android 应用程序中使用 putExtra() 和 FLAG_ACTIVITY_REORDER_TO_FRONT?

我有一个应用程序,调用“App1”。在我的App1中,我调用了相机应用程序。intent=newIntent(Intent.ACTION_MAIN);intent.setComponent(newComponentName("com.android.camera","com.android.camera.Camera"));startActivity(intent);之后,我使用FileObserver来监听用户是否拍照。发生这种情况时,我会打电话Contextctx=App1.this.getApplicationContext();Intentj=newIntent(ctx,App

Android:在 putExtra 中传递日期

我正在启动一项Activity,并希望将Date(Time)值传递给它。我已经使用i.putExtra("noteName","HelloWorld")传递了所有其他参数,但我不知道如何传递日期值,然后使用getExtra().我可以轻松使用i.putExtra("noteDate",noteDate);但是我如何在Activity的onCreate()中检索它;我没有看到extras.getDate()吗?我应该将其转换为Float然后再转换回来(在Activity中)吗?谢谢 最佳答案 使用date.getTime()和date

Android:在 putExtra 中传递日期

我正在启动一项Activity,并希望将Date(Time)值传递给它。我已经使用i.putExtra("noteName","HelloWorld")传递了所有其他参数,但我不知道如何传递日期值,然后使用getExtra().我可以轻松使用i.putExtra("noteDate",noteDate);但是我如何在Activity的onCreate()中检索它;我没有看到extras.getDate()吗?我应该将其转换为Float然后再转换回来(在Activity中)吗?谢谢 最佳答案 使用date.getTime()和date

android - 在 Android 的 PutExtra 中传递图像

我想将我在PutExtra()中设置为Button的背景图像与intent对象传递到另一个类中。有人知道怎么做吗?谢谢大卫布朗 最佳答案 发件人Activity:Bitmapbitmap=BitmapFactory.decodeResource(getResources(),R.drawable.sticky_notes);//yourbitmapByteArrayOutputStreambs=newByteArrayOutputStream();bitmap.compress(Bitmap.CompressFormat.JPEG,

android - 如何将 OpenCV Mat 作为 putExtra 发送到 Android Intent?

我正在尝试将CvCameraViewFrame或Mat发送到另一个Activity,但它们没有实现Serializable或Parcelable并且为它们创建一个包装类只是为了使用它一次似乎有点矫枉过正。我该如何继续? 最佳答案 我会使用fragment而不是Activity并获取/设置通用Mat存在于来自fragment的容器Activity中。如果需要坚持多个Activity,假设它在流程内,选项是分享-使用全局Application获取/设置Mat的子类最好是像HashMap>这样的东西并跨Activity传递HashMap的

java - intent.putExtra 是做什么的?

我刚开始学习android开发,对intent.putExtra的作用有点困惑。有人可以解释一下吗?谢谢 最佳答案 Android应用程序可以包含零个或多个Activity。当您的应用程序有多个Activity时,您通常需要从一个Activity导航到另一个Activity。在Android中,您通过所谓的Intent在Activity之间导航。通过使用putExtra(),您可以将一些信息传递给您打算启动的Activity。例如://代码在最近的Activity中,从你想开始另一个Activity的地方IntentmyIntent