Implicit and Explicit Intent Example

Android OS Activity have two types intent.

1) Implicit Intent::

Implicit Intents have not specified a component; instead, they must include enough information for the system to determine which of the available components is best to run for that intent.

Button openBrowser= (Button)findViewById(R.id.bOpenBrowser);

bOpenBrowser.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.pars(“http://www.google.com”));
startActivity(webIntent);

}

});

2) Explicit Intent::

Explicit Intents have specified a component (via setComponent(ComponentName) or setClass(Context, Class)), which provides the exact class to be run. Often these will not include any other information, simply being a way for an application to launch various internal activities it has as the user interacts with the application.

Button openGame= (Button)findViewById(R.id.bOpenGame);

openGame.setOnClickListener(new OnClickListener() {

public void onClick(View v) {

Intent launchExplicitIntent = new Intent(this, Game.class);
startActivity(launchExplicitIntent);

}

});

Advertisements

Where do android developers hang out online?

Developer Resource Forums

    http://StackOverflow.com
    http://Forums.DevShed.com
    http://www.webdeveloper.com/forum/
    http://GitHub.com
    http://forums.devarticles.com/

Android Developer Forums

    http://www.anddev.org/
    http://forum.xda-developers.com/
    https://groups.google.com/group/android-developers?pli=1
    http://forum.androidcentral.com/
    http://androidforums.com/application-development/
    http://www.androidpit.com/en/android/forum/category/1004010/Android-Developer-Forum

XDA Developer Forums

    http://forum.xda-developers.com/

Game Developer Forums

    http://forums.indiegamer.com/
    http://www.gamedev.net/index
    http://www.devmaster.net/forums/
    http://gmc.yoyogames.com/

How to view the SQLite database on your Android Emulator

This tutorial will show you how to open a SQLite datbase from your Android emulator.

This requires Eclipse and the Android plugin. If you don’t have them, follow this tutorial.

This also requires a SQLite viewer. I used SQLite Database Browser.

Step 1
With Eclipse open and your emulator running
select the DDMS perspective by clicking on the Window -> Open Perspective -> DDMS menu option.

Step 2
Select the emulator you have currently have running.
Click the File Explorer tab
Find the data folder.

Step 3
Follow the filepath to the application you want /data/data/your.app.namespace/dbname.db
Click the Pull a file from the device button and save the database file on your computer.

Step 4
Open the SQLite Database Viewer and click Open Database.
Open the file and you can browse the data and view the schema!

This can really help you debug some issues with your SQLite database!

With a few modifications, you should also be able to do this with your Android phone. The only problem I ran into was a permissions issue getting to the database file. I have not rooted my phone. There may also be other ways to get at it without rooting your phone.