Showing posts with label Mobile OS. Show all posts
Showing posts with label Mobile OS. Show all posts

Sunday, 6 August 2023

Unlocking the Potential: Weighing the Pros and Cons of Jailbreaking or Rooting Your Mobile Device.

 In today's tech-savvy world, smartphones have become an indispensable part of our lives, offering a wide array of features and functionalities. However, some users seek even more control and customization over their devices, leading them to explore the world of jailbreaking (for iOS devices) or rooting (for Android devices). While these practices provide users with additional freedom, they also come with potential risks and drawbacks. In this blog, we'll explore the pros and cons of jailbreaking or rooting your mobile device, helping you make an informed decision.

What is Jailbreaking or Rooting?

Jailbreaking (for iOS devices) and rooting (for Android devices) are procedures that remove restrictions imposed by the operating system, granting users administrative access to the device's file system and allowing them to run custom software or modify system settings. This process essentially liberates your device from the manufacturer's limitations, giving you greater control over its functionality.

Pros of Jailbreaking or Rooting

  • Enhanced Customization: Jailbreaking or rooting grants users access to the device's core system files, enabling them to customize their devices extensively. Users can install themes, custom fonts, and tweak the user interface to their liking, giving their smartphones a unique and personalized look and feel.
  • Access to Unofficial Apps: The official app stores, such as Apple's App Store and Google Play Store, have strict guidelines that sometimes lead to the rejection of certain apps. By jailbreaking or rooting, users can access third-party app repositories, offering a wide range of apps and tweaks not available in official stores. This opens up a world of possibilities and experimentation.
  • Removal of Bloatware: Manufacturers often pre-install unwanted apps, commonly known as bloatware, on mobile devices. Jailbreaking or rooting allows users to uninstall or disable these pre-installed applications, freeing up valuable storage space and potentially improving device performance.
  • System Tweaks and Improvements: With jailbreaking or rooting, users can apply system-level tweaks and improvements that can optimize device performance, enhance battery life, and even overclock the CPU for better processing power.
  • Advanced Backup and Restore: Jailbreaking or rooting provides users with the ability to create full system backups, enabling easy restoration in case of software issues or data loss. This is especially beneficial for advanced users who frequently experiment with their devices.

Cons of Jailbreaking or Rooting

  • Voiding Warranty and Security Risks: Jailbreaking or rooting your device typically voids the warranty provided by the manufacturer, leaving users with no official support for hardware and software issues. Additionally, by accessing core system files, users expose their devices to potential security risks, including malware and unauthorized access.
  • Stability and Performance Issues: Modifying the device's operating system can lead to stability and performance problems. Users might encounter frequent crashes, freezes, or battery drainage, especially if they install poorly optimized or incompatible software.
  • Software Incompatibility: As manufacturers continuously update their devices and operating systems, jailbreaking or rooting might make your device incompatible with the latest software updates. This means you could miss out on crucial security patches and exciting new features.
  • Reduced Device Lifespan: Due to potential software complications and increased vulnerability to malware, jailbroken or rooted devices might experience a reduced lifespan. Constant tweaking and experimentation can accelerate wear and tear on the hardware.
  • Legal Implications: In some regions, jailbreaking or rooting your mobile device might be considered illegal or against the terms of service of the manufacturer or carrier. Users should be aware of the legal implications in their specific jurisdiction before attempting such modifications.

Precautions and Steps to Jailbreak or Root:
  • Backup: Before attempting any modification, back up your device to safeguard your data.
  • Research: Find a reputable and reliable guide specific to your device and software version. Follow the steps meticulously and ensure you understand each action you take.
  • Use Trusted Sources: Download jailbreak or rooting tools from trustworthy sources to reduce the risk of malware infection.
  • Security Software: Install reputable security software to protect your device from potential threats.
Post-Jailbreak/Rooting:
  • Be Selective: Exercise caution when installing third-party apps and tweaks. Stick to trusted sources to minimize security risks.
  • Regular Updates: Keep your device's software up-to-date, even if it means losing root access temporarily. This will ensure you have the latest security patches.
  • Revoke Root Access: If needed, you can reverse the jailbreak or root process to restore your device's original state.

Conclusion

Jailbreaking or rooting your mobile device can provide a thrilling and liberating experience, granting you unprecedented control over your smartphone. Enhanced customization, access to unofficial apps, and the ability to remove bloatware are alluring benefits that many users find attractive. However, the risks associated with voiding the warranty, security concerns, and potential software issues cannot be ignored.

Ultimately, the decision to jailbreak or root your mobile device should be made with caution and careful consideration of the potential consequences. If you're an advanced user who values customization and is willing to take on the associated risks, proceed with care and be mindful of the potential drawbacks. For the average user, sticking with the official operating system is likely the safer and more convenient option. Always remember that the responsibility lies with the user, and staying informed about the risks and benefits is crucial in making a well-informed decision for your mobile device.

Saturday, 3 June 2023

Mobile App Maintenance and Updates: Ensuring Long-Term Success.

 Developing a mobile app is just the first step in a long journey towards achieving success. Once your app is launched, it requires ongoing maintenance and regular updates to keep up with user expectations, address bugs, and leverage emerging technologies. In this blog, we will explore the importance of mobile app maintenance and updates in ensuring long-term success, along with best practices to follow.

Enhancing User Experience:

Mobile app maintenance and updates play a crucial role in enhancing the user experience. By continuously analyzing user feedback, tracking metrics, and conducting usability testing, you can identify pain points and areas for improvement. Regular updates allow you to address user concerns, fix bugs, optimize performance, and introduce new features that align with user expectations, resulting in a seamless and engaging experience.

Compatibility and Security:

As mobile operating systems evolve, it is essential to ensure that your app remains compatible with the latest OS versions. Mobile app maintenance involves staying up to date with platform-specific guidelines and APIs, and adapting your app to maintain compatibility across different devices and OS versions. Regular updates also enable you to address security vulnerabilities and protect user data, providing a safe and secure environment for your app users.

Bug Fixes and Performance Optimization:

No app is perfect, and bugs are bound to occur. Mobile app maintenance involves monitoring crash reports, user feedback, and analytics to identify and resolve issues promptly. Regular updates allow you to fix bugs, improve app stability, and optimize performance. This not only enhances the user experience but also helps in retaining users and fostering positive app reviews, contributing to the long-term success of your app.

Adaptation to Emerging Technologies:

Technology is constantly evolving, and staying ahead of the curve is crucial for the long-term success of your mobile app. Regular maintenance and updates allow you to leverage emerging technologies and trends, such as artificial intelligence (AI), machine learning (ML), augmented reality (AR), or blockchain. By integrating these technologies into your app, you can provide innovative features, improve efficiency, and stay competitive in the market.

Feature Enhancements and Innovation:

Mobile app maintenance and updates offer an opportunity for feature enhancements and innovation. By closely monitoring user behavior, conducting market research, and analyzing industry trends, you can identify new features or functionalities that can add value to your app. Regular updates enable you to introduce these new features, keep your app fresh and exciting, and retain user interest over the long term.

User Engagement and Retention:

Regular updates not only attract new users but also help in retaining existing ones. By introducing new features, providing bug fixes, and addressing user feedback, you show your commitment to continuously improving the app experience. This fosters user loyalty, encourages user engagement, and increases the chances of positive word-of-mouth referrals, which are invaluable for the long-term success of your app.

App Store Optimization and Marketing:

Mobile app maintenance and updates also play a role in app store optimization (ASO) and marketing. By consistently updating your app with new features, bug fixes, and performance improvements, you demonstrate to the app stores that your app is actively maintained and deserving of higher visibility. Additionally, communicating updates and improvements to your users through release notes and marketing campaigns can generate excitement, increase app downloads, and attract new users.

Conclusion:

Mobile app maintenance and updates are vital for ensuring the long-term success of your app. By prioritizing user experience, addressing bugs, optimizing performance, adapting to emerging technologies, and fostering user engagement, you can create a sustainable app that continues to meet user expectations and remains competitive in a rapidly evolving mobile landscape. Embrace the journey of continuous improvement and updates to maximize the potential of your mobile app and provide an exceptional experience for your users.

Friday, 2 June 2023

Creating an Efficient Shopping Cart with No Code: A Step-by-Step Guide.

 In the digital era, e-commerce has revolutionized the way we shop, and having a functional shopping cart is essential for any online store. Traditionally, building a shopping cart required programming knowledge and coding skills. However, with the rise of no-code development tools, creating a shopping cart has become more accessible to non-technical individuals. In this blog post, we will guide you through the process of building a shopping cart without writing a single line of code.

Step 1: Choose a No-Code Platform

To create a shopping cart without code, we need a no-code platform that provides pre-built components and functionality. There are several options available, such as Webflow, Bubble, and Adalo. In this guide, we will use Bubble.io, a popular visual development platform.

Step 2: Set up your Project

Sign up for an account on Bubble.io and create a new project. Once you're inside the Bubble editor, you'll see a blank canvas to start building your shopping cart.

Step 3: Designing the User Interface

A visually appealing user interface plays a crucial role in attracting and engaging customers. With Bubble.io's drag-and-drop interface, you can design your shopping cart by placing elements like buttons, input fields, and images on the canvas. Consider the following elements for your shopping cart UI:

  • Product Listing: Display your products with images, titles, prices, and an "Add to Cart" button.
  • Cart Icon: Include a small cart icon that users can click to view their cart.
  • Cart Popup: Create a pop-up window that appears when users interact with the cart icon, displaying the selected products and a checkout button.
  • Checkout Page: Design a separate page where users can review their cart items, enter their shipping and payment details, and complete the purchase.

Step 4: Creating Data Types

To store and manage data related to products, user information, and orders, we need to define data types. In Bubble.io, you can create data types like "Product," "User," and "Order" using the visual interface. Determine the necessary fields for each data type, such as name, price, image URL, and quantity.

Step 5: Adding Interactivity

Now it's time to make your shopping cart functional. We'll add interactivity to allow users to add products to their cart and proceed to checkout. Follow these steps:

  • Add a workflow to the "Add to Cart" button. When clicked, create a new order item in the database, associating it with the user and the selected product.
  • Create a workflow for the cart icon. When clicked, show the cart popup.
  • In the cart popup, display the user's order items using a repeating group. Include buttons to increase/decrease quantities or remove items from the cart.
  • Add a workflow to the checkout button in the cart popup. When clicked, navigate the user to the checkout page.

Step 6: Implementing Checkout Functionality

On the checkout page, users should be able to review their cart items, enter their shipping and payment details, and complete the purchase. Here's how you can achieve this:

  • Create input fields for shipping information (address, name, etc.) and payment details (credit card number, expiration date, etc.).
  • Implement a workflow for the checkout button. When clicked, create a new order in the database, associating it with the user and their order items. You can also integrate with a payment gateway, such as Stripe, to process the payment.
  • Provide a confirmation message or redirect users to a thank-you page after a successful purchase.

Step 7: Testing and Deployment

Before making your shopping cart live, thoroughly test its functionality. Ensure that products can be added to the cart, the cart updates correctly, and the checkout process works smoothly. Once you're satisfied with the results, deploy your shopping cart on a hosting platform of your choice or use Bubble.io's built-in deployment options.

Conclusion:

Building a shopping cart without code is now a reality, thanks to no-code development platforms like Bubble.io. By following this step-by-step guide, you can create a visually appealing and functional shopping cart for your online store, all without writing a single line of code. Embrace the power of no-code tools and unlock new possibilities for your e-commerce business. Happy cart building!

Wednesday, 31 May 2023

Unlocking the Power of IoT, Artificial Intelligence, and Machine Learning in Mobile Development.

In the ever-evolving world of technology, the convergence of IoT, artificial intelligence (AI), and machine learning (ML) has opened up unprecedented possibilities in mobile development. This powerful trio is reshaping the way we interact with mobile devices, enabling smarter and more personalized experiences. In this blog post, we will explore the fascinating realm of IoT, AI, and ML in mobile development, delving into their potential applications, benefits, and the exciting future they hold.

The Rise of IoT in Mobile Development:

The Internet of Things (IoT) has revolutionized the way we connect and interact with our surroundings. By integrating IoT capabilities into mobile apps, developers can create a seamless bridge between the physical and digital worlds. Whether it's controlling smart home devices, tracking fitness data, or monitoring industrial processes, mobile apps act as a gateway to IoT-powered experiences.

Harnessing the Power of Artificial Intelligence:

Artificial intelligence has become a game-changer in mobile development, enabling devices to perform complex tasks and make intelligent decisions. AI-powered virtual assistants, such as Siri and Google Assistant, have become ubiquitous, allowing users to interact with their devices using natural language. Moreover, AI-driven chatbots are enhancing customer support experiences, while AI algorithms enable personalized recommendations and predictive analysis in various mobile apps.

Machine Learning: The Key to Intelligent Mobile Apps:

Machine learning algorithms empower mobile apps to learn and adapt based on user data, leading to highly personalized experiences. From image recognition and natural language processing to recommendation systems, ML algorithms make it possible for apps to understand user preferences, behavior, and context. This enables apps to provide tailored content, improve search results, and deliver intelligent insights to users.

Real-World Applications:

a. Healthcare: IoT-enabled mobile apps coupled with AI and ML algorithms are transforming healthcare delivery. Remote patient monitoring, wearable health devices, and AI-driven diagnosis systems are revolutionizing the way healthcare services are delivered, improving patient outcomes and reducing costs.

b. Smart Homes: IoT-connected mobile apps, integrated with AI and ML, allow users to control and automate various aspects of their homes. From adjusting the temperature to managing appliances and security systems, mobile apps provide users with unprecedented control and convenience.

c. Transportation: Mobile apps leveraging IoT, AI, and ML are reshaping transportation systems. From ride-sharing apps that optimize routes based on traffic patterns to predictive maintenance of vehicles using IoT sensors, these technologies are enhancing efficiency, safety, and overall user experience.

Challenges and Future Trends:

While the potential of IoT, AI, and ML in mobile development is immense, it's crucial to address challenges such as data privacy, security, and ethical considerations. Striking the right balance between personalization and privacy will be a key challenge for developers.

Looking ahead, the future of IoT, AI, and ML in mobile development is promising. As devices become smarter, more connected, and capable of processing vast amounts of data, we can expect even more intelligent and context-aware mobile experiences. Emerging technologies like edge computing, 5G networks, and augmented reality will further augment the possibilities and potential use cases of these technologies.

Conclusion:

IoT, artificial intelligence, and machine learning have ushered in a new era of possibilities in mobile development. The ability to seamlessly connect devices, leverage AI-driven insights, and provide personalized experiences is revolutionizing industries across the board. As developers, embracing these technologies and keeping pace with their rapid advancements will unlock new horizons in mobile app development. 

Saturday, 1 April 2023

Unlocking Revenue: Exploring Innovative Mobile App Monetization Strategies.

 In today's mobile-driven world, developing a successful mobile application goes beyond creating an exceptional user experience. App developers must also consider monetization strategies to generate revenue and sustain their businesses. Among the various monetization approaches, advertisements, freemium, and premium models have emerged as popular options. This blog will explore these strategies in detail, shedding light on their advantages, challenges, and best practices.

Advertisements

Advertisements are a widely adopted method for monetizing mobile applications. They involve displaying third-party ads within the app's interface. The revenue is typically generated through impressions, clicks, or conversions, depending on the ad format and agreement with the advertising network.

Advantages:

Wide availability of ad networks: Numerous ad networks provide developers with a variety of ad formats and options to choose from, allowing for customization based on user preferences and app content.

Scalable revenue potential: Advertisements offer the potential for significant revenue generation, especially for apps with a large user base or high engagement levels.

Ease of implementation: Integrating ads into an app is relatively straightforward, with many ad network SDKs providing comprehensive documentation and support.

Challenges:

User experience and engagement: Poorly implemented or intrusive ads can disrupt the user experience, leading to dissatisfaction and even app abandonment. Striking a balance between revenue generation and user satisfaction is crucial.

Ad blockers: With the rise in ad-blocking software, the effectiveness of advertisements as a monetization strategy may be reduced. Developers must explore alternative methods or consider non-intrusive ad formats.

Dependency on user traffic: The revenue potential of ads heavily relies on the app's user base and user engagement. Apps with a small user base may struggle to generate significant revenue through ads alone.

Best Practices:

Implement non-intrusive ad formats: Choose ad formats that seamlessly integrate into the app's design and do not disrupt the user experience.

Targeted and relevant ads: Display ads that align with the app's content and the user's interests, increasing the likelihood of engagement and conversions.

Monitor ad performance: Continuously evaluate the performance of ads, including click-through rates (CTR) and conversion rates, and make adjustments as necessary.

Freemium Model

The freemium model allows users to download and use the basic version of an app for free, while offering additional features or content through in-app purchases or subscriptions. This approach aims to convert free users into paying customers by providing a compelling experience that encourages them to upgrade.

Advantages:

User acquisition and retention: Offering a free version of the app attracts a larger user base. The freemium model allows users to experience the app's core functionalities before deciding to upgrade, increasing the chances of user retention.

Revenue diversification: In addition to generating revenue through premium upgrades, the freemium model allows developers to explore other monetization options such as in-app advertisements or offering virtual goods.

Continuous revenue stream: Once users upgrade to the premium version or make in-app purchases, the app can generate ongoing revenue, providing a steady income source.

Challenges:

Balancing free and premium content: Striking the right balance between the free and premium features is crucial. Offering too much for free may discourage upgrades, while offering too little may result in a poor user experience and limited retention.

Monetization fatigue: Users may become fatigued by the frequency or perceived pressure of in-app purchase prompts, leading to frustration and potential app abandonment.

Competition and pricing challenges: Determining the appropriate pricing for premium features or subscriptions requires careful consideration, taking into account the app's value proposition, market competition, and user expectations.

Best Practices:

Provide a compelling free experience: Offer enough value in the free version to engage users and encourage them to explore premium features.

Segment user base: Identify user segments based on usage patterns, preferences, or demographics, and tailor monetization strategies accordingly.

A/B testing: Experiment with different pricing models, feature sets, or subscription plans to identify the most effective approach for generating conversions.

Premium Model

The premium model involves charging users upfront to download and access the full version of an app. It is often suitable for apps with unique or specialized content, high-quality experiences, or niche markets where users are willing to pay for a premium product.

Advantages:

Immediate revenue generation: Charging a price upfront enables developers to generate revenue from the initial app downloads.

Lower reliance on advertising or in-app purchases: With the premium model, the app's revenue is not solely dependent on advertising impressions or in-app purchases, providing a more predictable income stream.

Perceived value: Users may perceive a higher value in a paid app, associating it with quality and exclusivity.

Challenges:

User acquisition: Convincing users to pay upfront for an app can be challenging, especially when there are free alternatives available. The app must demonstrate clear value and benefits to justify the price.

Competitive market: With countless apps available, developers must differentiate their premium apps by offering unique features, exceptional quality, or specialized content.

App updates and customer support: Users who pay for the app expect ongoing updates and responsive customer support. Failure to meet these expectations may result in negative reviews and reduced sales.

Best Practices:

Highlight unique value propositions: Clearly communicate the app's unique features, benefits, and value to potential users.

Engage with user feedback: Promptly address user feedback, provide updates, and ensure a high level of customer support to maintain customer satisfaction and positive reviews.

Utilize limited-time promotions: Periodically offer discounted or free promotions to attract new users and encourage them to experience the app's value firsthand.

Conclusion

When it comes to mobile app monetization, developers have a range of strategies at their disposal. Advertisements, freemium, and premium models offer distinct approaches, each with its own advantages and challenges. Ultimately, the choice of monetization strategy depends on factors such as app type, target audience, market competition, and revenue goals. Combining these strategies or experimenting with hybrid models can also be effective in maximizing revenue generation. By understanding the strengths and limitations of each model, app developers can make informed decisions and build sustainable businesses in the dynamic world of mobile applications.

Wednesday, 1 March 2023

A Journey Through Android History: Remembering the Technological Evolution.

 In the fast-paced world of mobile development, it's easy to get caught up in the latest trends and technologies. However, it's essential for developers to remember and appreciate the rich history that paved the way for the current state of Android. By understanding the past, we can better appreciate the present and anticipate the future. Join us on a journey through Android's remarkable history, from its humble beginnings to the powerhouse platform it is today.

The Birth of Android (2003-2007):

Our story begins in 2003 when Andy Rubin, Rich Miner, Nick Sears, and Chris White founded Android Inc. The initial vision of the company was to develop an advanced operating system for digital cameras. However, as the mobile industry started gaining momentum, Android Inc. shifted its focus to smartphones. In 2005, Google acquired Android Inc., setting the stage for what was to come.

Android OS 1.0: The Cupcake Era (2008):

In September 2008, Google released the first version of the Android operating system, Android 1.0, which was aptly named "Cupcake." This release introduced essential features such as push notifications, widgets, and the Android Market (now known as Google Play Store). Developers could now create and distribute applications, marking a significant turning point for the platform.

Maturing with Donut, Eclair, and Froyo (2009-2010):

With subsequent updates like Donut, Eclair, and Froyo, Android expanded its feature set and improved overall performance. These versions introduced features such as voice-guided navigation, live wallpapers, support for multiple screen sizes, and enhanced performance through JIT (Just-In-Time) compilation. Android started to gain popularity among both users and developers alike.

The Gingerbread and Honeycomb Divide (2010-2011):

The release of Gingerbread (Android 2.3) in 2010 marked the platform's focus on refining user experience and optimizing performance. Gingerbread introduced features like NFC support and a refined user interface.

Simultaneously, Honeycomb (Android 3.0) was developed exclusively for tablets. It introduced a revamped interface optimized for larger screens. Although Honeycomb's adoption was limited, it laid the groundwork for future tablet-oriented releases.

Ice Cream Sandwich and Jelly Bean: A Unified Experience (2011-2013):

In 2011, Android 4.0, code-named Ice Cream Sandwich (ICS), aimed to provide a unified experience across smartphones and tablets. It brought a refreshed UI design, improved multitasking, and introduced Face Unlock.

Jelly Bean (Android 4.1-4.3) followed, focusing on performance improvements and introducing features like Google Now, expandable notifications, and Project Butter, which significantly enhanced the platform's responsiveness.

KitKat, Lollipop, and Material Design (2013-2014):

Android 4.4, known as KitKat, brought further optimizations, focusing on lower memory requirements, improved battery life, and a more immersive user experience. This release also introduced the Google Now launcher and enhanced voice search capabilities.

The subsequent release, Lollipop (Android 5.0-5.1), introduced the iconic Material Design language, offering a vibrant and visually appealing UI. Lollipop also introduced significant under-the-hood changes, including ART (Android Runtime) as the default runtime environment, improving app performance.

Marshmallow, Nougat, and Oreo: Refinements and Features (2015-2017):

Marshmallow (Android 6.0) introduced granular app permissions, Doze mode for improved battery life, and Google Now on Tap for contextual information. Nougat (Android 7.0-7.1) built upon these enhancements, introducing split-screen multitasking, direct reply notifications, and the Vulkan API for better graphics performance.

Oreo (Android 8.0-8.1) brought further refinements, including picture-in-picture mode, notification channels, and Project Treble, which aimed to streamline the Android update process.

Android P to R: AI Integration and Privacy Focus (2018-2021):

With Android 9.0 (Pie) and subsequent versions, Google focused on integrating AI capabilities into the platform. Features like Adaptive Battery, App Actions, and Digital Wellbeing aimed to enhance user experiences by leveraging machine learning.

