‏إظهار الرسائل ذات التسميات Android Studio.how to. إظهار كافة الرسائل
‏إظهار الرسائل ذات التسميات Android Studio.how to. إظهار كافة الرسائل

الأربعاء، 30 سبتمبر 2015

Android Studio AVD Manager now support Nexus 6P/5X profile

Android Studio AVD Manager now support Nexus 6P/5X profile, you can create AVD (Android Virtual Device) running Android 6, Marshmallow, API 23.






Create AVD of Nexus 6P running Android 6 Marshmallow

الاثنين، 21 سبتمبر 2015

Generate SHA1 fingerprint of release keystore using keytool


To generate signed APK in Android Studio:
> Build > Generate Signed APK...

Once APK and keystore generated, you can get its SHA1 fingerprint using keytool:
keytool -exportcert -alias MyButton -keystore D:\tmp\testKeyStore\MyButton.keystore.jks -list -v
where:
MyButton is the alias.
D:\tmp\testKeyStore\MyButton.keystore.jks is the generated keystore.


related:
Locate debug.keystore and get the SHA1 fingerprint using Keytool utility

Locate debug.keystore and get the SHA1 fingerprint using Keytool utility

keytool without password by pressing [ENTER]

keytool with default password "android"
The default location of debug.keystore is in ~/.android/ on OS X and Linux, in C:\Documents and Settings\<user>\.android\ on Windows XP, and in C:\Users\<user>\.android\ on Windows Vista and Windows 7...Windows 10.

To get get the SHA1 fingerprint for debug using Keytool utility, enter the command in DOS Prompt or Terminal:
keytool -exportcert -alias androiddebugkey -keystore C:\Users\user\.android\debug.keystore -list -v
or
keytool -keystore C:\Users\user\.android\debug.keystore -list -v

You will be asked to enter password, enter default password "android" or simple ignore by pressing [ENTER].


related:
Generate SHA1 fingerprint of release keystore using keytool

السبت، 19 سبتمبر 2015

Customize color for your app, for Material Theme, using Android Studio


The new material theme provides:

  • System widgets that let you set their color palette
  • Touch feedback animations for the system widgets
  • Activity transition animations

You can customize the look of the material theme according to your brand identity with a color palette you control. You can tint the action bar and the status bar using theme attributes, as shown in Here.


reference: https://developer.android.com/training/material/theme.html

This video show how to do it in Android Studio.


Create values/colors.xml to define our custom color.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#FFFF00</color>
<color name="primary_dark">#502020</color>
<color name="text_primary">#FF00ff00</color>
<color name="text_secondary">#FFff0000</color>
<color name="window_background">#000000</color>
<color name="nav_color">#505050</color>
</resources>


Edit values-v21/styles.xml to use our custom color.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:textColor">@color/text_secondary</item>
<item name="android:windowBackground">@color/window_background</item>
<item name="android:navigationBarColor">@color/nav_color</item>
</style>
</resources>


reference: Customize the Color Palette

الجمعة، 18 سبتمبر 2015

Open libs folder in Android Studio

Normally Android Studio will open Android on the upper left selection, you cannot find libs folder here. To find libs folder, click to switch to Project, you can locate it in >app>libs.


الثلاثاء، 15 سبتمبر 2015

الاثنين، 14 سبتمبر 2015

Generate device artwork using Device Art Generator


The Device Art Generator enables you to quickly wrap app screenshots in device artwork. This provides better visual context for your app screenshots on your website or in other promotional materials.

Visit Device Art Generator:
Drag a screenshot from your desktop onto a device to generate device art.

السبت، 12 سبتمبر 2015

Create custom color button, in Android Studio


To create custom buton, create a XML file under drawable folder.


drawable/colorbutton.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<gradient
android:angle="90"
android:endColor="#000050"
android:startColor="#0000E0" />
<stroke
android:width="3dp"
android:color="#303030" />
<corners
android:radius="10dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
</item>

<item android:state_focused="true">
<shape>
<gradient
android:angle="270"
android:endColor="#500000"
android:startColor="#E00000" />
<stroke
android:width="3dp"
android:color="#303030" />
<corners
android:radius="10dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
</item>

<item>
<shape>
<gradient
android:angle="270"
android:endColor="#005050"
android:startColor="#00E0E0" />
<stroke
android:width="3dp"
android:color="#303030" />
<corners
android:radius="10dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
</item>
</selector>

Use it in layout file, layout/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Color Button"
android:background="@drawable/colorbutton"
android:textColor="@android:color/white"/>

</LinearLayout>



How to do it in Android Studio:




Related:
- Android pre-defined Button style - buttonStyle, borderlessButtonStyle, buttonStyleToggle and buttonStyleInset

الخميس، 10 سبتمبر 2015

Install Bluestacks App Player on Windows 10, and test your app

BlueStacks App Player lets you run mobile apps fast and fullscreen on Windows and Mac. With BlueStacks running, Android Studio (or ADB) recognize it as a Android Emulator, and you can install and test yout app on it.


