[android-beginners] startActivity crash

2009-09-02 Thread tinyang
Hello.
 
I have an application in which I am trying to start an activity (geotest)
in, and the activity crashes upon start of the application.  Below is my
code and my logcat output.  I can't figure out the problem, because I have
several other activities I am able to start exactly the same way with no
problem.  When I compare the code, I can't see what I'm doing wrong with the
activity that crashes.  Am I missing permissions for something maybe?  Can
someone please help?  Thanks!

--
 
geotest.java:
 
package net.tinyang.geotest;

import android.app.Activity;

//import android.content.Intent;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.Toast;

public class geotest extends Activity {

Button geotagbtn = null;

Button next2btn = null;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

geotagbtn = (Button) findViewById(R.id.geotagbtn);

geotagbtn.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

//startActivity(new Intent(MainMenu.this, TakePic.class));

Toast.makeText(geotest.this, Geotag Picture coming soon, 5000).show();

}

});

next2btn = (Button) findViewById(R.id.next2btn);

next2btn.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

//startActivity(new Intent(Geotest.this, FieldGuide.class));

Toast.makeText(geotest.this, Next coming soon, 5000).show();

}

});

}

}


--

geotag.xml:

?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 

TextView

android:id=@+id/pictitle

android:layout_width=fill_parent

android:layout_height=wrap_content

android:layout_marginTop=10dip

android:text=Geotag your Picture / 

ImageView android:id=@+id/camsurface

android:layout_width=wrap_content 

android:layout_height=wrap_content

/ImageView 

TableLayout

android:layout_width=fill_parent

android:layout_height=wrap_content  

TableRow 

Button android:id=@+id/geotagbtn

android:layout_width=wrap_content 

android:layout_height=wrap_content

android:layout_below=@id/camsurface

android:layout_centerHorizontal=true

android:text= Geotag  /

Button android:id=@+id/next2btn

android:layout_width=wrap_content 

android:layout_height=wrap_content

android:layout_centerHorizontal=true

android:text= Next  /

/TableRow

/TableLayout

/LinearLayout


-

manifest:

?xml version=1.0 encoding=utf-8?

manifest xmlns:android=http://schemas.android.com/apk/res/android;

package=net.tinyang.geotest

android:versionCode=1

android:versionName=1.0

uses-permission android:name=android.permission.INTERNET /

uses-permission android:name=android.permission.CAMERA/

application android:icon=@drawable/icon android:label=@string/app_name

activity android:name=.geotest

android:label=@string/app_name

intent-filter

action android:name=android.intent.action.MAIN /

category android:name=android.intent.category.LAUNCHER /

/intent-filter

/activity

/application 

uses-sdk android:minSdkVersion=2 /

/manifest 


---

Logcat output:

 
09-02 23:14:42.623: ERROR/mountd(20): could not read initial mass storage
state
09-02 23:14:42.934: ERROR/flash_image(29): can't find recovery partition
09-02 23:14:50.694: ERROR/MemoryHeapBase(52): error opening /dev/pmem: No
such file or directory
09-02 23:14:50.694: ERROR/SurfaceFlinger(52): Couldn't open
/sys/android_power/wait_for_fb_sleep or /sys/android_power/wait_for_fb_wake
09-02 23:14:50.725: ERROR/GLLogger(52): couldn't load libhgl.so library
(Cannot find library)
09-02 23:14:50.805: ERROR/GLLogger(52): couldn't load libhgl.so library
(Cannot find library)
09-02 23:14:53.533: ERROR/BatteryService(52): Could not open
'/sys/class/power_supply/usb/online'
09-02 23:14:53.533: ERROR/BatteryService(52): Could not open
'/sys/class/power_supply/battery/batt_vol'
09-02 23:14:53.533: ERROR/BatteryService(52): Could not open
'/sys/class/power_supply/battery/batt_temp'
09-02 23:14:53.754: ERROR/EventHub(52): could not get driver version for
/dev/input/mouse0, Not a typewriter
09-02 23:14:53.754: ERROR/System(52): Failure starting core service
09-02 23:14:53.754: ERROR/System(52): java.lang.SecurityException
09-02 23:14:53.754: ERROR/System(52): at
android.os.BinderProxy.transact(Native Method)
09-02 23:14:53.754: ERROR/System(52): at

[android-beginners] startActivity() crash...

2009-08-17 Thread Tikoze

Here is the code that I am using to bring a running activity
to the foreground:

ActivityManager.RunningTaskInfo task = getTask(idx);
if (task != null)
{
Intent intent = new Intent();
intent.setClassName(task.topActivity.getPackageName(),
task.topActivity.getClassName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

try
{
m_context.startActivity(intent);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(m_context, Unable to launch
activity..., Toast.LENGTH_SHORT).show();
}

}

- Crash Scenario 1:
Switching to any task in the list of running task that has started
another activity (i.e. task.topActivity and task.baseActivity are
different) causes a crash.  I have tried the code above using both
task.topActivity and task.baseActivity but the results are the same...
force close.

- Crash Scenario 2:
Switching to specific tasks always causes a force close.  For example,
when I try to switch to the Calendar Task when it is running my
program always crashes.  However, I can successfully switch to Google
Maps, Home, Browser, and most others.

I have been unable to find any information about these issue anywhere
in google groups or on the internet...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---