Android 10 (Q) introduced a system-wide dark mode, enhanced privacy controls, and improved gesture navigation. Android 11 and 12 continued building upon these foundations, emphasizing privacy and providing better support for foldable devices.

Conclusion:

The history of Android is a testament to the remarkable journey of a platform that started as a vision and grew into a global powerhouse. From humble beginnings to a dominant force in the mobile industry, Android has continually evolved, pushing technological boundaries and enabling developers to create innovative applications.

As developers, we must never forget the lessons of the past. By understanding Android's history, we gain valuable insights into the platform's evolution, which can inform our decisions and shape the future of mobile development. Let's appreciate the achievements, learn from the challenges, and continue pushing the boundaries of what Android can do.

Friday, 1 December 2017

HB Blog 149: Cross Platform Development.

In computing, cross-platform software (also multi-platform software or platform-independent software) is computer software that is implemented on multiple computing platforms. Cross-platform software may be divided into two types; one requires individual building or compilation for each platform that it supports, and the other one can be directly run on any platform without special preparation. Cross-platform programming is the practice of actively writing software that will work on more than one platform.
There are a number of tools which are available to help facilitate the process of cross-platform programming:
  1.     8th: A cross-platform development language, which utilizes Juce as its GUI layer. The platforms it currently supports are: Android, iOS, Windows, macOS, Linux and Raspberry Pi.
  2.     Anant Computing: A mobile application platform that works in all Indian languages, including their keyboards, which is also supports AppWallet and Native performance inside all operating systems.
  3.     Appcelerator: It helps in building native apps by deploying just a single JavaScript code base. It provides your web content in a native application, ensuring your code is not wrapped around a web container unlike few other such solutions.
  4.     AppearIQ: A framework that supports the workflow of app development and deployment in an enterprise environment. Natively developed containers present hardware features of the mobile devices or tablets through an API to HTML5 code thus facilitating the development of mobile apps that run on different platforms.
  5.     Cairo: A free software library used to provide a vector graphics-based, device-independent API. It is designed to provide primitives for 2-dimensional drawing across a number of different backends. Cairo is written in C and has bindings for many programming languages.
  6.     Cocos2d: An open source toolkit and game engine for developing 2D and simple 3D cross-platform games and applications.
  7.     Delphi: A cross platform IDE, which uses Pascal language for Development. Currently it supports Android, iOS, Windows, macOS.
  8.     Ecere SDK: A cross platform GUI & 2D/3D graphics toolkit and IDE, written in eC and with support for additional languages such as C and Python. Currently it supports Linux, FreeBSD, Windows, Android, macOS and the Web through Emscripten or Binaryen (WebAssembly)
  9.     Eclipse: An open source cross-platform development environment. Implemented in Java with a configurable architecture which supports many tools for software development. Add-ons are available for several languages, including Java and C++.
  10.     FLTK: Another open source cross platform toolkit, but more lightweight because it restricts itself to the GUI.
  11.     fpGUI: An open source widget toolkit that is completely implemented in Object Pascal. It currently supports Linux, Windows and a bit of Windows CE.
  12.     GeneXus: A Windows rapid software development solution for cross-platform application creation and deployment based on knowledge representation and supporting C#, COBOL, Java including Android and BlackBerry smart devices, Objective-C for Apple mobile devices, RPG, Ruby, Visual Basic, and Visual FoxPro.
  13.     GLBasic: A BASIC dialoect and compiler that generates C++ code. It includes cross compilers for many platforms and supports numerous platform (Windows, Mac, Linux, Android,iOS and some exotic handhelds).
  14.     GTK+: An open source widget toolkit for Unix-like systems with X11 and Microsoft Windows.
  15.     Haxe: An open source cross-platform language.
  16.     Juce: An application framework written in C++, used to write native software on numerous systems (Microsoft Windows, POSIX, macOS), with no change to the code.
  17.     Lazarus: A programming environment for the FreePascal Compiler. It supports the creation of self-standing graphical and console applications and runs on Linux, MacOSX, iOS, Android, WinCE, Windows and WEB.
  18.     Max/MSP: A visual programming language that encapsulates platform-independent code with a platform-specific runtime environment into applications for macOS and Windows.
  19.     MechDome: A cross-platform Android runtime. It allows unmodified Android apps to run natively on iOS and macOS
  20.     MonoCross: An open-source model-view-controller design pattern where the model and controller are shared cross-platform but the view is platform-specific.
  21.     Mono: An open-source cross-platform version of Microsoft .NET (a framework for applications and programming languages)
  22.     MoSync: An open-source SDK for mobile platform app development in the C++ family
  23.     Mozilla application framework: An open source platform for building macOS, Windows and Linux applications
  24.     OpenGL: A cross-platform 3D graphics library.
  25.     PhoneGap: It enables software programmers to build applications for mobile devices using CSS3, HTML5, and JavaScript instead of relying on platform-specific APIs like those in Android, iOS, or Windows Phone.
  26.     PureBasic: A proprietary cross-platform language and IDE for building macOS, Windows and Linux applications
  27.     Qt: An application framework and widget toolkit for Unix-like systems with X11, Microsoft Windows, macOS, and other systems—available under both open source and proprietary licenses.
  28.     Simple and Fast Multimedia Library: A multimedia C++ API that provides low and high level access to graphics, input, audio, etc.
  29.     Simple DirectMedia Layer: An open-source cross-platform multimedia library written in C that creates an abstraction over various platforms’ graphics, sound, and input APIs. It runs on many operating systems including Linux, Windows and macOS and is aimed at games and multimedia applications.
  30.     Smartface: A cross platform native app development tool to create mobile applications for Android and iOS, using WYSIWYG design editor with JavaScript code editor.
  31.     Tcl/Tk
  32.     Ultimate++: A C++ cross-platform rapid application development framework focused on programmers productivity. It includes a set of libraries (GUI, SQL, etc..), and an integrated development environment. It supports Windows and Unix-like OS-s. The U++ competes with popular scripting languages while preserving C/C++ runtime characteristics. It has its own integrated development environment, TheIDE, which features BLITZ-build technology to speedup C++ rebuilds up to 4 times.
  33.     Unity: Another cross-platform SDK which uses Unity Engine.
  34.     Unreal: A cross-platform SDK which uses Unreal Engine.
  35.     V-Play Engine: V-Play is a cross-platform development SDK based on the popular Qt framework. V-Play apps and games are created within Qt Creator.
  36.     WaveMaker: A Cross-platform low-code development tool to create responsive web and hybrid mobile (Android & iOS) applications.
  37.     WinDev: Integrated Development Environment for Windows, Linux, .Net and Java (also with support for Internet and Intranet)
  38.     wxWidgets: An open source widget toolkit that is also an application framework.[14] It runs on Unix-like systems with X11, Microsoft Windows and macOS. It permits applications written to use it to run on all of the systems that it supports, if the application does not use any operating system-specific programming in addition to it.
  39.     Xamrin: With a C#-shared codebase, developers can use Xamarin tools to write native Android, iOS, and Windows apps with native user interfaces and share code across multiple platforms, including Windows and macOS. 
  40.     Xojo: A RAD IDE developed by Xojo, Inc. that uses an object-oriented programming language to create desktop, web and iOS apps. Xojo makes native, compiled desktop apps for macOS, Windows, Linux and Raspberry Pi. It creates compiled web apps that can be run as standalone servers or through CGI. And it recently added the ability to create native iOS apps.