Install Bluestacks App Player on Windows 10


This video show how to run the example in "Intent.ACTION_OPEN_DOCUMENT to load images in RecyclerView + CardView" on Bluestacks App Player.




Related:
- Run Visual Studio 2015 solution of Xamarin-Android App on BlueStacks App Player

الثلاثاء، 1 سبتمبر 2015

ADB (Android Debug Bridge) connect Android device via WiFi in Windows 10

You can connect ADB with Android devices via WiFi to develop apps.



You can find the adb tool in <sdk>/platform-tools/
in my case, it is in
C:\Users\user\AppData\Local\Android\sdk\platform-tools

To connect to Android devices, enter the command:
>adb connect 192.168.1.107
where 192.168.1.107 is the IP address of Android devices.

Most probably, cannot connect. Connect Android devices to PC with USB cable, wait it to be connected.

Enter the command to reset tcpip:
>adb tcpip 5555

Then connect again:
>adb connect 192.168.1.107

After connected, you can disconnect USB cable.

الاثنين، 31 أغسطس 2015

Move Android Emulator using keyboard, in Windows 10

My Android Emulator on Windows 10 always open with title bar hidden, cannot be moved using mouse.


To move it with keyboard shortcuts:
- Click to select Android Emulator window
- Press Alt + SPACE
- press m
- Up/Down/Left/Right to move the window.


Hello World and create AVD for Android Wear

This video show how to create AVD for Android Wear, create Hello World and run on Android Wear Emulator.

Install Intel x86 Emulator Accelerator (HAXM), on Android Studio/Windows 10

After Install Android Studio on Windows 10, you can install Intel x86 Emulator Accelerator (HAXM).


Refer to Android Developers document "Using the Emulator - Configuring Virtual Machine Acceleration":

Many modern CPUs provide extensions for running virtual machines (VMs) more efficiently. Taking advantage of these extensions with the Android emulator requires some additional configuration of your development system, but can significantly improve the execution speed. Before attempting to use this type of acceleration, you should first determine if your development system’s CPU supports one of the following virtualization extensions technologies:
  • Intel Virtualization Technology (VT, VT-x, vmx) extensions
  • AMD Virtualization (AMD-V, SVM) extensions (only supported for Linux)
The specifications from the manufacturer of your CPU should indicate if it supports virtualization extensions. If your CPU does not support one of these virtualization technologies, then you cannot use virtual machine acceleration.

If your system with Intel's CPU, you can check if the Virtualization Technology is Enabled using Intel® Processor Identification Utility.

To install Intel x86 Emulator Accelerator (HAXM Installer) and run it, read this video.


Most probably, you will encounter the following error and the Android Emulator cannot run!

HAXM is not working and emulator runs in emulation mode
emulator: The memory needed by this AVD exceeds the max specified in your HAXM configuration.
emulator: AVD      RAM size = 1536 MB
emulator: HAXM max RAM size = 512 MB
emulator: You might want to adjust your AVD RAM size and/or HAXM configuration to run in fast virt mode.

Because The HAXM installer suggested a 512MB/1GB RAM by default, and the default AVD created by Android Studio Setup require 1536 MB. To fix it, edit your AVD to require 1GB of RAM.



Or, you can/have to re-install HAXM to increase HAXM max RAM size.


Install Android Studio on Windows 10

Android Studio IDE is the official Android development IDE.


Before install, check if your system meet the System Requirements.

In my system:
OS: Windows 10
Java: JDK 8 (Refer the Java-Buddy post "Install JDK 8 on Windows 10, and set Path")

To download Android Studio IDE, visit http://developer.android.com/sdk/index.html.

By default, the Setup Wizard will create a default AVD (Android Virtual Device) for you, Nexus 5 API 23 x86. (If you encounter error of "HAXM is not working and emulator runs in emulation mode" when run Android Emulator with HAXM, refer to the next post "Install Intel x86 Emulator Accelerator (HAXM), on Android Studio/Windows 10")



After installed, I always run SDK Manager to check if any update and install the suggested packages.


Next:
Install Intel x86 Emulator Accelerator (HAXM)



Create Marshmallow Emulator in Android Studio AVD Manager




Related:
- Download and run Android Studio 2.0 Preview on Windows 10

الجمعة، 14 أغسطس 2015

Add dependency for Google Play services in Android Studio Project

Before add dependency for Google Play services, make sure you have Google Play services install in Android SDK.


To add Google Play services to Android Studio Project, follow the steps here shown in the video:
- In Android Studio > File > Project Structure
- Select App -> Dependencies
- Select play-services, 'com.google.android.gms:play-services:7.8.0' currently.
- Click on the '+' symbol to add the libraries
- OK


You can also edit build.gradle manually to add dependencies of compile 'com.google.android.gms:play-services:7.8.0'


الجمعة، 7 أغسطس 2015

الثلاثاء، 28 يوليو 2015

Open more than one project in Android Studio

Open more than one project in Android Studio:
- With one project opened
- Select menu File -> Reopen Project -> select the project to open
- Select New Window to open project.