The document discusses different types of tabs and how to implement them in Android, including fixed tabs, scrollable tabs, stacked tabs, and using TabHost. It also covers using intents to launch activities, make phone calls, send SMS, take photos and more. ListViews with different row types are demonstrated along with backward compatible tab implementations.
Testing Android apps based on Dagger and RxJava Droidcon UKFabio Collini
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk you'll learn how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code. In this talk, you will also explore:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests in both Java and Kotlin
how to use DaggerMock (an open source library available on github to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
Testing Android apps based on Dagger and RxJava Droidcon UKFabio Collini
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk you'll learn how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code. In this talk, you will also explore:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests in both Java and Kotlin
how to use DaggerMock (an open source library available on github to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
Presentation by Gabor Varadi (@zhuinden)
What Activity and Fragment actually are in Android
What are the problems they solve, and what are their downsides
How to use a custom solution that simplifies navigation in Android applications
https://github.com/Zhuinden/navigation-example
Simplified Android Development with Simple-StackGabor Varadi
This talk describes multiple Activities, Jetpack Navigation, and Simple-Stack in a single-activity android application context. How to develop screens and navigation using Simple-Stack.
After you’ve done all the UI optimizations recommended by UX designers, how do you make your interface even more engaging? That’s where the Samsung Mobile SDK can help. Part 1 of Advancing Your UI introduces you to three new technologies -- Look, Motion, and Gesture – that allow you to create an interface that engages your audience in ways you have not yet explored.
This Presentation talks about various aspects of managing the Activity Backstack.
Please note this was prepared last year but most of the concepts are still relevant
Compose is stable, it's time to integrate it into our apps! But it can be harder than expected and there are some questions to answer. Can the same architecture of a View-based app be reused or should we change it? Should the Compose code be aware of the architecture at all? And should the non UI code be changed to start using Compose? What can be replaced with a Composable, only the layouts or also something else?
Probably the best answer to all these questions is “it depends”, in this talk we’ll see some reasons and how to leverage Compose and the other tools to create a good architecture. Compose is more than just a UI framework and it can seem appealing to use it in a big portion of an app, a good architecture can be useful to limit this portion and use it only when necessary.
Testing Android apps based on Dagger and RxJavaFabio Collini
In this talk, you will learn:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests
how to use DaggerMock (an open source library available on github https://github.com/fabioCollini/DaggerMock) to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk we’ll see how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code.
Saindo da zona de conforto… resolvi aprender androidDaniel Baccin
Palestra sobre Android realizada na Secomp - UECE. A ideia dessa palestra é motivar estudantes, profissionais e “devs”, em geral, a conhecer um pouco mais sobre o desenvolvimento de aplicativos na plataforma Android. Além disso, será discutido sobre os desafios enfrentados durante o aprendizado, oportunidades existentes no mercado, perspectivas futuras sobre a plataforma e experiências já adquiridas na área. Também, será abordando conceitos básicos e intermediários através de exemplos práticos, ferramentas utilizadas e dicas de boas práticas para o desenvolvimento.
Using Kotlin coroutines it’s really easy to execute a task in a background thread and update the UI based on the result. Just enter the coroutine world using the launch method and then change thread using withContext. It’s even simpler if the task is an http call (thanks to coroutines support in retrofit) or a database query (thanks to Room). The final code is the same we’d use to execute synchronous code. But coroutines are more than just a tool to switch thread, we can use them to execute tasks in parallel. The code is still really easy to read but sometimes it can be difficult to write: we need to pay attention to many aspects (like nested scopes, exceptions and dispatchers). In this talk we’ll see how to leverage the coroutines library to manage parallelism, from the basic concepts to some advanced example.
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
Presentation by Gabor Varadi (@zhuinden)
What Activity and Fragment actually are in Android
What are the problems they solve, and what are their downsides
How to use a custom solution that simplifies navigation in Android applications
https://github.com/Zhuinden/navigation-example
Simplified Android Development with Simple-StackGabor Varadi
This talk describes multiple Activities, Jetpack Navigation, and Simple-Stack in a single-activity android application context. How to develop screens and navigation using Simple-Stack.
After you’ve done all the UI optimizations recommended by UX designers, how do you make your interface even more engaging? That’s where the Samsung Mobile SDK can help. Part 1 of Advancing Your UI introduces you to three new technologies -- Look, Motion, and Gesture – that allow you to create an interface that engages your audience in ways you have not yet explored.
This Presentation talks about various aspects of managing the Activity Backstack.
Please note this was prepared last year but most of the concepts are still relevant
Compose is stable, it's time to integrate it into our apps! But it can be harder than expected and there are some questions to answer. Can the same architecture of a View-based app be reused or should we change it? Should the Compose code be aware of the architecture at all? And should the non UI code be changed to start using Compose? What can be replaced with a Composable, only the layouts or also something else?
Probably the best answer to all these questions is “it depends”, in this talk we’ll see some reasons and how to leverage Compose and the other tools to create a good architecture. Compose is more than just a UI framework and it can seem appealing to use it in a big portion of an app, a good architecture can be useful to limit this portion and use it only when necessary.
Testing Android apps based on Dagger and RxJavaFabio Collini
In this talk, you will learn:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests
how to use DaggerMock (an open source library available on github https://github.com/fabioCollini/DaggerMock) to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk we’ll see how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code.
Saindo da zona de conforto… resolvi aprender androidDaniel Baccin
Palestra sobre Android realizada na Secomp - UECE. A ideia dessa palestra é motivar estudantes, profissionais e “devs”, em geral, a conhecer um pouco mais sobre o desenvolvimento de aplicativos na plataforma Android. Além disso, será discutido sobre os desafios enfrentados durante o aprendizado, oportunidades existentes no mercado, perspectivas futuras sobre a plataforma e experiências já adquiridas na área. Também, será abordando conceitos básicos e intermediários através de exemplos práticos, ferramentas utilizadas e dicas de boas práticas para o desenvolvimento.
Using Kotlin coroutines it’s really easy to execute a task in a background thread and update the UI based on the result. Just enter the coroutine world using the launch method and then change thread using withContext. It’s even simpler if the task is an http call (thanks to coroutines support in retrofit) or a database query (thanks to Room). The final code is the same we’d use to execute synchronous code. But coroutines are more than just a tool to switch thread, we can use them to execute tasks in parallel. The code is still really easy to read but sometimes it can be difficult to write: we need to pay attention to many aspects (like nested scopes, exceptions and dispatchers). In this talk we’ll see how to leverage the coroutines library to manage parallelism, from the basic concepts to some advanced example.
Alexey Buzdin "Maslow's Pyramid of Android Testing"IT Event
You all know what tests are. You all know you need to write them. But also you know it’s hard to start writing tests for mobile app thus you usually neglect it. Let’s look into Android automation testing, what technologies and approaches we can use to have a complete Maslow's Pyramid for testing. Unit Testing, Integration Testing, UI Automation, Mocking etc.
How to write better code: in-depth best practices for writing readable, simpl...Oursky
From data structure and object to architecture to refactoring. YouTube videos included. Summary of Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin
References:
Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin (http://www.amazon.com/Clean-Code-Handbook-
Software-Craftsmanship/dp/0132350882)
Design Patterns: ELements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
The Clean Code Talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
How to write better code: in-depth best practices for writing readable, simpl...Jane Chung
From data structure and object to architecture to refactoring. YouTube videos included. Summary of Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin
References:
Clean Code: A Handbook of Agile Software Craftsmanship: by Robert C Martin (http://www.amazon.com/Clean-Code-Handbook-
Software-Craftsmanship/dp/0132350882)
Design Patterns: ELements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
The Clean Code Talks - "Global State and Singletons"
https://www.youtube.com/watch?v=-FRm3VPhseI
The world of open source libraries and tools is vast for Android developers. Writing apps using solely Android SDK is impractical. Libraries can help you in many ways. They can speed up your development, save you creating boilerplate code and dealing with platform fragmentation, simplify your code and make it more readable and maintainable. In the talk I’m showing how several truly useful libraries can help a developer.
Presented at MobCon Europe 2017.
In Ember.js, routes and templates dictate the architecture of your app. This presentation will talk about why this is, and what tools Ember provides to manage architectural complexity.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
6. TabHost : Step 1 : activity_main.xml
by Eakapong Kattiya
Monday, July 15, 13
7. TabHost : Step 2 : MainActivity.java
public class MainActivity extends TabActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabHost mtabHost = getTabHost();
addTab1(mTabHost);
addTab2(mTabHost);
addTab3(mTabHost);
}
by Eakapong Kattiya
Monday, July 15, 13
8. TabHost : Step 3 : MainActivity.java
void addTab1(TabHost tabHost) {
// Tab for First
TabSpec tbFirst = tabHost.newTabSpec("Intent");
// setting Title and Icon for the Tab
tbFirst.setIndicator("Intent",null);
Intent firstIntent = new Intent(this, FirstActivity.class);
tbFirst.setContent(firstIntent);
// Adding TapSpec to tabHost
tabHost.addTab(tbFirst);
}
by Eakapong Kattiya
Monday, July 15, 13
9. TabHost : Step 4 : MainActivity.java
void addTab2(TabHost tabHost) {
// Tab for Second
TabSpec tbSecond = tabHost.newTabSpec("WebView");
// setting Title and Icon for the Tab
tbSecond.setIndicator("WebView", null);
Intent secondIntent = new Intent(this,SecondActivity.class);
tbSecond.setContent(secondIntent);
// Adding TapSpec to tabHost
tabHost.addTab(tbSecond);
}
by Eakapong Kattiya
Monday, July 15, 13
10. TabHost : Step 5 : MainActivity.java
void addTab3(TabHost tabHost) {
// Tab for Third
TabSpec tbThird = tabHost.newTabSpec("Third");
// setting Title and Icon for the Tab
tbThird.setIndicator(null,
getResources().getDrawable(R.drawable.ic_tab_third));
Intent thirdIntent = new Intent(this, ThirdActivity.class);
tbThird.setContent(thirdIntent);
// Adding TapSpec to tabHost
tabHost.addTab(tbThird);
}
by Eakapong Kattiya
Monday, July 15, 13
13. ListView
* TabActivity is deprecated
* use fragment Activity instead
by Eakapong Kattiya
Monday, July 15, 13
14. Single Line List : simple_list_item_1
* TabActivity is deprecated
* use fragment Activity instead
android.R.layout.simple_list_item_1
by Eakapong Kattiya
Monday, July 15, 13
15. Single Line List : simple_list_item_1 : FirstActivity.java
public class FirstActivity extends Activity
implements OnItemClickListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
initListView();
}
by Eakapong Kattiya
Monday, July 15, 13
16. Single Line List : simple_list_item_1 : FirstActivity.java
* TabActivity is deprecated
* use fragment Activity instead
private void initListView() {
// 1. Create listView object
ListView listView = (ListView) findViewById(R.id.listView1);
// 2. Create mArraylist object
String[] stringArray = new String[]{"Phone","SMS","EMAIL","CAMERA"};
// Alternative
// ArrayList<String> mArraylist = new ArrayList<String>();
// mArraylist.add("Item1");
// mArraylist.add("Item2");
// 3. Create arrayAdapter object
// first parameter = context of the activity
// second parameter = the type of list view
// third parameter = your array
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>
(this,android.R.layout.simple_list_item_1, stringArray);
listView.setAdapter(arrayAdapter);
// 4. Add listView Listener
listView.setOnItemClickListener(this);
}
by Eakapong Kattiya
Monday, July 15, 13
17. Single Line List : simple_list_item_1 : FirstActivity.java
* TabActivity is deprecated
* use fragment Activity instead
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
String item = (String) arg0.getItemAtPosition(arg2);
Log.i("Click listView", item);
Toast.makeText(getApplicationContext(),
"Click listView " + item,
Toast.LENGTH_LONG).show();
}
by Eakapong Kattiya
Monday, July 15, 13
18. Single Line List : simple_list_item_1
by Eakapong Kattiya
Monday, July 15, 13
19. 2 Line List : simple_list_item_2
android.R.layout.simple_list_item_2
by Eakapong Kattiya
TwoLineListItem
Monday, July 15, 13
20. 2 Line List : simple_list_item_2 : SecondActivity.java
* TabActivity is deprecated
* use fragment Activity instead
public class SecondActivity extends Activity
implements OnItemClickListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
initListView();
}
by Eakapong Kattiya
Monday, July 15, 13
21. 2 Line List : simple_list_item_2 : SecondActivity.java
* TabActivity is deprecated
* use fragment Activity instead
private void initListView(){
ListView listView = (ListView) findViewById(R.id.listView1);
ArrayList<Item> items = new ArrayList<Item>();
Item item1 = new Item();
item1.setTitle("iBluecode");
item1.setDetail("http://www.ibluecode.com");
items.add(item1);
Item item2 = new Item();
item2.setTitle("Facebook");
item2.setDetail("http://www.facebook.com");
items.add(item2);
Item item3 = new Item();
item3.setTitle("Twitter");
item3.setDetail("http://www.twitter.com");
items.add(item3);
Item item4 = new Item();
item4.setTitle("YouTube");
item4.setDetail("http://www.youtube.com");
items.add(item4);
listView.setAdapter(new ItemBaseAdapter(this, items));
listView.setOnItemClickListener(this);
}
by Eakapong Kattiya
Monday, July 15, 13
22. 2 Line List : simple_list_item_2 : SecondActivity.java
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Item item = (Item) arg0.getItemAtPosition(arg2);
Log.i("Click listView ", item.title);
Toast.makeText(getApplicationContext(),
"Click listView " + item.title,
Toast.LENGTH_LONG).show();
Intent intent = null ;
if(arg2 == 0){
intent = new Intent(SecondActivity.this,FirstActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
if(arg2 == 1){
intent = new Intent(SecondActivity.this, SecondActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
startActivity(intent);
//finish();
}
by Eakapong Kattiya
Monday, July 15, 13
23. 2 Line List : simple_list_item_2
by Eakapong Kattiya
TwoLineListItem
Monday, July 15, 13
24. Backward-compatible Tabs
by Eakapong Kattiya
Eclair (Android 2.3) Honeycomb (Android 4.0)
http://developer.android.com/shareables/training/TabCompat.zip
Monday, July 15, 13
26. by Eakapong Kattiya
Intent
Intents can be used to
• Opening new activity
• Passing data between activities.
• Launching the built-in web browser and supplying a URL address
• Launching the web browser and supplying a search string
• Launching the built-in Dialer application and supplying a phone number
• Launching the built-in Maps application and supplying a location
• Launching Google StreetView and supplying a location
• Launching the built-in Camera application in still or video mode
• Launching a ringtone picker
• Recording a sound
Monday, July 15, 13
27. by Eakapong Kattiya
Intent : Opening new activity
Intent intent = new Intent(getApplicationContext(), WebViewActivity.class);
startActivity(intent);
//or
startActivity(new Intent(FirstActivity.this, WebViewActivity.class));
//or
startActivity(Intent.createChooser(intent, "Open url with:"));
//or
startActivityForResult(intent,1337);
FirstActivity.java
Monday, July 15, 13
28. by Eakapong Kattiya
Intent : Passing data between activities.
//set Extra Data before startActivity;
Intent intent = new Intent(this, WebViewActivity.class);
intent.putExtra("url","http://www.ibluecode.com");
intent.putExtra("tag",100);
startActivity(intent);
//get Extra Data on WebViewActivity;
String urlString = "http://www.default.com" ;
Intent intent = getIntent();
if( intent.getExtras() != null)
{
urlString = intent.getExtras().get("url").toString() ;
}
FirstActivity.java
WebViewActivity.java
Monday, July 15, 13
29. by Eakapong Kattiya
Intent : Phone call
String uriString = "tel:" + "086-673-2111" ;
Intent intent = new Intent(Intent.ACTION_DIAL); //Intent.ACTION_CALL
intent.setData(Uri.parse(uriString));
startActivity(intent);
FirstActivity.java
Monday, July 15, 13
30. by Eakapong Kattiya
Intent : Send SMS
String uriString = "smsto:" + "0866732111" ;
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse(uriString));
intent.putExtra("sms_body", "The SMS text");
startActivity(intent);
}
FirstActivity.java
Monday, July 15, 13
31. by Eakapong Kattiya
Intent : Send Email
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
String aEmailList[] = { "eakkattiya@gmail.com","eak.k@ibluecode.com" };
String aEmailCCList[] = { "eakkattiya@gmail.com" };
String aEmailBCCList[] = { "eakkattiya@gmail.comm" };
intent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
intent.putExtra(android.content.Intent.EXTRA_CC, aEmailCCList);
intent.putExtra(android.content.Intent.EXTRA_BCC, aEmailBCCList);
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My subject");
intent.setType("plain/text");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "My message body.");
startActivity(Intent.createChooser(intent, "Send your email with:"));
FirstActivity.java
Monday, July 15, 13
32. by Eakapong Kattiya
Intent :Take a photo
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(Intent.createChooser(intent, "Take a with:"),MY_CAMERA_REQUEST);
//Get Taken Image
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == MY_CAMERA_REQUEST && resultCode == RESULT_OK) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
ImageView imageView = (ImageView)findViewById(R.id.imageView1);
imageView.setImageBitmap(photo);
}
}
FirstActivity.java
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
AndroidManifest.xml
Monday, July 15, 13