Sms Gratis Indosat

Phone Numbers
0 -
Example : 83832867987 Without 0

Type your Messages

Question: + =

Programmatically create layout and view, with ID assigned by setId().

This example demonstrate how to create layout and view at run time using Java code, instead of XML code. We can assign IDs for the layouts/views by calling setId() mdthod.

Programmatically create layout and view, with ID assigned by setId().

In order to call setId() with named id, create /res/values/ids.xml to define out ID resources.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="layout_id"/>
<item type="id" name="image_id" />
</resources>


Main code.
package com.exercise.AndroidSetId;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

public class AndroidSetIdActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LinearLayout layout = new LinearLayout(AndroidSetIdActivity.this);
layout.setId(R.id.layout_id);
LayoutParams layoutParams
= new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layout.setLayoutParams(layoutParams);
layout.setOrientation(LinearLayout.VERTICAL);

ImageView imageView = new ImageView(AndroidSetIdActivity.this);
imageView.setId(R.id.image_id);
imageView.setImageResource(R.drawable.ic_launcher);
LayoutParams imageViewLayoutParams
= new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
imageView.setLayoutParams(imageViewLayoutParams);

layout.addView(imageView);

setContentView(layout);

layout.setOnClickListener(viewOnClickListener);
imageView.setOnClickListener(viewOnClickListener);
}

OnClickListener viewOnClickListener
= new OnClickListener(){

@Override
public void onClick(View v) {

int myId = v.getId();

Toast.makeText(AndroidSetIdActivity.this,
"ID: " + String.valueOf(myId) + " clicked",
Toast.LENGTH_LONG).show();
}};
}



Schedule of Android Sessions in Google IO 2012

Be among the first to see the latest demos and developments from Android. Watch the keynote and over 40 sessions live streamed from Google I/O! It all begins June 27, at 9am.

Check the Android sessions schedule.


Nash Rambler Airflyte Custom

No technical specification available

(click images for a larger view)





Improve Android Emulator performance with Intel Atom x86 System Image

Back to the releasing of Android SDK r17, Intel Atom x86 System Image was included. AVD with Intel Atom x86 System Image can  access the host CPU natively and offer significantly faster execution.

Android emulator with Intel Atom x86 System Image


To install Intel Atom x86 System Image, click Window from Eclipse menu, select Android SDK Manager. Check to install package of Intel Atom x86 System Image, it's available on Android 4.0.3(API 15) and 2.3.3(API 10) currently.



Create emulator using Intel Atom x86 System Image

- Window -> AVD Manager. New a AVD.



- Select CPU/ABI of Intel Atom (x86). Enter others as needed. Click Create AVD.




 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy