G. V. Raman(a)Droid
Tuesday, April 9, 2013
G. V. Raman(a)Droid: Can't find Android SDK Manager and AVD Manager..
G. V. Raman(a)Droid: Can't find Android SDK Manager and AVD Manager..: If you are unable to find Android SDK Manager and AVD Manager follow the below steps: In eclipse go to Windows --> Custom Perspec...
| Reactions: |
Can't find Android SDK Manager and AVD Manager..
If you are unable to find Android SDK Manager and AVD Manager follow the below steps:
- In eclipse go to Windows --> Custom Perspective
- After selecting Custom Perspective from windows tab it will open a new window. In that window go to Command Groups Availability tab and check Android SDK and AVD Manager option.
- Click on OK button. Now you can see Andriod SDK Manager and AVD manager in your eclipse.
Labels:
Android,
AVD,
AVD Manager,
Eclipse,
SDK,
SDK Manager
| Reactions: |
Sunday, March 31, 2013
Installing external APK files on Android Emulator
To install an external APK on Android Virtual Deice (AVD) or on Emulator go through the following step-by-step procedure.
step 1-
Launch the emulator
step 2-
Paste your APK file whichever you want to install on emulator in android-sdk-windows\platform-tools directory.
step 3-
open cmd prompt and move to platform-tools folder of Android SDK directory.
step 4-
Run the following command:
If the emulator is already has that application it will give a failure notification to the user - [ INSTALL_FAILED_ALREADY_EXISTS ].
After successful installation it will give a " SUCCESS" message to the user.
Please, find the procedure in the following screenshot.
step 1-
Launch the emulator
step 2-
Paste your APK file whichever you want to install on emulator in android-sdk-windows\platform-tools directory.
step 3-
open cmd prompt and move to platform-tools folder of Android SDK directory.
step 4-
Run the following command:
- adb install "xxx.apk"
- Example: abd install "Indianlaws.apk"
If the emulator is already has that application it will give a failure notification to the user - [ INSTALL_FAILED_ALREADY_EXISTS ].
After successful installation it will give a " SUCCESS" message to the user.
Please, find the procedure in the following screenshot.
Labels:
adb,
Android,
apk,
AVD,
Emulator,
Install,
Installation,
Platform-tools,
SDK
| Reactions: |
Sunday, April 8, 2012
Linear Layout Example in Android
This tutorial is about to designing a Linear Layout. Linear Layout is a very basic and the default layout of providing the UI in Android.
Linear Layout is a View Group which supply its child Views, either HORIZONTAL or VERTICAL, depends upon the orientation property we set.
Linear Layout is a View Group which supply its child Views, either HORIZONTAL or VERTICAL, depends upon the orientation property we set.
- Create a project against your specified Build Target. (Android SDK level).
- Hence, the layout file linear.xml would be like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
To configure a layout, we have main areas control besides the container's content:
- Orientation:
- Orientation indicates whether the LinearLayout represents a row or a column.
- Just add the android:orientation property to LinearLayout element in XML layout, set the value to be horizontal for a row or vertical for a column.
- The orientation can be modified at runtime by invoking setOrientation().
- Fill Model:
- Since, we have so many devices available in the market with various screen sizes, to match the size of the child views with various screen sizes we use Fill Model in android.
- All widgets inside a LinearLayout must supply android:layout_width and android:layout_height properties.
- These properties values have 3 flavors:
- We can provide a specific dimension, such as 200dp to indicate the widget should take up exactly 200dp (dp/dip - Density Independent Pixels).
- We can provide wrap_content, which means the widget should fill up its natural space, unless that is too big, in which case Android can use word-wrap as needed to make it fit.
- We can provide fill_parent, which means the widget should fill up all available space in its enclosing container, after all other widgets are taken care of(means the widgets added after this will not be visible).
Here, in this example I am setting the orientation as vertical. Later, added some widgets (TextViews, EditText, and a Button) to LinearLayout.
After editing the xml file would be like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello.! Everyone"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Welcome to Android.."
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="this is an example for Linear layout with vertical orientation"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Please enter your name:"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Save"
/>
</LinearLayout>
Now lets, move on to activities coding. In this example we are not doing anything on activity file.
Hence, the activity file would be like this:
public class LinearLayoutActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
After running the application output would be like this:
Labels:
Activity,
Android,
Fill Model,
Horizontal,
Linear Layout,
Orientation,
Vertical,
View group,
Views,
Widgets
| Reactions: |
Friday, March 30, 2012
Getting Real time traffic data on Google Maps
Its very nice to hear that Google is providing the real time traffic data again almost after a year.Now on we can get the traffic details in all the areas, like where the traffic is more and where it is less. And as well as it is going to guide the nearest way to your destination.
Data is gathered through third-party services and through information from Android users who have opted in to the My Location feature on Google Maps.
For detail information Click Here..
Data is gathered through third-party services and through information from Android users who have opted in to the My Location feature on Google Maps.
For detail information Click Here..
Labels:
Android,
Current Traffic,
Directions,
Google,
Google Maps,
My Location,
Traffic data
| Reactions: |
Thursday, February 23, 2012
Android User Interface, Common Layout Objects
The more common types of layout objects to use in android applications are as follows:
- Frame Layout.
- Linear Layout.
- Table Layout.
- Relative Layout.
Frame Layout:
- Frame Layout is a blank space on the screen that we can later fill with a single object.
- All child elements of the Frame Layout are pinned to the top left corner of the screen, cannot specify a location for a child views.
- Later child views will simply be drawn over earlier ones.
Linear Layout:
- Linear Layout aligns all children in a single direction — vertically or horizontally, depending on how you define the orientation attribute.
- All children are stacked one after the other, so a vertical list will only have one child per row, no matter how wide they are, and a horizontal list will only be one row high (the height of the tallest child, plus padding).
Table Layout:
- Table Layout positions its children into rows and columns.
- TableLayout containers do not display border lines for their rows, columns, or cells. The table will have as many columns as the row with the most cells.
- A table can leave cells empty, but cells cannot span columns, as they can in HTML.
Relative Layout:
- Relative Layout lets child views specify their position relative to the parent view or to each other (specified by ID). So you can align two elements by right border, or make one below another, centered in the screen, centered left, and so on.
- Gallery
- GridView
- ListView
- ScrollView
- Spinner
Labels:
Gallery View,
Grid View,
layout objects,
List View,
Spinner View,
user interface,
View group
| Reactions: |
Wednesday, February 8, 2012
Passing values from one Activity to other using Bundle
- In general Bundle is a bunch of things putting together.
- Here, in following example I am going to send the data from one activity(SenderActivity) to other activity (ReceiverActivity) through bundle.
- To start a new activity from existing activity we use Intents (description of an operation to be performed) in Android.
- In this example , on button click event I am sending bundle of an employee information from SenderActivity to ReceiverActivity( to display the data sent by SenderActivity).
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/button"
android:text="send bundle data"
/>
Step-2: Add a listener for the button in SenderActivity.
Button button=(Button)findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
- Bundle of information will be send between activities through Intent objects.So, now we need to create an Intent object.
Step-3: Create an Intent object.
While creating an Intent object specify ReceiverActivity as the target passing it to the Intent's constructor.
Intent intent=new Intent(SenderActivity.this,ReceiverActivity.class);
Intent intent=new Intent(SenderActivity.this,ReceiverActivity.class);
Step-4: Create ReceiverActivity in the package.
public class ReceiverActivity extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.two);
}
}
Step-5: Design two.xml layout for ReceiverActivity to display the bundled information.
- two.xml contains only TextView's to display the employee details.
<TextView
android:id="@+id/showName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="@+id/showOrg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="@+id/showAddr"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
Step-6: Add newly created activity to AndroidManifest.xml
<activity
android:name=". ReceiverActivity " >
</activity>
Step-7:
- Create a bundle object inside the intent and send data to the bundle using putExtras(). And now pass the bundle object to intent.
Bundle b=new Bundle();
b.putString("Name", "GVR");
b.putString("Organisation", "Kclink");
b.putString("Address", "Hyderabad");
intent.putExtras(b);
Step-8:
- To launch an activity call startActivity() method and pass intent object to it. Then the intent will generate to start ReceiverActivity .
Step-9:
- Now call getIntent.getExtras () from ReceiverActivity , which will return all extras previously added through putExtras() of the intent that started this activity.
Bundle bundle=getIntent().getExtras();
String name=bundle.getString("Name");
String org=bundle.getString("Organisation");
String addr=bundle.getString("Address");
- Finally, set these values to the TextView's to display.
tv1.setText(name);
tv2.setText(org);
tv3.setText(addr);
Labels:
Activity,
Android,
AndroidManifest,
Bundle,
Intent,
Intent Object
| Reactions: |
Subscribe to:
Posts (Atom)

