Showing posts with label ANDROID. Show all posts
Showing posts with label ANDROID. Show all posts

Sunday 2 April 2017

Solve Couldn't resolve resource @string/your_text warning

1 comment :

resolve-Couldn't-resolve-resource-@string/your_text


Many of the beginners will find this error  Couldn't resolve resource @string/your_text , while you are trying to change the text hello_world in the activity_main.xml in the following line like this:




The actual coding will be like the above image but the beginner will try to change the hello_world like this:


The text may be anything , here i am using Welcome.

the error will come like this :


Why this is error is coming means , the @string/ resembles the string.xml under the values folder under the res folder  which i have discussed in the previous post.

Read here:

Project Structures in Android Eclipse

In order to add a new text we need to add the text in that string.xml folder.

Follow the following steps :

1.Open  res ----> values ----> string.xml 





In this add a new line as follows:

 <string name="welcome">Welcome</string>


Now save both string.xml and activty_main.xml and now see the error will be gone.


Thus the error   Couldn't resolve resource @string/your_text was successfully cleared.

read here:

Hello World app in Android
Read More

Android Project Structure in Eclipse

1 comment :


The Project Structure in Android ADT or Eclipse and also in Android Studio is very important to understand.

We need to be aware what are the all available project files when we create an application.

The Project Structure can be seen on the left side of the Eclipse or Android Studio window.




The Project Structure contains all the java packages, classes, xml files, icons, images which we use in an Android app.

This is the Complete Project Structure.


The Src folder is called as the Source folder. 

This folder contains all the Java Packages and Java Classes that we are creating and using.


The gen folder is called as Generated java files folder.

This Folder contains automatically created java files which contains

1.BuildConfig.java file and
2. R.java files.

In which the R.java file contains the automatically generated java class which contains the automatically generated integer values for every thing you are using in a project.

If you see the image you can see an integer value is generated for @string/hello_world which we have used in the xml file.


we should not modify anything in this R.java class , if you do anything changes in this class it will leads to error.

The next folder is the Android sdk or platform folder which contains android.jar file, we are not going to use this one and the next folder is Android Private Libraries which contains the necessary libraries.

The assets folder consists of static files , we are not going to use this folder also.

The bin folder consists of Compiled classes and executable files.

The next and the most important , which we are going to use in every android application development is the res folder.

The res folder is called as the resource folder.

It contains the Layout folder which will contain the xml file, which will be used to design the User Interface.

Under the res folder there are two main folders need to be known

1.Layout folder and
2. Values folder

the Values folder contains

1. dimens.xml
2. strings.xml
3.styles.xml

the dimens.xml file is used to specify dimensions(size) which can be used through out the developing the application.

the strings.xml file is used to specify every text that we are going to use in our application.

the styles.xml file is used to define some styles which can be used in designing the User Interface.

we will learn about these folders in more detail in the upcoming posts.

See the following image of res folder.

  
The last and the most important file is AndroidManifest.xml file. This file is used to set which activity to be run while the application starts , means that while you are creating an application you will use more than one activity.

An activity is said to be combination of  JAVA class+ XML file, so which activity we should run first we can specify using intent-filter in the AndroidManifest file.


we will learn about the intent-filter later, if you see in this Android Manifest we can give permissions like, if we want access our phone camera , then we need to add camera permissions, like that.

This AndroidManifest.xml file is also used to generate the apk files which we will be going to upload in Google Play Store.

These are the folders in a Project , and we saw what are its usages.

In upcoming post I will post more about these folders.

Read here:

Java Concepts required to develop Android Apps
Read More

Java Concepts required for developing Android apps

No comments :

In the previous posts, we have learned the software setup and emulator creations, which are very mandatory for the Android app development.

In this post i am going to tell about what are the java concepts required to develop android apps.

Yes, the android apps are created using java programming , so we need to learn the some Java Concepts to create Android apps.

The Android app development is done using two things.

1.Java code to implement the app functionality

2. XML code to design the User Interface( UI ).

In java there are lots of concepts but we do not need all the concepts to develop simple android apps.

Following concepts are enough to develop an android app:

A simple Info-graphic:



1. Basic programming Concepts.      ( this is just fundamentals)

2.Data Types 

3.Operators

4.Control Statements(this concept is very important)

 5.OOPS (Object Oriented Programming)

 6. String Handling

 7.Array List 

 8.Basics of Multi threading       (For advanced apps)

9.Basics of Exception Handling (For advanced apps)



If you want to learn java no need of any programming experience before. Just by reading some below post you can easily learn Java.

First you need to be familiar with programming for that purpose read some simple C programming...

1. How to run a C program
2.  How to add 2 numbers in C
3. Decision Control Statements
4. Loop Control Statements

If you are already familiar with this concept just, skip to start learning java.

After becoming familiar with this fundamentals let start to learn about java.

1. How to Run a Java Program
2.How to add 2 numbers in java
3.How to get input from the user
4. Classes and Objects in Java 

If you already know the above concepts just start learning the required concepts.

Practice the above concepts till you become familiar with that.

After that start to learn the Required Java Concepts for developing android applications.

There is a perfect blog to learn all Java concepts that is www.javatpoint.com .

This blog will provide A-Z knowledge in java.

You can learn what you want , try to first complete the above mentioned required java concepts required to develop android apps , then if you want you can learn more.


