[Q] Pass String array to a service - General Questions and Answers

I have been having an issue passing a String array from one activity to a service. Basically the code looks like this:
snippet from Activity class:
Code:
Bundle toService;
toService.putStringArray("paths", Paths);
Intent INTENT=new Intent("com.example.test.protectionService");
INTENT.putExtras(toService);
from Service class:
Code:
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
Bundle extras = intent.getExtras();
if(extras!=null)
{
Paths = extras.getStringArray("paths");
Toast.makeText(protectionService.this, Paths[0], Toast.LENGTH_SHORT).show();
}
return 0;
}
On a side note, I am using a handler to show the first element of the array on the UI. It's giving me a NullPointerException caused by this:
Code:
Paths = extras.getStringArray("paths");
Most probably because array wasn't passed properly but I just don't know how to get around this problem.
Any ideas?
Thanks in advance.

Related

[Q] OnKey error

Check this class below,
______ My Code _______
public class Main extends Activity implements OnKeyListener {
DisplayWord currentWord;
TextView wordStatus;
EditText inputWord;
Button okBtn;
int pos = 1;
char currentChar;
char inputChar;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
currentWord = (DisplayWord) this.findViewById(R.id.trueWord);
currentWord.setText("Bonjure"); // word from database
wordStatus = (TextView) this.findViewById(R.id.wordStatus);
inputWord = (EditText) this.findViewById(R.id.wordInput);
inputWord.setOnKeyListener(this);
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (inputWord.getText().toString().length() <= currentWord.getText().toString().length()) {
pos = inputWord.getText().toString().length();
currentChar = currentWord.getText().toString().charAt(pos);
inputChar = inputWord.getText().toString().charAt(pos);
} return false;
}
}
_____ END _____
When running this code, upon entering data into the input box it causes an exception straight away and for the program exit unexpectedley.
I am trying to extract the input word from EditText field and the word stored in a TextView and to compare them char by char as those chars are entered into the input box, sort of a word game, where the character will be highlighted green if it is correct and red if it is not.
I have no idea why this behaviour happens, I can see in debugger an StringIndexOutOfBounds exception, and a ResourceNotFound when I have been tampering with different ways of attempting this, access position or the char array, it always seems to throw an exception.
Any advice or links appreciated,
AnthonyI am trying to post a copy and paste of just text, no links but validation error on starting a new thread is telling me that I cannot submit a message with a link in it? I want to show everyone a simple class because of some problem's i'm having.. any ideas?

Can't use a ListFragment

