Skip to main content

Posts

Showing posts with the label image

Android JellyBean new features

# WI-Fi Direct # 1080p video recording for stock Android devices # Improved error correction on the keyboard # You can directly access the apps from the lock screen # Upgraded copy and paste functionality # Support for the WebP image format # Hardware acceleration of the universal Interface # Soft buttons from Android 3.x are now available for use on phones # Widgets in a new tab can be separated, listed in a similar manner to apps # Folders can easily be created with a drag-and-drop style # Launcher Customizer # Enhanced visual voicemail with the ability to speed up or slow down voicemail messages # Pinch-to-zoom functionality in the calendar # Integrated screenshot capture (accomplished by holding down the Power and Volume-Down buttons) # Improved voice integration and continuous, real-time speech to text dictation # Face Unlock, a feature that allows users to unlock handsets using facial recognitionsoftware # New tabbed web browser under Google’s Chrome brand, allowing up to 16 tab...

Regular bitmap and a Nine-patch image

A Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

Simple AutoComplete TextView in ANDROID

public class Autocomplete extends Activity { String name[]={ "John", "Angel", "Mark", "Angelina", "Jhony", "Juli", "Augustine", "Robert", "Reena", "Ancilina", "Mary", "Juliet" }; AutoCompleteTextView autotextview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_autocomplete); autotextview=(AutoCompleteTextView) findViewById(R.id.myautocomplete); autotextview.setAdapter(new ArrayAdapter<string>(this, android.R.layout.simple_dropdown_item_1line, name)); }

ContextMenu in Android

Long click on the button to open the menu. in java class: public class ContextmenuActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button b=(Button)findViewById(R.id.button1); registerForContextMenu(b); } //create the menuuu====================== @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // TODO Auto-generated method stub super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater=getMenuInflater(); inflater.inflate(R.layout.contextmenu, menu); } //click to each menu====================== @Override public boolean onContextItemSelected(MenuItem item) { // TODO Auto-generated method stub if(item.getItemId()==R.id.item1) ...

Frame by Frame Animation in Android

Call a new xml file which includes the frames that are to be loaded: < ?xml version="1.0" encoding="utf-8"?> < animation-list android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android"> < item android:drawable="@drawable/frame_above95_1" android:duration="30"/> < item android:drawable="@drawable/frame_above95_2" android:duration="30"/> < item android:drawable="@drawable/frame_above95_3" android:duration="30"/> < item android:drawable="@drawable/frame_above95_4" android:duration="30"/> < item android:drawable="@drawable/frame_above95_5" android:duration="30"/> < item android:drawable="@drawable/frame_above95_6" android:duration="30"/> < item android:drawable="@drawable/frame_above95_7" android:duration="...

Download an Image from Url and Display it in a ImageView

Bitmap bmImg; ImageView img1; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.sending_card); img1=(ImageView) findViewById(R.id.imageView1); String url="http://i.123g.us/c/efeb_valen_happy/card/107397.gif"; downloadFile(url); } void downloadFile(String fileUrl){ URL myFileUrl =null; try { myFileUrl= new URL(fileUrl); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); bmImg = BitmapFactory.decodeStream(is); img1.setImageBitm...

Passing Images between Activities in Android

in First Activity: Intent intent=new Intent(FirstClass.this, SecondClass.class); Bundle bundle=new Bundle(); bundle.putInt("image",R.drawable.ic_launcher); intent.putExtras(bundle); startActivity(intent); in Second Acticity: Bundle bundle=this.getIntent().getExtras(); int pic=bundle.getInt("image"); v.setImageResource(pic); another method: in First Activity: Drawable drawable=imgv.getDrawable(); Bitmap bitmap= ((BitmapDrawable)drawable).getBitmap(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] b = baos.toByteArray(); Intent intent=new Intent(Passimage.this,myclass.class); intent.putExtra("picture", b); startActivity(intent); in Second Acticity: Bundle extras = getIntent().getExtras(); byte[] b = extras.getByteArray("picture"); Bitmap bmp = BitmapFactory.decodeByteArray(b, 0, b.lengt...

GridView in Android

in xml file: < pre class="brush: java"< < ?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" > < GridView android:id="@+id/gridView1" android:numColumns="auto_fit" android:gravity="center" android:columnWidth="50dp" android:stretchMode="columnWidth" android:layout_width="fill_parent" android:layout_height="fill_parent" > < /GridView> < /LinearLayout> in java file: public class Gridviewactivity extends Activity { GridView gridView; static final String[] numbers = new String[] { "A", "B", "C", "D", "E", "F", ...

Simple ListView in Android

xml page:eazy_list < RelativeLayout 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" > < ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content"> < /ListView> < /RelativeLayout> java page: public class MainActivity extends ListActivity { String[] planets = new String[] { "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune","Ceres","Pluto"}; ListView lstv; private ArrayAdapter listAdapter ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ...

Working with images in Corona

Loading an Image : syntax: display.newImage( filename [, baseDirectory] [, left, top] ) example: newImage = display.newImage( "image.png", 10, 20 ) myImage2 = display.newImage( "image.png" ) Image Autoscaling: The default behavior of display.newImage() is to auto-scale large images.To control manually we can use boolean value. syntax: display.newImage( [parentGroup,] filename [, baseDirectory] [, x, y] [,isFullResolution] ) example: newImage = display.newImage( "image.png", 10, 20, true ) Images with Dynamic Resolution : syntax: display.newImageRect( [parentGroup,] filename [, baseDirectory] w,h ) example: newImage = display.newImageRect( "Image.png", 100, 100 )