Okay, so now we have the lay out for
our activities as designed, and
our manifest and
grader files are set up.
So the next thing to do
is to write the code.
If you haven't done so already,
open up the main activity and
at the top you'll see there
are a number of imports.
We have to add a few more.
Let's take a look at what they'll be,
I'll just paste them in.
So you can see here, these are the
imports that we're going to be using.
Things such as the login utility,
the text View control that
we've seen earlier on.
A location object that we're using for
determining location details, and
then all this stuff that's going to
be used by the location services;
connection results, API client,
connection call backs,
the on connection failed listener.
And of course the location
services themselves.
So these provide all the classes
that we're going to be using, and
next we're going to edit
main activity code itself.
We can see that the basic one that we
have just extends action bar activity,
but we need a few more interfaces.
حسناً، لدينا تخطيط لأنشطتنا كما هو مصمم
وتم إعداد البيان وملفات grader.
الشيء التالي هو كتابة التعليمة البرمجية.
إذا لم تنتهي من ذلك بالفعل،
افتح النشاط الرئيسي
وفي الأعلى سترى أن هناك
عدد من الاستيرادات.
علينا إضافة البعض منها.
لنلقي نظرة كيف ستكون وسأقوم بلصقهم
هنا.
يمكن أن ترى هنا، تلك هي الاستيرادات
التي سنستخدمها.
أشياء مثل استخدام تسجيل أداة مساعدة
وعنصر تحكم طريقة عرض النص التي
رأيناها قبل ذلك.
موضوع الموقع الذي
نستخدمه لتحديد تفاصيل الموقع
وبعد ذلك تستخدم خدمات الموقع كل هذه
الأشياء؛
ونتائج الاتصال وعميل واجهة برمجة
التطبيق وإعادة استدعاءات الاتصال
وموزع فشل الاتصال.
وبالطبع خدمات الموقع ذاتها.
لذا تقوم تلك العناصر بتقديم
كل الفئات التي ستستخدم
وبعد ذلك سنقوم بتحرير التعليمة البرمجية
للنشاط الأساسي ذاته.
يمكن أن نرى أن النشاط الأساسي لدينا
يوسع نشاط شريط المهام،
لكننا نريد عدد ليس بكثير من الواجهات.
Agora temos que criar o layout
de nossas atividades conforme foram projetadas,
e nosso manifesto
e arquivos de graduador estão configurados.
A próxima coisa a fazer
é escrever o código.
Caso ainda não tenha feito isso,
abra a atividade principal.
Na parte superior você verá
um número de importações.
Temos que adicionar mais algumas.
Vamos dar uma olhada em quais elas serão,
apenas vou colá-las aqui.
Você pode ver aqui que estas são
as importações que
usaremos.
Coisas como o utilitário de logon,
o controle TextView
que vimos anteriormente,
um objeto de localização que estamos usando
para determinar detalhes da localização,
e tudo o que vai
ser usado pelos serviços de localização;
resultados de conexão, cliente de API,
callbacks de conexão,
o observador de falha de onConnection.
E claro, a localização
dos próprios serviços.
Esses itens fornecem todas as classes
que vamos usar.
Em seguida, editaremos
o código da atividade principal em si.
Podemos ver que o código básico que temos
apenas estende a atividade da barra de ações,
mas precisamos de mais algumas interfaces.
现在我们有了为 activity 设计的布局
清单和 grader 文件也设置完成
接下来要做的事情是编写代码
如果尚未进行这一步 那么打开主 activity
可以在顶端看到有许多导入
我们必须再添加一些
我们看一下要添加的是什么 我将把它们粘贴在这里
可以在这里看到 这些是我们将要使用的导入
诸如登录工具、文本视图控件等对象
我们先前已经见过这些对象
我们用于确定位置详情的定位对象
这些是定位服务将要使用的
连接结果、API 客户端、连接回调
连接失败侦听器
当然还有定位服务本身
这些可提供我们将要使用的所有类
接下来我们将编辑主 activity 代码本身
可以看到基本 activity我们刚刚扩展了操作栏 activity
但是我们需要更多一些接口