Hi:
I'm very new at programming in Android (I have programmed extensively PC applications and used Java) and I'm at a loss. I want to create a application that uses fragments. I want to create the Fragment Programaticaly (as the introduction says on Android Developer page) buy my application keeps crashing and I have no Idea as to why.
Here is the code for my main activity:
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
FragmentManager fmanager = getFragmentManager();
FragmentTransaction ftransaction = fmanager.beginTransaction();
FileBrowser fbrowser = new FileBrowser();
ftransaction.add(R.layout.main,fbrowser, "FileBrowser");
ftransaction.commit();
fbrowser.test();
}
And here is the code for FileBrowser:
Code:
public class FileBrowser extends ListFragment {
public void test(){
System.err.println("Entre a test!!!");
String[] MyList = {"HOla","Mundo","De","Las","Listas"};
if (getActivity() == null){
System.err.println("I get a NULL Activity");
}
else{
System.err.println("No NULL Activity Attempting to Create an Adapter");
ArrayAdapter<String> aa = new ArrayAdapter<String>(getActivity(), R.layout.file_row, MyList);
}
//setListAdapter(new ArrayAdapter<String>(this.getActivity(), R.layout.file_row, MyList));
}
}
All I wan to do to start is to print the string list MyList in the fragment. However I the program crashes and I get this error:
06-09 19:25:42.920: ERROR/AndroidRuntime(26064): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ccr/com.ccr.Main}: java.lang.IllegalArgumentException: No view found for id 0x7f030001 for fragment FileBrowser{4077d558 #0 id=0x7f030001 FileBrowser}
Thanks for any help!

[Q] Problem developing app for Android

Hi All,
I am a not experienced developer. All I want to do is make a small app to track information of football on TV. I want to do it through a small DB however I've been struggling a lot with an error I've been trying to discover in the last two weeks but I have not been able.
I have teh following code in the class I create the DB
public class DBAdapter {
public static final String KEY_ROWID = "_id";
public static final String KEY_GDATE = "gdate";
public static final String KEY_GTIME = "gtime";
public static final String KEY_GGAME = "ggame";
public static final String KEY_GCOMPETITION = "gcompetition";
public static final String KEY_GCHANNEL = "gchannel";
private static final String TAG = "DBAdapter";
private static final String DATABASE_NAME = "FonTV";
private static final String DATABASE_TABLE = "games";
private static final int DATABASE_VERSION = 2;
private static final String DATABASE_CREATE =
"create table games (_id integer primary key autoincrement, "
+ "gdate text not null, gtime text not null, ggame text not null" +
"gcompetition text not null, gchannel text not null);";
private final Context context;
private DatabaseHelper DBHelper;
private SQLiteDatabase db;
public DBAdapter(Context ctx)
{
this.context = ctx;
DBHelper = new DatabaseHelper(context);
}
private static class DatabaseHelper extends SQLiteOpenHelper
{
DatabaseHelper(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db)
{
try {
db.execSQL(DATABASE_CREATE);
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+ newVersion + ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS contacts");
onCreate(db);
}
}
//---opens the database---
public DBAdapter open() throws SQLException
{
db = DBHelper.getWritableDatabase();
return this;
}
//---closes the database---
public void close()
{
DBHelper.close();
}
//---insert a contact into the database---
public long insertContact(String gdate, String gtime, String ggame, String gcompetition, String gchannel )
{
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_GDATE, gdate);
initialValues.put(KEY_GTIME, gtime);
initialValues.put(KEY_GGAME, ggame);
initialValues.put(KEY_GCOMPETITION, gcompetition);
initialValues.put(KEY_GCHANNEL, gchannel);
return db.insert(DATABASE_TABLE, null, initialValues);
}
}
And the main class where I try to insert data has this:
public class ResultsDBActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DBAdapter db = new DBAdapter(this);
db.open();
long id = db.insertContact("12/may", "08:00", "Leeds vs York", "JUME Cup", "ITV, BBC");
id = db.insertContact("13/may", "09:00", "London vs Bath", "JUME Cup", "ITV, BBC2");
db.close();
}
}
However when I try to run it, the debugger shows and error that says:
E/Database(330): android.database.sqlite.SQLiteException: no such table: games: , while compiling: INSERT INTO games(gchannel, ggame, gtime, gdate, gcompetition) VALUES(?, ?, ?, ?, ?);
I’ve trying to change parameters and many things but I haven’t found where the problem is. Can someone help me please?

inside android: implementation of one kernel driver for android

