intent

第七次作业

岁酱吖の 提交于 2019-12-03 14:41:51
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.js.MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="

关于Android中Intent传递Serialzilable数据的问题

白昼怎懂夜的黑 提交于 2019-12-03 13:20:53
之前写程序,如果是队列数据的话,一般都是用ArrayList来作为存储介质,但是现在接手公司的新项目,因为之前这个公司是在windows mobile上实现的(也就是C写的),他们可能更习惯使用Vector,之前也没有了解过Vector,后来查询java的api文档,java确实也有Vector的实现。 先看下java中对Vector的描述:(对Vector熟悉的下面这段可不看) Vector 类可以实现可增长的对象数组。与数组一样,它包含可以使用整数索引进行访问的组件。但是, Vector 的大小可以根据需要增大或缩小,以适应创建 Vector 后进行添加或移除项的操作。 从 Java 2 平台 v1.2 开始,此类改进为可以实现 List 接口,使它成为 Java Collections Framework 的成员。与新 collection 实现不同, Vector 是同步的。 之前看think in java 中也有提到,Vector与List相比,主要的区别就在于,Vector是同步的,List是非同步的,Vector在迭代的时候是不能对队里的数据进行增删操作的,否则会抛出ConcurrentModificationException异常,同理,在单一线程条件下,Vector的效率较之ArrayList等会更低,因此在Android平台下可能也不太会使用到该类。

Android Intent 深入理解

守給你的承諾、 提交于 2019-12-03 12:34:49
什么是Intent Intent是一种运行时绑定(run-time binding)机制,它能在程序运行过程中连接两个不同的组件。通过Intent,你的程序可以向Android表达某种请求或者意愿,Android会根据意愿的内容选择适当的组件来完成请求。比如,有一个Activity希望打开网页浏览器查看某一网页的内容,那么这个Activity只需要发出WEB_SEARCH_ACTION给Android,Android就会根据Intent的请求内容,查询各组件注册时声明的IntentFilter,找到网页浏览器的Activity来浏览网页。 Android的三个基本组件——Activity,Service和Broadcast Receiver——都是通过Intent机制激活的,不同类型的组件有不同的传递Intent方式: 1.1 要激活一个新的Activity,或者让一个现有的Activity做新的操作,可以通过调用Context.startActivity()或者Activity.startActivityForResult()方法。 1.2 要启动一个新的Service,或者向一个已有的Service传递新的指令,调用Context.startService()方法或者调用Context.bindService()方法将调用此方法的上下文对象与Service绑定。 1.3

Intent匹配规则以及解析框架深入分析

有些话、适合烂在心里 提交于 2019-12-03 12:34:20
关于Intent以及IntentFilter的基本知识,大家可以参阅如下资料, SDK中对Intent与IntentFilter的介绍 ---- 英文 其中文翻译如下: Android开发之旅: Intents和Intent Filters(理论部分) 我重点分析一下两个方面: 第一部分 、Intent以及IntentFilter说明以及匹配规则分析 第二部分:Intent的解析过程分析 第一部分 、Intent以及IntentFilter说明以及匹配规则分析 想当初我看Intent相关知识时,对Intent、IntentFilter的理解就很差劲,总觉得系统定义了一个Intent,为何还要整理个 IntentFilter出来"祸害"广大程序猿呢?但不解归不解,在具体使用咱可不能含糊,于是只好依葫芦画瓢了,反正绝对还不错。 一、温故而知新 :Intent与IntentFilter两问。 * 它们是什么 ? * 它们的区别在哪儿 ? 事实上,这两个问题可以归纳为Intent和Intent的主要功能是什么 ? 大家可以先扪心自问下,看看你的掌握程度如何 ? 我的理解如下: * Intent : 主要功能是根据特定的条件找到匹配的组件,继而对该组件执 行一些操作。比如执行startActivity()时,系统 首先要找到特定的Activity组件,然后执行onCreate()方法;

Activity经典实例一:两个Activity传递数据和对象

房东的猫 提交于 2019-12-03 12:34:01
1、概述: Activity类直接或者间接地继承了Context、ContextWrapper、ContextThemeWrapper等基类,因此Activity可以直接调用它们的方法。 创建一个Activity需要实现某些方法,常见的是实现 onCreate(Bundle status) 方法,该方法将会在Activity创建时被回调,它调用 setContentView(View view) 方法来显示要展示的View。 一个Android应用常常有多个Activity,但是只有一个作为程序的入口,其他的Activity通常都由入口Activity、及其后者启动。 2、Activity启动另一个Activity的方法: startActivity (Intent intent) :启动其他Activity; startActivityForResult (Intent intent, int requestCode) :以指定请求码(requestCode)启动Activity,而且程序将会等到新启动Activity的结果(通过重写onActivityResult(...)方法来获取结果)。 3、关闭Activity的方法: finish ():结束掉当前的Activity; finishActivity (int requestCode)

build random array, search and sort FORTRAN

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I've built my program but I'm getting errors saying the same stuff over and over: benchmark.f90(17): error #6451: A dummy argument name is required in this context. [N] INTEGER, intent (in) :: N ------------------------^ benchmark.f90(18): error #6420: This array name is invalid in this context. [A] REAL, intent (out), DIMENSION (N), allocatable :: a --------------------------------------------------^ benchmark.f90(18): error #6646: ALLOCATABLE or POINTER attribute dictates a deferred-shape-array [A] REAL, intent (out), DIMENSION (N),

Add list item in RecyclerView Adapter on receiving Firebase message

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the firebase messaging service for messaging and notifications. I can't seem to be able to pass an incoming message from the service to the adapter so that when the message is received it can be inserted into the RecycleView List. I tried using BroacastIntent as follows : public class messaging extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage m) { store(m.getData()); broadcastIntent(); } public void broadcastIntent() { Intent intent = new Intent(); intent.setAction("com.myApp.CUSTOM_EVENT");

How to route default audio to ear piece when headphones are connected?

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am developing an app in which we need to use the headphone jack as a button only. Requirement : Play the default audio (calling) via earpiece when headsets are connected (no need of audio through headphones) There are many example of routing audio through speaker and headphones and also bluetooth headsets but nothing about routing the audio through ear speakers of devices if headsets are connected. I have tried a lot and some links are Android : Force audio routing (not working in my scenario) I have checked SoundAbout( https:/

Android, permission denial using BOOT_COMPLETED intent

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a BootReceiver and is using android.intent.action.BOOT_COMPLETED to reconfigure whatever alarms the user made in my app, before phone was powerd off. Im using AlarmManager to set the alarms again. The alarms are stored in a SQLite database. public class BootReceiver extends BroadcastReceiver { private Context mContext; @Override public void onReceive(Context c, Intent intent) { mContext = c; try { cursor.moveToFirst(); do { Intent i = new Intent(mContext, AlarmReceiver.class); i.putExtra("alarm_message", cursor.getInt(1));

Android Navigation intent

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If you mail a Google Maps direction to your Android phone, you have the possibility to open it in the Maps appliaction, this seems perfectly logical, as does the code behind it. Now, once in the Maps App, you have the possibility to open these directions in the Navigation App, with those exact directions. How does this work? It must not be that difficult to do it, I know about the intent with "google.navigation:q=..." Can anyone help me out with this? EDIT: This is what the URL looks like: https://maps.google.com/maps?saddr=Durbanville,+Cape