Wednesday, 15 November 2017

HB Blog 148: Custom Floating Keyboard.

My  previous post regarding HB Blog 147: Explore 50+ Keyboard Applications On Google Play tells that there’s a whole world of keyboards out there, and your default Google/Samsung/HTC keyboard is nowhere near the most useful, most productive, or the prettiest. The keyboard you choose will depend on what you’re using it for: Are you looking for a keyboard with more keys and options?
Refer the below link for complete sample code:-

Download Sample Code

Have a look on few code snippets,
//activity_main.xml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    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">

    <EditText
        android:id="@+id/edittext1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="Type here"
        android:inputType="numberDecimal"
        android:selectAllOnFocus="true"
        android:textIsSelectable="true" />

    <com.harshalbenake.floatingkeyboard.views.FloatingKeyboardView
        android:id="@+id/keyboardview"
        android:layout_width="180dp"
        android:layout_height="210dp"
        android:background="@android:color/transparent"
        android:elevation="1dp"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:keyBackground="@drawable/keyback"
        android:keyTextColor="#384850"
        android:shadowRadius="0.0"
        android:visibility="gone" />
</RelativeLayout>

//FloatingKeyboardView.java
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
package com.harshalbenake.floatingkeyboard.views;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.CornerPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.text.Editable;
import android.text.InputType;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.RelativeLayout;

/**
 * A Floating and Draggable KeyboardView. Several EditText's can register for it.
 */
public class FloatingKeyboardView extends KeyboardView {
    private static final int MOVE_THRESHOLD = 0;
    private static final int TOP_PADDING_DP = 28;
    private static final int HANDLE_COLOR = Color.parseColor("#AAD1D6D9");
    private static final int HANDLE_PRESSED_COLOR = Color.parseColor("#D1D6D9");
    private static final float HANDLE_ROUND_RADIOUS = 20.0f;
    private static final CornerPathEffect HANDLE_CORNER_EFFECT = new CornerPathEffect(HANDLE_ROUND_RADIOUS);
    private static int topPaddingPx;
    private static int width;
    private static Path mHandlePath;
    private static Paint mHandlePaint;
    private static boolean allignBottomCenter =false;

    /**
     * Create a custom keyboardview
     * Note that a keyboard with layout from xml file must be set (see {@link Keyboard} for description.
     * Note that the keyboard layout xml file may include key codes for navigation; see the constants in this class for their values.
     * Note that to enable EditText's to use this custom keyboard, call the {@link #registerEditText(int)}.
     */
    public FloatingKeyboardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        topPaddingPx = (int) convertDpToPixel((float) TOP_PADDING_DP, context);
        this.setOnKeyboardActionListener(mOnKeyboardActionListener);
        // Hide the standard keyboard initially
        ((Activity) getContext()).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        this.setOnTouchListener(mKeyboardOntTouchListener);
        this.setPadding(0, (int) convertDpToPixel(TOP_PADDING_DP, context), 0, 0);

        mHandlePaint=new Paint();
        mHandlePaint.setColor(HANDLE_COLOR);
        mHandlePaint.setStyle(Paint.Style.FILL);
        mHandlePaint.setPathEffect(HANDLE_CORNER_EFFECT);