1. mkdir hello
[email protected]:~/Android$ cd kernel/common/drivers
[email protected]:~/Android/kernel/common/drivers$ mkdir hello
2. hello.h
#ifndef _HELLO_ANDROID_H_
#define _HELLO_ANDROID_H_
#include <linux/cdev.h>
#include <linux/semaphore.h>
#define HELLO_DEVICE_NODE_NAME "hello"
#define HELLO_DEVICE_FILE_NAME "hello"
#define HELLO_DEVICE_PROC_NAME "hello"
#define HELLO_DEVICE_CLASS_NAME "hello"
struct hello_android_dev {
int val;
struct semaphore sem;
struct cdev dev;
};
#endif
3. hello.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/device.h>
#include <asm/uaccess.h>
#include "hello.h"
static int hello_major = 0;
static int hello_minor = 0;
static struct class* hello_class = NULL;
static struct hello_android_dev* hello_dev = NULL;
static int hello_open(struct inode* inode, struct file* filp);
static int hello_release(struct inode* inode, struct file* filp);
static ssize_t hello_read(struct file* filp, char __user *buf, size_t count, loff_t* f_pos);
static ssize_t hello_write(struct file* filp, const char __user *buf, size_t count, loff_t* f_pos);
static struct file_operations hello_fops = {
.owner = THIS_MODULE,
.open = hello_open,
.release = hello_release,
.read = hello_read,
.write = hello_write,
};
static ssize_t hello_val_show(struct device* dev, struct device_attribute* attr, char* buf);
static ssize_t hello_val_store(struct device* dev, struct device_attribute* attr, const char* buf, size_t count);
static DEVICE_ATTR(val, S_IRUGO | S_IWUSR, hello_val_show, hello_val_store);
static int hello_open(struct inode* inode, struct file* filp) {
struct hello_android_dev* dev;
dev = container_of(inode->i_cdev, struct hello_android_dev, dev);
filp->private_data = dev;
return 0;
}
static int hello_release(struct inode* inode, struct file* filp) {
return 0;
}
static ssize_t hello_read(struct file* filp, char __user *buf, size_t count, loff_t* f_pos) {
ssize_t err = 0;
struct hello_android_dev* dev = filp->private_data;
if(down_interruptible(&(dev->sem))) {
return -ERESTARTSYS;
}
if(count < sizeof(dev->val)) {
goto out;
}
if(copy_to_user(buf, &(dev->val), sizeof(dev->val))) {
err = -EFAULT;
goto out;
}
err = sizeof(dev->val);
out:
up(&(dev->sem));
return err;
}
static ssize_t hello_write(struct file* filp, const char __user *buf, size_t count, loff_t* f_pos) {
struct hello_android_dev* dev = filp->private_data;
ssize_t err = 0;
if(down_interruptible(&(dev->sem))) {
return -ERESTARTSYS;
}
if(count != sizeof(dev->val)) {
goto out;
}
if(copy_from_user(&(dev->val), buf, count)) {
err = -EFAULT;
goto out;
}
err = sizeof(dev->val);
out:
up(&(dev->sem));
return err;
}
static ssize_t __hello_get_val(struct hello_android_dev* dev, char* buf) {
int val = 0;
if(down_interruptible(&(dev->sem))) {
return -ERESTARTSYS;
}
val = dev->val;
up(&(dev->sem));
return snprintf(buf, PAGE_SIZE, "%d\n", val);
}
static ssize_t __hello_set_val(struct hello_android_dev* dev, const char* buf, size_t count) {
int val = 0;
val = simple_strtol(buf, NULL, 10);
if(down_interruptible(&(dev->sem))) {
return -ERESTARTSYS;
}
dev->val = val;
up(&(dev->sem));
return count;
}
static ssize_t hello_val_show(struct device* dev, struct device_attribute* attr, char* buf) {
struct hello_android_dev* hdev = (struct hello_android_dev*)dev_get_drvdata(dev);
return __hello_get_val(hdev, buf);
}
static ssize_t hello_val_store(struct device* dev, struct device_attribute* attr, const char* buf, size_t count) {
struct hello_android_dev* hdev = (struct hello_android_dev*)dev_get_drvdata(dev);
return __hello_set_val(hdev, buf, count);
}
static ssize_t hello_proc_read(char* page, char** start, off_t off, int count, int* eof, void* data) {
if(off > 0) {
*eof = 1;
return 0;
}
return __hello_get_val(hello_dev, page);
}
static ssize_t hello_proc_write(struct file* filp, const char __user *buff, unsigned long len, void* data) {
int err = 0;
char* page = NULL;
if(len > PAGE_SIZE) {
printk(KERN_ALERT"The buff is too large: %lu.\n", len);
return -EFAULT;
}
page = (char*)__get_free_page(GFP_KERNEL);
if(!page) {
printk(KERN_ALERT"Failed to alloc page.\n");
return -ENOMEM;
}
if(copy_from_user(page, buff, len)) {
printk(KERN_ALERT"Failed to copy buff from user.\n");
err = -EFAULT;
goto out;
}
err = __hello_set_val(hello_dev, page, len);
out:
free_page((unsigned long)page);
return err;
}
static void hello_create_proc(void) {
struct proc_dir_entry* entry;
entry = create_proc_entry(HELLO_DEVICE_PROC_NAME, 0, NULL);
if(entry) {
entry->owner = THIS_MODULE;
entry->read_proc = hello_proc_read;
entry->write_proc = hello_proc_write;
}
}
static void hello_remove_proc(void) {
remove_proc_entry(HELLO_DEVICE_PROC_NAME, NULL);
}
static int __hello_setup_dev(struct hello_android_dev* dev) {
int err;
dev_t devno = MKDEV(hello_major, hello_minor);
memset(dev, 0, sizeof(struct hello_android_dev));
cdev_init(&(dev->dev), &hello_fops);
dev->dev.owner = THIS_MODULE;
dev->dev.ops = &hello_fops;
err = cdev_add(&(dev->dev),devno, 1);
if(err) {
return err;
}
init_MUTEX(&(dev->sem));
dev->val = 0;
return 0;
}
static int __init hello_init(void){
int err = -1;
dev_t dev = 0;
struct device* temp = NULL;
printk(KERN_ALERT"Initializing hello device.\n");
err = alloc_chrdev_region(&dev, 0, 1, HELLO_DEVICE_NODE_NAME);
if(err < 0) {
printk(KERN_ALERT"Failed to alloc char dev region.\n");
goto fail;
}
hello_major = MAJOR(dev);
hello_minor = MINOR(dev);
hello_dev = kmalloc(sizeof(struct hello_android_dev), GFP_KERNEL);
if(!hello_dev) {
err = -ENOMEM;
printk(KERN_ALERT"Failed to alloc hello_dev.\n");
goto unregister;
}
err = __hello_setup_dev(hello_dev);
if(err) {
printk(KERN_ALERT"Failed to setup dev: %d.\n", err);
goto cleanup;
}
hello_class = class_create(THIS_MODULE, HELLO_DEVICE_CLASS_NAME);
if(IS_ERR(hello_class)) {
err = PTR_ERR(hello_class);
printk(KERN_ALERT"Failed to create hello class.\n");
goto destroy_cdev;
}
temp = device_create(hello_class, NULL, dev, "%s", HELLO_DEVICE_FILE_NAME);
if(IS_ERR(temp)) {
err = PTR_ERR(temp);
printk(KERN_ALERT"Failed to create hello device.");
goto destroy_class;
}
err = device_create_file(temp, &dev_attr_val);
if(err < 0) {
printk(KERN_ALERT"Failed to create attribute val.");
goto destroy_device;
}
dev_set_drvdata(temp, hello_dev);
hello_create_proc();
printk(KERN_ALERT"Succedded to initialize hello device.\n");
return 0;
destroy_device:
device_destroy(hello_class, dev);
destroy_class:
class_destroy(hello_class);
destroy_cdev:
cdev_del(&(hello_dev->dev));
cleanup:
kfree(hello_dev);
unregister:
unregister_chrdev_region(MKDEV(hello_major, hello_minor), 1);
fail:
return err;
}
static void __exit hello_exit(void) {
dev_t devno = MKDEV(hello_major, hello_minor);
printk(KERN_ALERT"Destroy hello device.\n");
hello_remove_proc();
if(hello_class) {
device_destroy(hello_class, MKDEV(hello_major, hello_minor));
class_destroy(hello_class);
}
if(hello_dev) {
cdev_del(&(hello_dev->dev));
kfree(hello_dev);
}
unregister_chrdev_region(devno, 1);
}
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("First Android Driver");
module_init(hello_init);
module_exit(hello_exit);
4. things added to Kconfig Makefile
Kconfig:
config HELLO
tristate "First Android Driver"
default n
help
This is the first android driver.
Makefile:
obj-$(CONFIG_HELLO) += hello.o
5. menu menuconfig
In arch/arm/Kconfig and drivers/kconfig, add one line between menu "Device Drivers" and endmenu:
source "drivers/hello/Kconfig"
6. change drivers/Makefile, add one line:
obj-$(CONFIG_HELLO) += hello/
7. menuconfig
[email protected]:~/Android/kernel/common$ make menuconfig
set option "Device Drivers" => "First Android Drivers" to "y"
8. make
[email protected]:~/Android/kernel/common$ make
9. rebuild kernel and test the driver
[email protected]:~/Android$ emulator -kernel ./kernel/common/arch/arm/boot/zImage &
[email protected]:~/Android$ adb shell
File hello should be available in /dev:
[email protected]:/ # cd dev
[email protected]:/dev # ls
File hello should be available in /proc:
[email protected]:/ # cd proc
[email protected]:/proc # ls
Get the value:
[email protected]:/proc # cat hello
0
[email protected]:/proc # echo '5' > hello
[email protected]:/proc # cat hello
5
Dir hello should be available in /sys/class:
[email protected]:/ # cd sys/class
[email protected]:/sys/class # ls
Dir hello should be available in /sys/class/hello:
[email protected]:/sys/class # cd hello
[email protected]:/sys/class/hello # ls
File val should be available in /sys/class/hello/hello:
[email protected]:/sys/class/hello # cd hello
[email protected]:/sys/class/hello/hello # ls
access the value of val:
[email protected]:/sys/class/hello/hello # cat val
5
[email protected]:/sys/class/hello/hello # echo '0' > val
[email protected]:/sys/class/hello/hello # cat val
0
about "inside android"
Hi, all.
As experienced android developers or just beginners, sometimes you might have questions about what's going on inside android. Such as how activity starts, how service starts, etc. If we look into the code, we might have the answer, but it takes time and much effort. In fact, there's millions of lines of source code in android. Fortunately, Shengyang Luo wrote a book in chinese to clarify all these questions, with all the related knowledge he got in these years as an experienced engineer of linux/android. Now, he and I decide this book belongs to the android family, so to make more people get benefit from it, we will rewrite it in English.
Also, we want this book to be more adapted to your need, we might share the outline and part of the content of the book here, so that we all can discuss it while rewriting it. We might change the book according to your advice. For example, there might be more details for the parts you are most interested. To do this, we will have pilot PPTs and passages soon. The pilot topics would be as below:
Android design philosophy--everything is component
Initializing a Build/developing/debugging Environment for Android
Android architecture
Hardware Abstraction Layer(HAL)
drivers specific to android
process management
messaging handling
input handling
UI architecture
resource management framework
Dalvik virtual machine
Which is most interested to you? Please share with us, and we will make it available ASAP.
We haven't talked with any press for publishing yet. So if any press is interested in publishing this book, please contact me. As you all know, writing is a tough job, especially when the book is regarding such a complicated android os system, so cheers, encouragement and funding are welcomed badly. Funding would help us not worry about making a living and dedicate to the writing or even hire some people to accelerate the progress. For funding, please visit indiegogo.com and search "inside android".
The book would have 3 parts: say hello to android, drivers specific to android and understanding android in scenes. The first 2 parts are foundation knowledge for the third part, which is the major part of the book.
Part I say hello to android includes 3 chapters, and introduces how to download the source code, build it, run it, smart pointer and Hardware Abstraction Layer(HAL). Since smart pointer is widely used in the native code of application framework, it would be very helpful if we get to know it before we dive into the scenes. Knowing HAL would help us understand the architecture of android, and then make the third part easier to learn.
Part II drivers specific to android also includes 3 chapters, introducing 3 drivers specific to android: Logger Driver, Binder IPC Driver and Ashmem Shared Memory Driver. No doubt, these 3 drivers, especially the Binder IPC Driver, are the foundation of android. knowing about them would definitely help understand android.
Part III understanding android in scenes includes more than 10 chapters, and introduces android in different scenes, such as the start of something(activity, service, zygote, service manager, etc.), process management, messaging handling etc.
The book is based on android 2.3. If needed, we can rewrite it on newer version.
Below is the outline of the book:
Part I: say hello to android
chapter 1 prerequisite
1.1 reference books on Linux kernel
1.2 reference books on Android application developing
1.3 download, build and run Android source code
1.3.1 download Android source code
1.3.2 build Android source code
1.3.3 run Android emulator
1.4 download, build and run Android kernel source code
1.4.1 download Android kernel source code
1.4.2 build Android kernel source code
1.4.3 run Android emulator
1.5 develop one Android application(example)
1.6 build and pack Android module independently
1.6.1 mmm: Builds all of the modules in the supplied directories
1.6.2 build one Android module independently
1.6.3 repack Android images
chapter 2 Hardware Abstraction Layer(HAL)
2.1 develop Android hardware driver
2.1.1 implementation of one kernel driver
2.1.2 modify Kconfig of the kernel
2.1.3 modify Makefile of the kernel
2.1.4 build the driver
2.1.5 test the driver
2.2 test the driver with C executable
2.3 develop HAL module
2.3.1 specification for HAL module
2.3.2 interface for HAL module
2.3.3 load the HAL module
2.3.4 access permission for the hardware
2.4 develop service to the Android hardware
2.4.1 defite the service interface to hardware
2.4.2 implementation of the service
2.4.3 JNI interface for the service
2.4.4 start of the service
2.5 Android application on the service to hardware
chapter 3 smart pointer
3.1 light weight pointer
3.1.1 implementation
3.1.2 example
3.2 strong pointer and weak pointer
3.2.1 strong pointer
3.2.2 weak pointer
3.2.3 example
Part II: drivers specific to android
chapter 4 Logger driver
4.1 Logger format
4.2 Logger driver
4.2.1 data structure
4.2.2 initialization
4.2.3 open the Logger driver
4.2.4 read the log
4.2.5 write the log
4.3 runtime library for the Logger driver
4.4 log interface for C/C++
4.5 log interface for Java
4.6 Logcat tool
4.6.1 data structure
4.6.2 initialization
4.6.3 read the log
4.6.4 output the log
chapter 5 Binder IPC Driver
5.1 Binder driver
5.1.1 data structure
5.1.2 initialization
5.1.3 open
5.1.4 mapping to the memory
5.1.5 kernel cache management
5.2 runtime library for Binder IPC Driver
5.3 example for Binder IPC Driver application
5.4 counting for Binder object reference
5.4.1 lifecycle of Binder local object
5.4.2 lifecycle of Binder instance
5.4.3 lifecycle of Binder reference
5.4.4 lifecycle of Binder proxy
5.5 Binder object death notification
5.5.1 register death notification
5.5.2 send death notification
5.5.3 unregister death notification
5.6 start of Service Manager
5.6.1 open and mapping on Binder
5.6.2 register as Binder context manager
5.6.3 wait for the Client request in loop
5.7 getting the Service Manager proxy
5.8 start of Service
5.8.1 register Service
5.8.2 start of Binder thread pool
5.9 how to get Service proxy
5.10 Java interface for Binder IPC Driver
5.10.1 getting the Java proxy of Service Manager
5.10.2 define the Java service
5.10.3 start of Java service
5.10.4 getting Java service proxy
5.10.5 calling Java service
chapter 6 Ashmem Shared Memory Driver
6.1 Ashmem driver
6.1.1 data structure
6.1.2 initialization
6.1.3 open
6.1.4 mapping to the memory
6.1.5 lock and unlock
6.1.6 recycle
6.2 Ashmem interface in runtime library cutils
6.3 C++ interface for Ashmem
6.3.1 MemoryHeapBase
6.3.2 MemoryBase
6.3.3 example
6.4 Java interface for Ashmem
6.4.1 MemoryFile
6.4.2 example
6.5 how Ashmem shares memory
Part III: understanding android in scenes
chapter 7 start of Activity
7.1 Activity example
7.2 start of root Activity
7.3 start of child Activity in the same process
7.4 start of child Activity in the new process
chapter 8 start of Service
8.1 Service example
8.2 start of Service in the same process
8.3 start of Service in the new process
chapter 9 Broadcast
9.1 example
9.2 register
9.3 send
chapter 10 Content Provider
10.1 Content Provider example
10.1.1 ArticlesProvider
10.1.2 Article
10.2 start of Content Provider
10.3 data sharing of Content Provider
10.3.1 data sharing model
10.3.2 data transmission
10.4 Content Provider's notification for data Change
10.4.1 register ContentObserver
10.4.2 send notification for data Change
chapter 11 start of Zygote and System process
11.1 start script of Zygote process
11.2 start of Zygote
11.3 start of System
chapter 12 start of Android application
12.1 creation of application process
12.2 start of Binder thread pool
12.3 creation of message loop
chapter 13 message handling
13.1 creation of message queue
13.2 message cycle
13.3 message sending
13.4 message handling
chapter 14 keyboard message handling
14.1 keyboard message handling model
14.2 start of InputManager
14.2.1 creation of InputManager
14.2.2 start of InputManager
14.2.3 start of InputDispatcher
14.2.4 start of InputReader
14.3 register InputChannel
14.3.1 creation of InputChannel
14.3.2 register InputChannel of server side
14.3.3 register the window of currently activated application
14.3.4 register InputChannel of client side
14.4 Dispatch of the keyboard message
14.4.1 InputReader gets keyboard event
14.4.2 InputDispatcher dispatch keyboard event
14.4.3 the window of currently activated application gets keyboard message
14.4.4 InputDispatcher gets notification when the keyboard event handling is done
14.5 unregister InputChannel
14.5.1 destroy application window
14.5.2 unregister InputChannel of client side
14.5.3 unregister InputChannel of server side
chapter 15 message loop model of Android application thread
15.1 message loop model of application main thread
15.2 message loop model of nongraphic application child thread
15.3 message loop model of graphic application child thread
chapter 16 installation and showup of Android application
16.1 installation of application
16.2 showup of application
chapter 17 UI system
17.1 UI architecture
17.2 application UI framework
17.3 WindowManagerService
17.4 SurfaceFlinger
17.5 Multiple Display support
chapter 18 resource management framework
18.1 resource management framework
18.2 compilation of resource
18.3 search for resource
chapter 19 Dalvik virtual machine(DVM)
19.1 introduction
19.2 start of DVM
19.3 execution of DVM
19.4 register JNI methods
19.5 DVM process
19.6 DVM thread

is it correct to use Activity paramActivity rather than Context context in my adapter

Hi am new to android and I have a question that may seem very simple but I am just trying to understand this code I found on the net
by using Activity paramActivity is it referring to the Activity context and why not using activity .this?
Is it possible for the constractor adaptor to contain values that are missing from the super adapter?
public class myAdapter
extends ArrayAdapter<String>
{
private final Activity context;
private final String[] subtitleId;
private final String[] titleId;
public myAdapter(Activity paramActivity, String[] paramArrayOfString1,
String[] paramArrayOfString2)
{
super(paramActivity, 2745458745 , paramArrayOfString1);
this.context = paramActivity;
this.titleId = paramArrayOfString1;
this.subtitleId = paramArrayOfString2;
}

Categories

Resources