Tag Archives: Activity Called

How to load a spinner with values from SQlite Database in android?

By | November 18, 2012

Here is a simple example showing how to load a database values in a spinner in android. OK we will start. This is the layout for the spinner row. spinner_row.xml [xml] <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation = "vertical" android:id="@+id/tv" android:layout_margin="10dp"> </TextView> [/xml] This is the layout for the interface. activity_main.xml [xml] <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"… Read More »

Working with SQLite Database in ANDROID.

By | February 14, 2011

Below is a straight forward example of how to deal with SQLite database in ANDROID. Go ahead and copy and paste the following code to your java file. The example has one database and performs functions like insert delete and listing of values in a textView. [java] package com.database; import android.app.Activity; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import… Read More »

The RatingBar in ANDROID

By | February 7, 2011

Simply copy and paste the following code to see how to use the RatingBar in ANDROID. [java] package AndroidRatingBar.pack; import android.app.Activity; import android.os.Bundle; import android.widget.RatingBar; import android.widget.Toast; public class AndroidRatingBar extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final RatingBar ratingBar_Small = (RatingBar)findViewById(R.id.ratingbar_Small); final RatingBar ratingBar_Indicator… Read More »

How to drag and drop in ANDROID?

By | September 18, 2010

The following code helps you to do a drag and drop in ANDROID. [java] package com.pack; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.os.Bundle; import android.view.MotionEvent; import android.widget.AbsoluteLayout; import android.widget.Button; import android.widget.ImageView; public class Touch extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyView tx = new… Read More »