        mHandlePath=new Path();

    }

    public static boolean isAllignBottomCenter() {
        return allignBottomCenter;
    }

    public static void setAllignBottomCenter(boolean allignBottomCenter) {
        FloatingKeyboardView.allignBottomCenter = allignBottomCenter;
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (isAllignBottomCenter()) {
            RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
            relativeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
            relativeLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
            setLayoutParams(relativeLayoutParams);
        }
    }

    @Override
    public void onSizeChanged(int xNew, int yNew, int xOld, int yOld) {
        super.onSizeChanged(xNew, yNew, xOld, yOld);
        width = xNew;
        drawHandle();
    }

    private void drawHandle() {
        mHandlePath.rewind();
        mHandlePath.moveTo(0, topPaddingPx);
        mHandlePath.lineTo(0, topPaddingPx - 25);
        mHandlePath.lineTo(width / 3, topPaddingPx - 25);
        mHandlePath.lineTo(width / 3, 0);
        mHandlePath.lineTo(2 * width / 3, 0);
        mHandlePath.lineTo(2 * width / 3, topPaddingPx - 25);
        mHandlePath.lineTo(width, topPaddingPx - 25);
        mHandlePath.lineTo(width, topPaddingPx);
        // Draw this line twice to fix strange artifact in API21
        mHandlePath.lineTo(width, topPaddingPx);
    }


    @Override
    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = mHandlePaint;
        Path path = mHandlePath;
        canvas.drawPath(path, paint);

    }

    /**
     * Returns whether the FloatingKeyboardView is visible.
     */
    public boolean isVisible() {
        return this.getVisibility() == View.VISIBLE;
    }

    /**
     * Make the FloatingKeyboardView visible, and hide the system keyboard for view v.
     */
    public void show(View v) {

        this.setVisibility(View.VISIBLE);
        this.setEnabled(true);
        // TODO: Correct Position Keyboard
//        ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) getLayoutParams();
//        params.topMargin = v.getTop() + v.getHeight();
//        params.leftMargin = v.getLeft();
//        setLayoutParams(params);

        if (v != null)
            ((InputMethodManager) getContext().getSystemService(Activity.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(v.getWindowToken(), 0);

    }

    /**
     * Make the FloatingKeyboardView invisible.
     */
    public void hide() {
        this.setVisibility(View.GONE);
        this.setEnabled(false);
    }

    /**
     * Register <var>EditText<var> with resource id <var>resid</var> (on the hosting activity) for using this custom keyboard.
     *
     * @param resid The resource id of the EditText that registers to the custom keyboard.
     */
    public void registerEditText(int resid) {
        // Find the EditText 'resid'
        EditText edittext = (EditText) ((Activity) getContext()).findViewById(resid);
        // Make the custom keyboard appear
        edittext.setOnFocusChangeListener(new OnFocusChangeListener() {
            // NOTE By setting the on focus listener, we can show the custom keyboard when the edit box gets focus, but also hide it when the edit box loses focus
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) show(v);
                else hide();
            }
        });

        edittext.setOnClickListener(new OnClickListener() {
            // NOTE By setting the on click listener, we can show the custom keyboard again, by tapping on an edit box that already had focus (but that had the keyboard hidden).
            @Override
            public void onClick(View v) {
                show(v);
            }
        });
        // Disable standard keyboard hard way
        // NOTE There is also an easy way: 'edittext.setInputType(InputType.TYPE_NULL)' (but you will not have a cursor, and no 'edittext.setCursorVisible(true)' doesn't work )
        edittext.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                EditText edittext = (EditText) v;
                int inType = edittext.getInputType();       // Backup the input type
                edittext.setInputType(InputType.TYPE_NULL); // Disable standard keyboard
                edittext.onTouchEvent(event);               // Call native handler
                edittext.setInputType(inType);              // Restore input type
                return true; // Consume touch event
            }
        });

    }

    /**
     * TouchListener to handle the drag of keyboard
     */
    private OnTouchListener mKeyboardOntTouchListener = new OnTouchListener() {
        float dx;
        float dy;
        int moveToY;
        int moveToX;
        int distY;
        int distX;
        Rect inScreenCoordinates;
        boolean handleTouched = false;



        @Override
        public boolean onTouch(View view, MotionEvent event) {
            // Use ViewGroup.MarginLayoutParams so as to work inside any layout
            ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
            boolean performClick = false;

            switch (event.getAction()) {
                case MotionEvent.ACTION_MOVE:
                    if (handleTouched) {
                        moveToY = (int) (event.getRawY() - dy);
                        moveToX = (int) (event.getRawX() - dx);
                        distY = moveToY - params.topMargin;
                        distX = moveToX - params.leftMargin;

                        if (Math.abs(distY) > MOVE_THRESHOLD ||
                                Math.abs(distX) > MOVE_THRESHOLD) {
                            // Ignore any distance before threshold reached
                            moveToY = moveToY - Integer.signum(distY) * Math.min(MOVE_THRESHOLD, Math.abs(distY));
                            moveToX = moveToX - Integer.signum(distX) * Math.min(MOVE_THRESHOLD, Math.abs(distX));

                            inScreenCoordinates = keepInScreen(moveToY, moveToX);
                            view.setY(inScreenCoordinates.top);
                            view.setX(inScreenCoordinates.left);
                        }
                        performClick = false;
                    } else {
                        performClick = true;
                    }
                    break;

                case MotionEvent.ACTION_UP:
                    if (handleTouched) {
                        // reset handle color
                        mHandlePaint.setColor(HANDLE_COLOR);
                        mHandlePaint.setStyle(Paint.Style.FILL);
                        invalidate();

                        performClick = false;
                    } else {
                        performClick = true;
                    }

                    break;

                case MotionEvent.ACTION_DOWN:
                    handleTouched = event.getY() <= getPaddingTop(); // Allow move only wher touch on top padding
                    dy = event.getRawY() - view.getY();
                    dx = event.getRawX() - view.getX();

                    //change handle color on tap
                    if (handleTouched) {
                        mHandlePaint.setColor(HANDLE_PRESSED_COLOR);
                        mHandlePaint.setStyle(Paint.Style.FILL);
                        invalidate();
                        performClick = false;
                    } else {
                        performClick = true;
                    }
                    break;
            }
            return !performClick;
        }


    };

    private void moveTo(int y, int x) {
        ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) getLayoutParams();;
//        Rect inScreenCoordinates = keepInScreen(y, x);
        params.topMargin = y;
        params.leftMargin = x;
        setLayoutParams(params);
    }

    /**
     * Position keyboard to specific point. Caution do not move it outside screen.
     * @param x
     * @param y
     */
    public void positionTo(int x, int y) {
        moveTo (y,x);
    }
    /**
     * @param topMargin of desired position
     * @param leftMargin of desired position
     * @return a Rect with corrected positions so the whole view to stay in screen
     */
    private Rect keepInScreen(int topMargin, int leftMargin) {
        int top = topMargin;
        int left = leftMargin;
        measure(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
        int height = getMeasuredHeight();
        int width = getMeasuredWidth();
        //TODO: Try to explain this !!!
        int rightCorrection = ((View) getParent()).getPaddingRight() ;
        int botomCorrection =((View) getParent()).getPaddingBottom() ;
        int leftCorrection = ((View) getParent()).getPaddingLeft();
        int topCorrection =((View) getParent()).getPaddingTop();

        Rect rootBounds = new Rect();
        ((View) getParent()).getHitRect(rootBounds);
        rootBounds.set(rootBounds.left+leftCorrection,rootBounds.top+topCorrection,rootBounds.right-rightCorrection,rootBounds.bottom-botomCorrection);

        if (top <= rootBounds.top)
            top = rootBounds.top;
        else if (top + height > rootBounds.bottom)
            top = rootBounds.bottom - height;

        if (left <= rootBounds.left)
            left = rootBounds.left;
        else if (left + width > rootBounds.right)
            left = rootBounds.right - width;

//            Log.e("x0:"+rootBounds.left+" y0:"+rootBounds.top+" Sx:"+rootBounds.right+" Sy:"+rootBounds.bottom, "INPUT:left:"+leftMargin+" top:"+topMargin+
//                    " OUTPUT:left:"+left+" top:"+top+" right:"+(left + getWidth())+" bottom:"+(top + getHeight()));
        return new Rect(left, top, left + width, top + height);
//        return new Rect(leftMargin, topMargin, leftMargin + width, topMargin + height);
    }

    /**
     * This method converts dp unit to equivalent pixels, depending on device density.
     *
     * @param dp      A value in dp (density independent pixels) unit. Which we need to convert into pixels
     * @param context Context to get resources and device specific display metrics
     * @return A float value to represent px equivalent to dp depending on device density
     */
    private static float convertDpToPixel(float dp, Context context) {
        Resources resources = context.getResources();
        DisplayMetrics metrics = resources.getDisplayMetrics();
        float px = dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
        return px;
    }

    /**
     * The key (code) handler.
     */
    private OnKeyboardActionListener mOnKeyboardActionListener = new OnKeyboardActionListener() {
        public final static int CodeGrab = -10; //
        public final static int CodeDelete = -5; // Keyboard.KEYCODE_DELETE
        public final static int CodeCancel = -3; // Keyboard.KEYCODE_CANCEL
        public final static int CodePrev = 55000;
        public final static int CodeAllLeft = 55001;
        public final static int CodeLeft = 55002;
        public final static int CodeRight = 55003;
        public final static int CodeAllRight = 55004;
        public final static int CodeNext = 55005;
        public final static int CodeClear = 55006;

        public final static int CodeCellUp = 1001;
        public final static int CodeCellDown = 1002;
        public final static int CodeCellLeft = 1003;
        public final static int CodeCellRight = 1004;
        public final static int CodeDecimalpoint = 46;
        public final static int CodeZero = 48;

        @Override
        public void onKey(int primaryCode, int[] keyCodes) {
            // NOTE We can say '<Key android:codes="49,50" ... >' in the xml file; all codes come in keyCodes, the first in this list in primaryCode
            // Get the EditText or extension of EditText and its Editable
            View focusCurrent = ((Activity) getContext()).getWindow().getCurrentFocus();
            if (focusCurrent == null || (focusCurrent.getClass() != EditText.class
                    && focusCurrent.getClass().getSuperclass()!= EditText.class) ) return;
            EditText edittext = (EditText) focusCurrent;
            Editable editable = edittext.getText();
            int start = edittext.getSelectionStart();
            int end = edittext.getSelectionEnd();
            // Apply the key to the edittext
            if (primaryCode == CodeCancel) {
                hide();
            } else if (primaryCode == CodeDelete) {
                if (editable != null && start > 0) {
                    editable.delete(start - 1, start);
                } else if (editable != null && start != end) { // delete selection
                    editable.delete(start, end);
                }
            } else if (primaryCode == CodeClear) {
                if (editable != null) editable.clear();
            } else if (primaryCode == CodeLeft) {
                if (start > 0) edittext.setSelection(start - 1);
            } else if (primaryCode == CodeRight) {
                if (start < edittext.length()) edittext.setSelection(start + 1);
            } else if (primaryCode == CodeAllLeft) {
                edittext.setSelection(0);
            } else if (primaryCode == CodeAllRight) {
                edittext.setSelection(edittext.length());
            } else if (primaryCode == CodePrev) {
                View focusNew = edittext.focusSearch(View.FOCUS_BACKWARD);
                if (focusNew != null) focusNew.requestFocus();
            } else if (primaryCode == CodeNext) {
                View focusNew = edittext.focusSearch(View.FOCUS_FORWARD);
                if (focusNew != null) focusNew.requestFocus();
                else if (primaryCode == CodeCellUp || primaryCode == CodeCellDown || primaryCode == CodeCellLeft || primaryCode == CodeCellRight) {
                    // TODO
                } else if (primaryCode == CodeGrab) {

                }
            } else { // insert character
                ///////////////////////////////////////////////////////////////////////
                ////////////////////////////////////////////////////////////////////
                /////////////////////////////
                if (start != end) {
                    editable.delete(start, end);
                }
                editable.insert(start, Character.toString((char) primaryCode));
            }
        }

        @Override
        public void onPress(int arg0) {
        }

        @Override
        public void onRelease(int primaryCode) {
        }

        @Override
        public void onText(CharSequence text) {
        }

        @Override
        public void swipeDown() {
        }

        @Override
        public void swipeLeft() {
        }

        @Override
        public void swipeRight() {
        }

        @Override
        public void swipeUp() {
        }
    };
}

//MainActivity.java
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.harshalbenake.floatingkeyboard;

import android.app.Activity;
import android.inputmethodservice.Keyboard;
import android.os.Bundle;

import com.harshalbenake.floatingkeyboard.views.FloatingKeyboardView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        FloatingKeyboardView mCustomKeyboard = (FloatingKeyboardView) findViewById(R.id.keyboardview);
        mCustomKeyboard.setKeyboard(new Keyboard(this, R.xml.numkbd));
        mCustomKeyboard.setPreviewEnabled(false); // NOTE Do not show the preview balloons
        mCustomKeyboard.registerEditText(R.id.edittext1);
        mCustomKeyboard.setAllignBottomCenter(true);

    }
}