Read here:

How to develop Android apps






Read More

Saturday 1 April 2017

How to use Android Phone as an Emulator

No comments :
usb-debugging


In the previous post i have told you how to create an Emulator in Android Eclipse, but it is slow compared to USB Debugging.

What is USB Debugging?

Using our smartphones as an Emulator also called as Debugger is called as USB debugging .

It is very simple to use your phone as an Android Emulator.

I have created an Info graphics for the easy understanding.





usb-debugging-infographics
 usb-debugging-infographics
 usb-debugging-infographics

1.Go to settings in your phone

settings

Tap on About Phone option more than 5 to 10 times till a message will come like

YOU ARE AN DEVELOPER NOW!

After this you can see the Developer options above the About phone.

developer-options

Now open the Developer options and Enable it and also enable the USB Debugging option as shown in the image.

usb-debugging

2. Connect your phone to the laptop Using USB.

connect-usb

Then the phone will ask for Trust this Computer are not click yes.

Then after complete the coding go to Run configuration as shown in the image.

run-configurations-in-eclipse

Then click Target tab and enable Always Prompt to pick device  and then click Apply then click Run.

always-prompt-to-pick-device


Then select your phone and click OK.

running-android-device

Then within some seconds or minutes the output will be displayed in your phone.

phone-as-android-emulator

You have successfully used your phone as Emulator.

NOTE: If your Phone is not visible in the Eclipse then try the following options.

1. Reconnect the phone 
2. Download your Phone's Sync Manager.(For Example : My phone is HTC so I have downloaded    HTC SYNC Manager) . 

 Install it and then follow the above procedures from beginning.

It will work definitely.

Now try this:

Hello World app


If you find any difficulty in making your phone as an Emulator mail me your trouble or error i will mail you the solution. narain2829@gmail.com .

Also read:

How to create an Emulator .



Read More

Friday 31 March 2017

How to Create an Emulator in Android Eclipse

No comments :




In the previous post we saw how to create an sample Android app.

 Now we will see how to create an Emulator.

An Emulator is the software which will resemble our Android phone's features in order to run the applications we have created in Android Eclipse or Android Development Tool(ADT).

In Android Studio also we use the Emulator to Run the applications we have created.

Let us see how to create an Emulator also called as Android Virtual Device(AVD).

I have created an Info graphics for the easy understanding.

info-graphics

1. Open Android SDK Manager

 
android-sdk-manager



2. Install the required SDK platform and System Image.

    
sdk-manager

system-image



3. Open Android Virtual Device Manager.


avd-manager




4. Create New AVD

new-avd



5. Enter the AVD name , Target version and device then click OK

create-avd

avd-created


Then after clicking OK, You can start the created AVD or you can select the AVD at the time of running the application, but it is recommended to start before running the application, because the AVD takes more time to open.

So if you start the AVD before starting coding at the time of execution it will be opened so you can get the output fastly.

launch-avd

Then Launch the AVD...

AVD-loasding


It will take some time to load , so minimize it and start coding...

After the AVD or Emulator is opened it will look like..

Emulator

If the above step is followed to create an Emulator mostly the error wont come. If the Emulator is not working properly then close the emulator and re launch it.

We have successfully created the emulator , if you find any difficulties in creating the Emulator mail me to narain2829@gmail.com i will reply you the solution to your queries within a day...

But it is recommended to use our Android Mobile Phone as Emulator since it is faster than the AVD or Emulator.

In next post i will tell how to use our mobile as an Emulator.

Read Here: 

How to use Android Phone as an Emulator



Read More

HelloWorld app in Android

No comments :
hello-world-app

For beginners it is recommended to use ANDROID DEVELOPMENT TOOL (ADT) eclipse .

After some core concepts, i will use Android Studio.

Read How to develop Android Apps and download the tools required to Create the android apps.

 Open Eclipse by double clicking the eclipse icon found in the folder where you have downloaded the ADT bundle. In my laptop i have saved it in the following path

D:\Development\ADT\adt-bundle-windows-x86_64-20140702\eclipse.

Double click the eclipse icon.

eclipse

After that it will load.

ADT

This is what you will see after ADT is opened.

Welcome-ADT

1. File-----> New-----> Android Application Project

new-application


Enter the Project name , where you want to store , minimum version to run your application etc...

new-android-application


as follows...

project name

Then click Next, Next , Next until Finish comes.

workspace

In the above screen you can choose the folder where you can store the project works and click NEXT.

icon

In the above window you can choose your own icon which will be displayed as your app icon when you installed in your mobile, we will discuss it on upcoming post.

create-activity

Click blank activity and NEXT.

activity-name

Then click Finish.

I will explain about what is Activity name later.

Then the Work space will be opened.

project-workspace

Then right click on the Project name and click Run As----> Android application.

new-project


choose-emulator

You need to select an emulator, I will tell how to create an Emulator, how to use our Android phone as an Emulator in my next post.

Just now we see how the output is coming.

output-in-emulator

Output in Mobile.

output-in-mobile

It is recommended for the beginners as well as developers to use Mobile as an Emulator which is 10 times faster than the Emulator.

In next post i will tell you how to create an Emulator and how to use our phone as Emulator.


Read Here:

How to Create an Emulator in Android Eclipse


Read More