A apresentação discute como integrar a funcionalidade de busca em aplicativos Android usando o framework de busca nativo. O palestrante explica como configurar a busca no app, criar uma activity de busca e usar widgets como o Search Dialog e SearchView para fornecer uma interface de busca consistente para o usuário.
O documento apresenta uma introdução sobre padrões de projeto, definindo o que são padrões e sua estrutura. Também descreve o histórico dos padrões de projeto, desde a arquitetura até o livro "Design Patterns", e apresenta algumas classificações e exemplos de padrões.
The document discusses Spring Mobile, Spring Android, and Spring Social - extensions to the Spring Framework that simplify mobile and social application development. Spring Mobile helps develop web applications for mobile devices, Spring Android builds native Android apps, and Spring Social accesses social/SaaS applications.
O documento discute frameworks orientados a objetos. Define framework como um conjunto de classes que constitui um design abstrato para soluções de uma família de problemas. Explora as diferenças entre frameworks, padrões de projeto, bibliotecas de classes e aplicações. Também discute diretrizes para o desenvolvimento de frameworks e exemplos como ET++ e Unidraw.
Este documento discute mapeamento objeto-relacional em Java usando anotações. Ele explica como anotações como @Entity, @Table, @Id, @GeneratedValue, @Basic, @Temporal e @Lob mapeiam classes Java para tabelas de banco de dados e campos. Ele também discute como configurar e usar o framework Hibernate no Eclipse para estabelecer o mapeamento objeto-relacional e gerar automaticamente tabelas no banco de dados.
AAB307 - Frameworks and Application Blocks - wcambMicrosoft Brasil
O documento apresenta uma introdução sobre frameworks de desenvolvimento, discutindo ferramentas de produtividade, recursos da Enterprise Library 4.1 e conclusões. É destacado o uso de frameworks para elevar a produtividade, padronizar componentes e tornar a arquitetura previsível. A Enterprise Library 4.1 oferece recursos como tratamento de exceções, validação, logging e segurança.
Mapeamento Objeto-Relacional com Java Persistence APIbrunoleitealves
O documento apresenta conceitos sobre mapeamento objeto-relacional com Java Persistence API (JPA), incluindo modelos de domínio, ciclo de vida de objetos, mapeamentos de entidades, configuração e tipos de consultas.
Baixando, instalando e testando o android sdkReuel Lopes
O documento descreve como baixar, instalar e configurar o Android SDK e o plugin ADT no Eclipse para desenvolvimento de aplicativos Android. Ele explica como baixar o SDK e o plugin ADT, instalá-los corretamente e configurar o diretório do SDK e as preferências do plugin no Eclipse.
Análise sobre a utilização de frameworks em PHP: CakePHP, CodeIgniter e ZendThiago Sinésio
O documento analisa três frameworks PHP populares: CakePHP, CodeIgniter e Zend Framework. Explora o que são frameworks, suas vantagens e desvantagens, e fornece detalhes sobre a estrutura, funcionalidade e aplicabilidade de cada um.
O documento apresenta uma introdução sobre padrões de projeto, definindo o que são padrões e sua estrutura. Também descreve o histórico dos padrões de projeto, desde a arquitetura até o livro "Design Patterns", e apresenta algumas classificações e exemplos de padrões.
The document discusses Spring Mobile, Spring Android, and Spring Social - extensions to the Spring Framework that simplify mobile and social application development. Spring Mobile helps develop web applications for mobile devices, Spring Android builds native Android apps, and Spring Social accesses social/SaaS applications.
O documento discute frameworks orientados a objetos. Define framework como um conjunto de classes que constitui um design abstrato para soluções de uma família de problemas. Explora as diferenças entre frameworks, padrões de projeto, bibliotecas de classes e aplicações. Também discute diretrizes para o desenvolvimento de frameworks e exemplos como ET++ e Unidraw.
Este documento discute mapeamento objeto-relacional em Java usando anotações. Ele explica como anotações como @Entity, @Table, @Id, @GeneratedValue, @Basic, @Temporal e @Lob mapeiam classes Java para tabelas de banco de dados e campos. Ele também discute como configurar e usar o framework Hibernate no Eclipse para estabelecer o mapeamento objeto-relacional e gerar automaticamente tabelas no banco de dados.
AAB307 - Frameworks and Application Blocks - wcambMicrosoft Brasil
O documento apresenta uma introdução sobre frameworks de desenvolvimento, discutindo ferramentas de produtividade, recursos da Enterprise Library 4.1 e conclusões. É destacado o uso de frameworks para elevar a produtividade, padronizar componentes e tornar a arquitetura previsível. A Enterprise Library 4.1 oferece recursos como tratamento de exceções, validação, logging e segurança.
Mapeamento Objeto-Relacional com Java Persistence APIbrunoleitealves
O documento apresenta conceitos sobre mapeamento objeto-relacional com Java Persistence API (JPA), incluindo modelos de domínio, ciclo de vida de objetos, mapeamentos de entidades, configuração e tipos de consultas.
Baixando, instalando e testando o android sdkReuel Lopes
O documento descreve como baixar, instalar e configurar o Android SDK e o plugin ADT no Eclipse para desenvolvimento de aplicativos Android. Ele explica como baixar o SDK e o plugin ADT, instalá-los corretamente e configurar o diretório do SDK e as preferências do plugin no Eclipse.
Análise sobre a utilização de frameworks em PHP: CakePHP, CodeIgniter e ZendThiago Sinésio
O documento analisa três frameworks PHP populares: CakePHP, CodeIgniter e Zend Framework. Explora o que são frameworks, suas vantagens e desvantagens, e fornece detalhes sobre a estrutura, funcionalidade e aplicabilidade de cada um.
O documento discute frameworks, definindo-os como conjuntos de classes que colaboram para realizar tarefas em domínios específicos de uma aplicação. Explora as vantagens dos frameworks, como redução de custos e tempo de desenvolvimento, e características como reusabilidade, extensibilidade e inversão de controle. Também examina tecnologias comumente embutidas em frameworks, como MVC, ORM e AJAX.
O documento discute o framework CakePHP para desenvolvimento web em PHP. Apresenta as principais características do framework como arquitetura MVC, validações, paginação, layouts e histórico de sua criação.
Palestra realizada em abril de 2009 no FLISOL de Aracaju/Sergipe. O tema foi o framework orientado a objetos em PHP chamado Symfony.
Algumas de suas features:
- utiliza a arquitetura MVC (Model View Controller), isto é, separação das camadas de apresentação, controle e modelo.
- utiliza bastantes componentes independentes como o Doctrine e Propel (ORM), YML (arquivos de configuração) e outros. Que podem ser adotados em outros projetos que não utilizam o Symfony.
- possui geração automática de CRUD (create, retrieve, update, delete)
- possui uma documentação e comunidade muito grandes.
- geração automática de telas de administração
- ambiente de desenvolvimento com debug
- ambiente de teste
- integração com sincronizador de arquivos (para atualização do projeto na produção)
- separação de configuração para ambientes de teste, desenvolvimento e produção.
- e muito mais...
#ptBR Palestra dada na FATEC-ZL sobre desenvolvimento para a web em Java e o uso de frameworks. Exemplo dado usando SpringMVC.
A palestra teve bastante live coding, mas os repositórios contendo os códigos estudados estão indicados no slide.
Java JDBC: Aplicação Java que acessa um SGDBRicardo Terra
O documento fornece informações sobre Java JDBC:
1) Apresenta o conceito e arquitetura de Java JDBC para conexão de aplicações Java com bancos de dados;
2) Explica as principais classes e interfaces da API JDBC como DriverManager, Connection, Statement e ResultSet;
3) Demonstra exemplos básicos de uso de JDBC para inserção, atualização e consulta a dados.
Aprendendo Na Prática: Aplicativos Web Com Asp.Net MVC em C# e Entity Framewo...Daniel Makiyama
Slides de curso de Férias ministrado na FEI em 07/2014. 20 horas de pura introdução ao mundo do entity framework code first e Asp.Net MVC 5 com o Visual Studio Express 2013
O documento discute dois tópicos: (1) Paradigma de Orientação a Objetos, introduzindo seus conceitos-chave como objeto, classe e encapsulamento; (2) Persistência de dados via JDBC, explicando os tipos de drivers JDBC e fornecendo um exemplo básico de uso do JDBC.
O documento apresenta uma agenda para um bootcamp de Android com os seguintes tópicos: conceitos básicos e componentes de Android, configuração do ambiente de desenvolvimento, e desenvolvimento da primeira aplicação FavoriteTwitters.
Orientação a Objetos no Delphi - Controle de Estoque (II)Ryan Padilha
Este documento descreve a implementação de um sistema de controle de estoque usando orientação a objetos no Delphi. Ele apresenta o modelo conceitual de classes, diagrama de classes e implementação das classes no Object Pascal para armazenar dados no banco de dados PostgreSQL usando o componente ZeosLib.
O documento descreve conceitos fundamentais do Android, incluindo estrutura de diretórios, recursos, classes R e Resources, arquivo AndroidManifest.xml e componentes como Atividades, Intenções, Serviços, Provedores de Conteúdo e Broadcast Receivers.
O documento descreve o desenvolvimento de um novo portal web escalável e de alta performance utilizando processamento e memória distribuída. O objetivo é projetar e desenvolver uma nova versão do portal SETREM para melhorar a escalabilidade e desempenho através de processamento distribuído, memória distribuída e cache. O documento também discute ferramentas como Gearman e Memcache.
Minicurso iniciando com Android no Androidos DayMessias Batista
Este minicurso tem como objetivo apresentar o Android como plataforma de desenvolvimento. O minicurso ensina os principais conceitos do Android, como preparar-se para desenvolver aplicativos, e inclui quatro práticas de desenvolvimento de aplicativos simples para consolidar os conceitos discutidos.
Este documento descreve como acessar um banco de dados remoto de geolocalização usando Android. Ele explica como criar um aplicativo simples que consome uma API gratuita para obter o país, estado e cidade de um endereço IP inserido. O aplicativo usa classes para representar os dados e se conectar à API, exibindo os resultados em tela após o clique em um botão.
1) O documento apresenta Spring Data Neo4j, um framework que simplifica o acesso a dados armazenados no banco de grafos Neo4j através do Spring Framework.
2) Spring Data cria repositórios que implementam operações CRUD e queries de forma automática, diminuindo muito o código repetitivo de acesso a dados.
3) Spring Data Neo4j mapeia objetos Java para nós e relacionamentos no Neo4j, permitindo consultas por métodos em repositórios de forma declarativa.
Protractor - Testando aplicações AngularJS end to endDaniel Amorim
O documento discute o framework AngularJS, o teste end-to-end com Protractor e como configurá-lo. O AngularJS é um framework JavaScript criado pela Google que permite extender HTML. O Protractor é uma ferramenta para testar aplicações AngularJS end-to-end usando o Selenium, sem esperas e buscando elementos pelo AngularJS. Ele é configurado por meio de um arquivo de configuração para especificar o Selenium e testes.
O documento discute o framework AngularJS, o teste end-to-end com Protractor e como configurá-lo. O AngularJS é um framework JavaScript criado pela Google para construir aplicações web dinâmicas de uma forma declarativa e extensível. O Protractor permite testar aplicações AngularJS end-to-end sem esperas explícitas, buscando elementos pelo próprio AngularJS. Ele roda no Selenium e usa Jasmine para escrever testes.
1) RAD (Rapid Application Development) é um modelo de desenvolvimento de software iterativo e incremental que enfatiza um ciclo de desenvolvimento extremamente curto (entre 60 e 90 dias).
2) O processo de RAD inclui fases como modelagem de negócios, modelagem de dados, geração da aplicação e teste, variando de acordo com a abordagem adotada.
3) RAD tem vantagens como desenvolvimento rápido, prototipagem, reuso de componentes e envolvimento do usuário, mas também desvantagens como dificuldade para projetos grandes e riscos em test
O documento descreve o framework CherryPy para desenvolvimento de aplicações web em Python. O CherryPy facilita a criação de aplicações web simplificando o protocolo HTTP e mapeando URLs para objetos Python. Exemplos demonstram como criar páginas web simples, receber dados de formulários e configurar o servidor web.
O documento discute bibliotecas Android e gerenciamento de dependências usando Gradle. Explica o que são bibliotecas Android e onde encontrá-las, além de fornecer exemplos de bibliotecas populares como ButterKnife, Gson, Picasso e Realm. Também descreve o que é Gradle e como usá-lo para gerenciar dependências de bibliotecas no Android Studio.
Desenvolvimento de Apps e Games para Android - Parte 4Erisvaldo Junior
O documento resume conceitos importantes sobre interfaces gráficas, atividades, intents, internacionalização, armazenamento de dados e persistência em Android. Ele discute como criar views, dialogs e iniciar atividades; como lidar com logs, splash screens e intents; e como armazenar dados usando shared preferences, arquivos internos e externos e SQLite.
1) O documento apresenta Tiago Flores Dias, um especialista em marketing digital que ministrará uma aula sobre mecanismos de busca e otimização para mecanismos de busca.
2) A aula abordará como funcionam os mecanismos de busca, o que é SEM, SEO e a diferença entre SEO e SMO.
3) Também será apresentado um modelo de implementação de SEO.
O documento discute frameworks, definindo-os como conjuntos de classes que colaboram para realizar tarefas em domínios específicos de uma aplicação. Explora as vantagens dos frameworks, como redução de custos e tempo de desenvolvimento, e características como reusabilidade, extensibilidade e inversão de controle. Também examina tecnologias comumente embutidas em frameworks, como MVC, ORM e AJAX.
O documento discute o framework CakePHP para desenvolvimento web em PHP. Apresenta as principais características do framework como arquitetura MVC, validações, paginação, layouts e histórico de sua criação.
Palestra realizada em abril de 2009 no FLISOL de Aracaju/Sergipe. O tema foi o framework orientado a objetos em PHP chamado Symfony.
Algumas de suas features:
- utiliza a arquitetura MVC (Model View Controller), isto é, separação das camadas de apresentação, controle e modelo.
- utiliza bastantes componentes independentes como o Doctrine e Propel (ORM), YML (arquivos de configuração) e outros. Que podem ser adotados em outros projetos que não utilizam o Symfony.
- possui geração automática de CRUD (create, retrieve, update, delete)
- possui uma documentação e comunidade muito grandes.
- geração automática de telas de administração
- ambiente de desenvolvimento com debug
- ambiente de teste
- integração com sincronizador de arquivos (para atualização do projeto na produção)
- separação de configuração para ambientes de teste, desenvolvimento e produção.
- e muito mais...
#ptBR Palestra dada na FATEC-ZL sobre desenvolvimento para a web em Java e o uso de frameworks. Exemplo dado usando SpringMVC.
A palestra teve bastante live coding, mas os repositórios contendo os códigos estudados estão indicados no slide.
Java JDBC: Aplicação Java que acessa um SGDBRicardo Terra
O documento fornece informações sobre Java JDBC:
1) Apresenta o conceito e arquitetura de Java JDBC para conexão de aplicações Java com bancos de dados;
2) Explica as principais classes e interfaces da API JDBC como DriverManager, Connection, Statement e ResultSet;
3) Demonstra exemplos básicos de uso de JDBC para inserção, atualização e consulta a dados.
Aprendendo Na Prática: Aplicativos Web Com Asp.Net MVC em C# e Entity Framewo...Daniel Makiyama
Slides de curso de Férias ministrado na FEI em 07/2014. 20 horas de pura introdução ao mundo do entity framework code first e Asp.Net MVC 5 com o Visual Studio Express 2013
O documento discute dois tópicos: (1) Paradigma de Orientação a Objetos, introduzindo seus conceitos-chave como objeto, classe e encapsulamento; (2) Persistência de dados via JDBC, explicando os tipos de drivers JDBC e fornecendo um exemplo básico de uso do JDBC.
O documento apresenta uma agenda para um bootcamp de Android com os seguintes tópicos: conceitos básicos e componentes de Android, configuração do ambiente de desenvolvimento, e desenvolvimento da primeira aplicação FavoriteTwitters.
Orientação a Objetos no Delphi - Controle de Estoque (II)Ryan Padilha
Este documento descreve a implementação de um sistema de controle de estoque usando orientação a objetos no Delphi. Ele apresenta o modelo conceitual de classes, diagrama de classes e implementação das classes no Object Pascal para armazenar dados no banco de dados PostgreSQL usando o componente ZeosLib.
O documento descreve conceitos fundamentais do Android, incluindo estrutura de diretórios, recursos, classes R e Resources, arquivo AndroidManifest.xml e componentes como Atividades, Intenções, Serviços, Provedores de Conteúdo e Broadcast Receivers.
O documento descreve o desenvolvimento de um novo portal web escalável e de alta performance utilizando processamento e memória distribuída. O objetivo é projetar e desenvolver uma nova versão do portal SETREM para melhorar a escalabilidade e desempenho através de processamento distribuído, memória distribuída e cache. O documento também discute ferramentas como Gearman e Memcache.
Minicurso iniciando com Android no Androidos DayMessias Batista
Este minicurso tem como objetivo apresentar o Android como plataforma de desenvolvimento. O minicurso ensina os principais conceitos do Android, como preparar-se para desenvolver aplicativos, e inclui quatro práticas de desenvolvimento de aplicativos simples para consolidar os conceitos discutidos.
Este documento descreve como acessar um banco de dados remoto de geolocalização usando Android. Ele explica como criar um aplicativo simples que consome uma API gratuita para obter o país, estado e cidade de um endereço IP inserido. O aplicativo usa classes para representar os dados e se conectar à API, exibindo os resultados em tela após o clique em um botão.
1) O documento apresenta Spring Data Neo4j, um framework que simplifica o acesso a dados armazenados no banco de grafos Neo4j através do Spring Framework.
2) Spring Data cria repositórios que implementam operações CRUD e queries de forma automática, diminuindo muito o código repetitivo de acesso a dados.
3) Spring Data Neo4j mapeia objetos Java para nós e relacionamentos no Neo4j, permitindo consultas por métodos em repositórios de forma declarativa.
Protractor - Testando aplicações AngularJS end to endDaniel Amorim
O documento discute o framework AngularJS, o teste end-to-end com Protractor e como configurá-lo. O AngularJS é um framework JavaScript criado pela Google que permite extender HTML. O Protractor é uma ferramenta para testar aplicações AngularJS end-to-end usando o Selenium, sem esperas e buscando elementos pelo AngularJS. Ele é configurado por meio de um arquivo de configuração para especificar o Selenium e testes.
O documento discute o framework AngularJS, o teste end-to-end com Protractor e como configurá-lo. O AngularJS é um framework JavaScript criado pela Google para construir aplicações web dinâmicas de uma forma declarativa e extensível. O Protractor permite testar aplicações AngularJS end-to-end sem esperas explícitas, buscando elementos pelo próprio AngularJS. Ele roda no Selenium e usa Jasmine para escrever testes.
1) RAD (Rapid Application Development) é um modelo de desenvolvimento de software iterativo e incremental que enfatiza um ciclo de desenvolvimento extremamente curto (entre 60 e 90 dias).
2) O processo de RAD inclui fases como modelagem de negócios, modelagem de dados, geração da aplicação e teste, variando de acordo com a abordagem adotada.
3) RAD tem vantagens como desenvolvimento rápido, prototipagem, reuso de componentes e envolvimento do usuário, mas também desvantagens como dificuldade para projetos grandes e riscos em test
O documento descreve o framework CherryPy para desenvolvimento de aplicações web em Python. O CherryPy facilita a criação de aplicações web simplificando o protocolo HTTP e mapeando URLs para objetos Python. Exemplos demonstram como criar páginas web simples, receber dados de formulários e configurar o servidor web.
O documento discute bibliotecas Android e gerenciamento de dependências usando Gradle. Explica o que são bibliotecas Android e onde encontrá-las, além de fornecer exemplos de bibliotecas populares como ButterKnife, Gson, Picasso e Realm. Também descreve o que é Gradle e como usá-lo para gerenciar dependências de bibliotecas no Android Studio.
Desenvolvimento de Apps e Games para Android - Parte 4Erisvaldo Junior
O documento resume conceitos importantes sobre interfaces gráficas, atividades, intents, internacionalização, armazenamento de dados e persistência em Android. Ele discute como criar views, dialogs e iniciar atividades; como lidar com logs, splash screens e intents; e como armazenar dados usando shared preferences, arquivos internos e externos e SQLite.
1) O documento apresenta Tiago Flores Dias, um especialista em marketing digital que ministrará uma aula sobre mecanismos de busca e otimização para mecanismos de busca.
2) A aula abordará como funcionam os mecanismos de busca, o que é SEM, SEO e a diferença entre SEO e SMO.
3) Também será apresentado um modelo de implementação de SEO.
O documento discute o desenvolvimento de um aplicativo móvel para gerenciar dados em dispositivos móveis utilizando o banco de dados SQLite. O aplicativo permite cadastrar, editar e buscar dados de pessoas armazenados no banco de dados. O documento descreve as ferramentas e linguagens utilizadas no desenvolvimento do aplicativo, como o Eclipse, Java e Android.
O documento descreve o que é o Firebase, serviço de backend como serviço da Google. Explica que oferece funcionalidades como armazenamento em nuvem, análises de aplicativos, mensagens entre plataformas e autenticação de usuários. Também mostra um exemplo de login com Google no Firebase.
O documento discute estratégias de automação de testes em microserviços, mencionando cinco níveis de teste: unidade, integração, componente, end-to-end e exploratório. Cada nível de teste é descrito com foco no escopo, dependências, ambientes de teste e objetivos. A automação é importante para acelerar o ciclo de desenvolvimento e entrega contínua em arquiteturas de microserviços.
O documento fornece uma introdução sobre como começar a desenvolver aplicativos para Android, cobrindo tópicos como configuração do ambiente de desenvolvimento, criação de um projeto Android, desenvolvimento da interface do usuário, depuração e publicação da aplicação.
30º GDG Uberaba - Introdução AngularJS 4 com CLIPedro Moura
O documento apresenta uma introdução ao framework AngularJS 4, discutindo como se organiza em componentes, serviços, roteamento e diretivas. É demonstrado passo a passo como configurar o ambiente de desenvolvimento, criar um projeto inicial, componentes, módulos e serviços para consumir uma API REST.
As classes de modelagem podem ser comparadas a moldes ou
formas que definem as características e os comportamentos dos
objetos criados a partir delas. Vale traçar um paralelo com o projeto de
um automóvel. Os engenheiros definem as medidas, a quantidade de
portas, a potência do motor, a localização do estepe, dentre outras
descrições necessárias para a fabricação de um veículo
A linguagem C# aproveita conceitos de muitas outras linguagens,
mas especialmente de C++ e Java. Sua sintaxe é relativamente fácil, o que
diminui o tempo de aprendizado. Todos os programas desenvolvidos devem
ser compilados, gerando um arquivo com a extensão DLL ou EXE. Isso torna a
execução dos programas mais rápida se comparados com as linguagens de
script (VBScript , JavaScript) que atualmente utilizamos na internet
4. 4 28/04/2012
Android Search Framework
Busca é uma característica essencial do
Android
O quê e onde buscar?
Tudo que interessar ao usuário[?!]
Conteúdo pode estar armazenado
localmente ou na internet
Objetivo:
Criar uma experiência de busca consistente
@JPMagalhaes - AndroidRec 2012
5. 5 28/04/2012
Android Search Framework
Ajuda-nos na implementação da busca
Exibindo a view de input
Entregando queries para seu app
Exibindo os resultados
Não nos ajuda na busca!
Nem com nossos dados
Formas de interação
Search Dialog
SearchView
Quick Search Box
@JPMagalhaes - AndroidRec 2012
6. 6 28/04/2012
Implementando a busca em
seu app [1/4]
Nós precisamos:
searchable.xml
SearchActivity
Search UI
O processo a partir do SearchButton.onCLick()
A interface desejada é criada
A cada letra inserida
Uma consulta ao ContentProvider pode ser feita ->
Auto-complete/Sugestões Customizadas
OnEnter()
Intent de busca é criado pelo sistema
Query é inserida
SearchActivity é iniciada
@JPMagalhaes - AndroidRec 2012
7. 7 28/04/2012
[2/4] Configurando sua Busca
res/xml/searchable.xml
android:label é o único atributo exigido para buscas locais
Não é visível
Deve ser o nome do app
Neste ponto, nosso app estará visível para buscas
Settings -> Searchable items
Na verdade, não!
android:includeInGlobalSearch="true"
Aceita vários outros atributos
Adicionar de acordo com as features desejadas
@JPMagalhaes - AndroidRec 2012
8. 8 28/04/2012
[3/4] Criando uma
SearchableActivity
Activity
que realiza a busca baseada em
uma query e apresenta os resultados
@JPMagalhaes - AndroidRec 2012
9. 9 28/04/2012
[4/4] Nunca esqueça do
Manifest.xml!
@JPMagalhaes - AndroidRec 2012
10. 10 28/04/2012
Search Dialog
Caixa de busca flutuante
Aparece no topo da tela
Botão de busca
onSearchRequested()
Nada disso funciona até a busca seja habilitada
Em uma atividade específica
Para todas as atividades do app
@JPMagalhaes - AndroidRec 2012
11. 11 28/04/2012
[1/2] SearchView widget
Android3.0+
Normalmente colocada na ActionBar
Mesmas funcionalidades do Search Dialog
Com um pouco mais de trabalho…
Inserir o botão de busca no ActionBar/Menu
res/menu/search_menu.xml
@JPMagalhaes - AndroidRec 2012
12. 12 28/04/2012
[2/2] SearchView widget
Configurar o SearchView
Linkar o componente com nossa
configuração de busca
@JPMagalhaes - AndroidRec 2012
13. 13 28/04/2012
Auto-complete/Sugestões
customizadas
Para incluir na Quick Seach Box:
android:includeInGlobalSearch="true”
Settings -> Searchable items
Ativar a busca em seu app
@JPMagalhaes - AndroidRec 2012
14. 14 28/04/2012
[1/3] Observações
Content Provider
Iguala qualquer outro Content Provider
Deve implementar pelo menos a função
query()
Retornando as sugestões em um Cursor
Cada sugestão (linha) retornada deve ter
colunas específicas
Assim o sistema pode exibir os valores
Quais colunas? NEXT!
@JPMagalhaes - AndroidRec 2012
15. 15 28/04/2012
[2/3] Observações
Banco de dados
Em geral, uma tabela exclusiva para sugestões
Ou re-utilize uma de suas tabelas
Colunas específicas obrigatórias
BaseColumns._ID
SearchManager.SUGGEST_COLUMN_TEXT_1
SearchManager.SUGGEST_COLUMN_TEXT_2
…
@JPMagalhaes - AndroidRec 2012
18. Android
Search
Framework
Integrando seu app
com a busca nativa
do Android
João Paulo Magalhaes
@JPMagalhaes_
Notas do Editor
Inserirváriasimagens do SO e de apps queusam a integração com o search.
BotãonãoémaisobrigatórioDeveserpossívelparaosusuáriosbuscaremquaisquer dados queosinteressemwhether the content is located on the device or the Internet.To help create a consistent search experience for users, androidhelps you implement search for your application.
In either case, the Android system will assist your search implementation by delivering search queries to a specific activity that performs searchs.Duasformas de implementarsua interface de buscas:a search dialogThe search dialog is a UI component that's controlled by the Android system. When activated by the user, the search dialog appears at the top of the activity, as shown in figure 1.The Android system controls all events in the search dialog. When the user submits a query, the system delivers the query to the activity that you specify to handle searches. The dialog can also provide search suggestions while the user types.search widget (SearchView) that you can embed in your activity layout.is an instance of SearchView that you can place anywhere in your layout. By default, the search widget behaves like a standard EditText widget and doesn't do anything, but you can configure it so that the Android system handles all input events, delivers queries to the appropriate activity, and provides search suggestions (just like the search dialog). However, the search widget is available only in Android 3.0 (API Level 11) and higher.Should I use the search dialog or the widget?The answer depends mostly on whether you are developing for Android 3.0 (API Level 11 or higher), because the SearchView widget was introduced in Android 3.0. So, if you are developing your application for a version of Android lower than 3.0, the search widget is not an option and you should use the search dialog to implement your search interface.If you are developing for Android 3.0 or higher, then the decision depends more on your needs. In most cases, we recommend that you use the search widget as an "action view" in the Action Bar. However, it might not be an option for you to put the search widget in the Action Bar for some reason (perhaps there's not enough space or you don't use the Action Bar). So, you might instead want to put the search widget somewhere in your activity layout. And if all else fails, you can still use the search dialog if you prefer to keep the search box hidden. In fact, you might want to offer both the dialog and the widget in some cases. For more information about the widget, skip to Using the Search Widget.
When the user executes a search from the search dialog or a search widget, the system creates an Intent and stores the user query in it. The system then starts the activity that you've declared to handle searches (the "searchable activity") and delivers it the intent. To set up your application for this kind of assisted search, you need the following:A searchable configurationAn XML file that configures some settings for the search dialog or widget. It includes settings for features such as voice search, search suggestion, and hint text for the search box.A searchable activityThe Activity that receives the search query, searches your data, and displays the search results.A search interface, provided by either:The search dialogBy default, the search dialog is hidden, but appears at the top of the screen when the user presses the device SEARCH button (when available) or another button in your user interface.Or, a SearchView widgetUsing the search widget allows you to put the search box anywhere in your activity. Instead of putting it in your activity layout, however, it's usually more convenient for users as an action view in the Action Bar.The rest of this document shows you how to create the searchable configuration, searchable activity, and implement a search interface with either the search dialog or search widget.
Implementando a buscaemseu appCreating a Searchable ConfigurationThe first thing you need is an XML file called the searchable configuration. It configures certain UI aspects of the search dialog or widget and defines how features such as suggestions and voice search behave. This file is traditionally named searchable.xml and must be saved in the res/xml/ project directory.Note: The system uses this file to instantiate a SearchableInfo object, but you cannot create this object yourself at runtime—you must declare the searchable configuration in XML.The searchable configuration file must include the <searchable> element as the root node and specify one or more attributes. For example:The android:label attribute is the only required attribute. It points to a string resource, which should be the application name. This label isn't actually visible to the user until you enable search suggestions for Quick Search Box. At that point, this label is visible in the list of Searchable items in the system Settings.Though it's not required, we recommend that you always include the android:hint attribute, which provides a hint string in the search box before users enters a query. The hint is important because it provides important clues to users about what they can search.Tip: For consistency among other Android applications, you should format the string for android:hint as "Search <content-or-product>". For example, "Search songs and artists" or "Search YouTube".The <searchable> element accepts several other attributes. However, you don't need most attributes until you add features such as search suggestions and voice search. For detailed information about the searchable configuration file, see the Searchable Configuration reference document.
Creating a Searchable ActivityA searchable activity is the Activity in your application that performs searches based on a query string and presents the search results.When the user executes a search in the search dialog or widget, the system starts your searchable activity and delivers it the search query in an Intent with the ACTION_SEARCH action. Your searchable activity retrieves the query from the intent's QUERY extra, then searches your data and presents the results.Because you may include the search dialog or widget in any other activity in your application, the system must know which activity is your searchable activity, so it can properly deliver the search query. So, you must first declare your searchable activity in the Android manifest file.Declaring a searchable activityIf you don't have one already, create an Activity that will perform searches and present results. You don't need to implement the search functionality yet—just create an activity that you can declare in the manifest. Inside the manifest's <activity> element:Declare the activity to accept the ACTION_SEARCH intent, in an <intent-filter> element.Specify the searchable configuration to use, in a <meta-data> element.For example:<application ... > <activity android:name=".SearchableActivity" > <intent-filter> <action android:name="android.intent.action.SEARCH" /> </intent-filter> <meta-data android:name="android.app.searchable"android:resource="@xml/searchable"/> </activity> ...</application>The <meta-data> element must include the android:name attribute with a value of "android.app.searchable" and the android:resource attribute with a reference to the searchable configuration file (in this example, it refers to the res/xml/searchable.xml file).Note: The <intent-filter> does not need a <category> with the DEFAULT value (which you usually see in <activity> elements), because the system delivers the ACTION_SEARCH intent explicitly to your searchable activity, using its component name.
Using the Search DialogThe search dialog provides a floating search box at the top of the screen, with the application icon on the left. The search dialog can provide search suggestions as the user types and, when the user executes a search, the system sends the search query to a searchable activity that performs the search. However, if you are developing your application for devices running Android 3.0, you should consider using the search widget instead (see the side box).The search dialog is always hidden by default, until the user activates it. If the user's device includes a SEARCH button, pressing it will activate the search dialog by default. Your application can also activate the search dialog on demand by calling onSearchRequested(). However, neither of these work until you enable the search dialog for the activity.To enable the search dialog, you must indicate to the system which searchable activity should receive search queries from the search dialog, in order to perform searches. For example, in the previous section about Creating a Searchable Activity, a searchable activity named SearchableActivity was created. If you want a separate activity, named OtherActivity, to show the search dialog and deliver searches to SearchableActivity, you must declare in the manifest that SearchableActivity is the searchable activity to use for the search dialog in OtherActivity.To declare the searchable activity for an activity's search dialog, add a <meta-data> element inside the respective activity's <activity> element. The <meta-data> element must include the android:value attribute that specifies the searchable activity's class name and the android:name attribute with a value of "android.app.default_searchable".For example, here is the declaration for both a searchable activity, SearchableActivity, and another activity, OtherActivity, which uses SearchableActivity to perform searches executed from its search dialog:<application ... > <!-- this is the searchable activity; it performs searches --> <activity android:name=".SearchableActivity" > <intent-filter> <action android:name="android.intent.action.SEARCH" /> </intent-filter> <meta-data android:name="android.app.searchable"android:resource="@xml/searchable"/> </activity> <!-- this activity enables the search dialog to initiate searches in the SearchableActivity --> <activity android:name=".OtherActivity" ... > <!-- enable the search dialog to send searches to SearchableActivity --> <meta-data android:name="android.app.default_searchable"android:value=".SearchableActivity" /> </activity> ...</application>Because the OtherActivity now includes a <meta-data> element to declare which searchable activity to use for searches, the activity has enabled the search dialog. While the user is in this activity, the device SEARCH button (if available) and the onSearchRequested() method will activate the search dialog. When the user executes the search, the system starts SearchableActivity and delivers it the ACTION_SEARCH intent.Note: The searchable activity itself provides the search dialog by default, so you don't need to add this declaration to SearchableActivity.If you want every activity in your application to provide the search dialog, insert the above <meta-data> element as a child of the <application> element, instead of each <activity>. This way, every activity inherits the value, provides the search dialog, and delivers searches to the same searchable activity. (If you have multiple searchable activities, you can override the default searchable activity by placing a different <meta-data> declaration inside individual activities.)With the search dialog now enabled for your activities, your application is ready to perform searches.Invoking the search dialogAs mentioned above, the device SEARCH button will open the search dialog as long as the current activity has declared in the manifest the searchable activity to use.However, some devices do not include a dedicated SEARCH button, so you should not assume that it's always available. When using the search dialog, you must always provide another search button in your UI that activates the search dialog by calling onSearchRequested().For instance, you should either provide a menu item in your Options Menu or a button in your activity layout that activates search by calling onSearchRequested(). The search_icons.zip file includes icons for medium and high density screens, which you can use for your search menu item or button (low-density screens scale-down the hdpi image by one half).You can also enable "type-to-search" functionality, which activates the search dialog when the user starts typing on the keyboard—the keystrokes are inserted into the search dialog. You can enable type-to-search in your activity by calling setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL) during your activity's onCreate() method.
The SearchView widget is available in Android 3.0 and higher. If you're developing your application for Android 3.0 and have decided to use the search widget, we recommend that you insert the search widget as an action view in the Action Bar, instead of using the search dialog (and instead of placing the search widget in your activity layout). For example, figure 2 shows the search widget in the Action Bar.The search widget provides the same functionality as the search dialog. It starts the appropriate activity when the user executes a search, and it can provide search suggestions and perform voice search.Note: When you use the search widget as an action view, you still might need to support using the search dialog, for cases in which the search widget does not fit in the Action Bar. See the following section about Using both the widget and the dialog.Configuring the search widgetAfter you've created a searchable configuration and a searchable activity, as discussed above, you need to enable assisted search for each SearchView. You can do so by calling setSearchableInfo() and passing it the SearchableInfo object that represents your searchable configuration.You can get a reference to the SearchableInfo by calling getSearchableInfo() on SearchManager.For example, if you're using a SearchView as an action view in the Action Bar, you should enable the widget during the onCreateOptionsMenu() callback:@Overridepublic booleanonCreateOptionsMenu(Menu menu) { // Inflate the options menu from XMLMenuInflaterinflater = getMenuInflater();inflater.inflate(R.menu.options_menu, menu); // Get the SearchView and set the searchable configurationSearchManagersearchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);SearchViewsearchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default return true;}That's all you need. The search widget is now configured and the system will deliver search queries to your searchable activity. You can also enable search suggestions for the search widget.Note: If you want to handle all user input yourself, you can do so with some callback methods and event listeners. For more information, see the reference documentation for SearchView and its nested interfaces for the appropriate event listeners.
Adding Search SuggestionsFigure 3. Screenshot of a search dialog with custom search suggestions.Both the search dialog and the search widget can provide search suggestions as the user types, with assistance from the Android system. The system manages the list of suggestions and handles the event when the user selects a suggestion.You can provide two kinds of search suggestions:Recent query search suggestionsThese suggestions are simply words that the user previously used as search queries in your application.See Adding Recent Query Suggestions.Custom search suggestionsThese are search suggestions that you provide from your own data source, to help users immediately select the correct spelling or item they are searching for. Figure 3 shows an example of custom suggestions for a dictionary application—the user can select a suggestion to instantly go to the definition.See Adding Custom Suggestions
Creating a Content ProviderCreating a content provider for custom suggestions requires previous knowledge about content providers that's covered in the Content Provider developer guide. For the most part, a content provider for custom suggestions is the same as any other content provider. However, for each suggestion you provide, the respective row in the Cursor must include specific columns that the system understands and uses to format the suggestions.When the user starts typing into the search dialog or search widget, the system queries your content provider for suggestions by calling query() each time a letter is typed. In your implementation of query(), your content provider must search your suggestion data and return a Cursor that points to the rows you have determined to be good suggestions.Details about creating a content provider for custom suggestions are discussed in the following two sections:Handling the suggestion queryHow the system sends requests to your content provider and how to handle themBuilding a suggestion tableHow to define the columns that the system expects in the Cursor returned with each queryHandling the suggestion queryWhen the system requests suggestions from your content provider, it calls your content provider's query() method. You must implement this method to search your suggestion data and return a Cursor pointing to the suggestions you deem relevant.Here's a summary of the parameters that the system passes to your query() method (listed in order):uriAlways a content Uri, formatted as:content://your.authority/optional.suggest.path/SUGGEST_URI_PATH_QUERYThe default behavior is for system to pass this URI and append it with the query text. For example:content://your.authority/optional.suggest.path/SUGGEST_URI_PATH_QUERY/puppiesThe query text on the end is encoded using URI encoding rules, so you might need to decode it before performing a search.The optional.suggest.path portion is only included in the URI if you have set such a path in your searchable configuration file with the android:searchSuggestPath attribute. This is only needed if you use the same content provider for multiple searchable activities, in which case, you need to disambiguate the source of the suggestion query.Note: SUGGEST_URI_PATH_QUERY is not the literal string provided in the URI, but a constant that you should use if you need to refer to this path.projectionAlways nullselectionThe value provided in the android:searchSuggestSelection attribute of your searchable configuration file, or null if you have not declared the android:searchSuggestSelection attribute. More about using this to get the query below.selectionArgsContains the search query as the first (and only) element of the array if you have declared the android:searchSuggestSelection attribute in your searchable configuration. If you have not declared android:searchSuggestSelection, then this parameter is null. More about using this to get the query below.sortOrderAlways nullThe system can send you the search query text in two ways. The default manner is for the query text to be included as the last path of the content URI passed in the uri parameter. However, if you include a selection value in your searchable configuration's android:searchSuggestSelection attribute, then the query text is instead passed as the first element of the selectionArgs string array. Both options are summarized next.Get the query in the UriBy default, the query is appended as the last segment of the uri parameter (a Uri object). To retrieve the query text in this case, simply use getLastPathSegment(). For example:String query = uri.getLastPathSegment().toLowerCase();This returns the last segment of the Uri, which is the query text entered by the user.Get the query in the selection argumentsInstead of using the URI, you might decide it makes more sense for your query() method to receive everything it needs to perform the look-up and you want the selection and selectionArgs parameters to carry the appropriate values. In such a case, add the android:searchSuggestSelection attribute to your searchable configuration with your SQLite selection string. In the selection string, include a question mark ("?") as a placeholder for the actual search query. The system calls query() with the selection string as the selection parameter and the search query as the first element in the selectionArgs array.For example, here's how you might form the android:searchSuggestSelection attribute to create a full-text search statement:<?xml version="1.0" encoding="utf-8"?><searchable xmlns:android="http://schemas.android.com/apk/res/android"android:label="@string/app_label"android:hint="@string/search_hint"android:searchSuggestAuthority="com.example.MyCustomSuggestionProvider"android:searchSuggestIntentAction="android.intent.action.VIEW"android:searchSuggestSelection="word MATCH ?"></searchable>With this configuration, your query() method delivers the selection parameter as "word MATCH ?" and the selectionArgs parameter as the search query. When you pass these to an SQLite query() method, as their respective arguments, they are synthesized together (the question mark is replaced with the query text). If you chose to receive suggestion queries this way and need to add wildcards to the query text, append (and/or prefix) them to the selectionArgs parameter, because this value is wrapped in quotes and inserted in place of the question mark.Another new attribute in the example above is android:searchSuggestIntentAction, which defines the intent action sent with each intent when the user selects a suggestion. It is discussed further in the section about Declaring an Intent for Suggestions.Tip: If you don't want to define a selection clause in the android:searchSuggestSelection attribute, but would still like to receive the query text in the selectionArgs parameter, simply provide a non-null value for the android:searchSuggestSelection attribute. This triggers the query to be passed in selectionArgs and you can ignore the selection parameter. In this way, you can instead define the actual selection clause at a lower level so that your content provider doesn't have to handle it.