I am trying to access the google calendar using gdata. but the application closes :(
I have added gdata-client-1.0.jar as external jar.
here are my files :
rrr.java
package caleda.qwe;
import java.net.URL;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.calendar.CalendarEntry;
import com.google.gdata.data.calendar.CalendarFeed;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class rrr extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String res="not proper";
// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("calendar");
try{
myService.setUserCredentials("sunnycool333", "XXXXX");
// Send the request and print the response
URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);
// System.out.println("Calendars you own:");
// System.out.println();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
// System.out.println("\t" + entry.getTitle().getPlainText());
res=entry.getTitle().getPlainText();
}
}
catch (Exception e) {
// TODO: handle exception
//System.out.println("not working");
res=e.toString();
}
TextView view = (TextView)findViewById(R.id.TextView01);
view.setText(res);
}
}
main.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:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello"
/>
<TextView android:text="#+id/TextView01" android:id="#+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
applicationmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="caleda.qwe"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".rrr"
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>
</manifest>
Can someone please help me in pointing out my mistake.
Your Activity may be failing with the Application Not Responding dialog because you are making a network access on the UI thread.
Try using an AsyncTask.
This question has some example code and links concerning AsyncTask.
Thanks a lot everyone..
If we add two more files as external jar files the problem gets solved..
The two files are located in "deps" folder of gdata client src..
named : google-collect-1.0-rc1.jar & jsr305.jar
Related
Hi i need help with a tutorial i tried from ( http://xjaphx.wordpress.com/2012/02/04/android-xml-adventure-parsing-html-using-jsoup/ ). It's about jsoup but i can't get it to work i only get a lott of errors and stuff.
Here is my code:
package com.sigustgebran.appsl;
import android.os.Bundle;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainAct extends Activity {
//blog url
static final String BLOG_URL = "http://xjaphx.wordpress.com/";
#Override
protected void onCreate(Bundle savedInstanceState) {
//set layout view
super.onCreate(savedInstanceState);
setContentView(R.layout.act_main);
//process
try {
((TextView)findViewById(R.id.tvDisplay)).setText(getBlogStats());
} catch (Exception ex) {
((TextView)findViewById(R.id.tvDisplay)).setText("Error");
}
}
protected String getBlogStats() throws Exception {
String result = "";
//get html document structure
Document document = Jsoup.connect(BLOG_URL).get();
//select path
Elements nodeBlogStats = document.select("div#blog-stats ul li");
//check results
if(nodeBlogStats.size() > 0) {
//get value
result = nodeBlogStats.get(0).text();
}
//return
return result;
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:layout_gravity="center"
android:id="#+id/tvDisplay"
/>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sigustgebran.appsl"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.sigustgebran.appsl.MainAct"
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>
</manifest>
I would be really glad if anyone could help me. Thanks
I got it to work now. I had added the jsoup library in "External jars" as he said in the tutorial, but when I deleted it and just copied it in the "libs" map instead it worked.
you have to implement AsyncTask. I think this will help you
I'm attempting to run an android app using the Google Api's library and am receiving a Failure to launch error when debugging upon entering an address into the input field.
Here is the error: http://s1278.beta.photobucket.com/user/cetmrw791346/media/wdyl_zps08bbe17f.png.html?sort=3&o=0
and
Here are the relevant files:
AWhereDoYouLive.java
package com.example.wheredoyoulive;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class AWhereDoYouLive extends Activity {
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
final AlertDialog.Builder adb = new AlertDialog.Builder(this);
final EditText addressfield = (EditText) findViewById(R.id.address);
final Button button = (Button) findViewById(R.id.launchmap);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
try {
// Perform action on click
String address = addressfield.getText().toString();
address = address.replace(' ', '+');
Intent geoIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address));
startActivity(geoIntent);
} catch (Exception e) {
AlertDialog ad = adb.create();
ad.setMessage("Failed to Launch");
ad.show();
}
}
});
}
}
Main.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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please enter your home address."
/>
<EditText
android:id="#+id/address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoText="true"
/>
<Button
android:id="#+id/launchmap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Map"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Unlocking Android, Chapter 1."
/>
</LinearLayout>
AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.wheredoyoulive"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/icon" >
<activity android:label="#string/app_name"
android:name="com.example.wheredoyoulive.AWhereDoYouLive">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<users-permission android:name="android.permission.INTERNET" />
</manifest>
When double-checking the Google services setup page: http://developer.android.com/google/play-services/setup.html it looks as if Google Play services isn’t supported by any of the available Android emulators.
There is a work around to make a Google Map API V2 to work on your emulator, please read the second part of the following blog post I wrote for more information:
Google Map API V2 in Emulator
Update:
I have spent more than 2 hours to google, but I can't find the answer. I've add a main.java the handle the activity send from the Login Activity. Now the file tree looks like:
But still got error
E/AndroidRuntime(1282): android.content.ActivityNotFoundException: No
Activity found to handle Intent {
act=com.goodboy.loginIntent.action.main
cat=[android.intent.category.DEFAULT] (has extras) }
I know this question is simple, I am new to android, any help would be appreciated:)
Android allows for Intents that have specific recipients(the Activity or Service) as well as Intents that are broadcast throughout the system to any components that may be listening.
I want to make a PoC(Proof of Concept) that if we do not set setClassName, others can listen your private message.
This PoC is simple, suppose there is Login Activity for App Goodboy, when a user put his username and password in the login activity, and click the login button, the evil activity from App Badboy steal the this message.
However, failed:(
When I click the login button, failed:
And the evil intent got nothing:
The java source code of Login Activity
package com.goodboy.loginIntent;
import com.goodboy.loginIntent.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class GoodloginActivity extends Activity {
private EditText et_user;
private EditText et_pwd;
private Button btn_login;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
et_user = (EditText) findViewById(R.id.et_user);
et_pwd = (EditText) findViewById(R.id.et_pwd);
btn_login = (Button) findViewById(R.id.btn_login);
btn_login.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
Intent m_intent = new Intent();
m_intent.putExtra("username", et_user.getText().toString());
m_intent.putExtra("password", et_pwd.getText().toString());
m_intent.setAction("com.goodboy.loginIntent.action.main");
m_intent.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(m_intent);
}
});
}
}
The source code of main.java
package com.goodboy.loginIntent;
import android.app.Activity;
import android.os.Bundle;
import com.goodboy.loginIntent.R;
public class main extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
The login layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="#+id/et_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/et_pwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="#+id/btn_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
The java source code of evil activity:
package com.badboy.stealIntent;
import com.badboy.stealIntent.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class BadIntentActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Toast.makeText(getBaseContext(),
"username: "+this.getIntent().getStringExtra("username")+
"\npassword: "+this.getIntent().getStringExtra("password"),
Toast.LENGTH_SHORT).show();
}
}
Thanks #David Wasser, the manifest of login app(update):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.goodboy.loginIntent"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".GoodloginActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".main"
android:label="#string/main" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The manifest of the badIntent:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.badboy.stealIntent"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".BadIntentActivity"
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>
</manifest>
You should take a look at Intent Intercept, an application aimed for developer which, as the name says, intercept any "public" Intent, allowing you to browse the intent setup and data. Intent Intercept is Open source, you can browse the code on GitHub
As for your problem, check that the BadBoy application is registered for the action you're using. Also, take a look at the stacktrace in logcat on goodlogin to see where the activity crashes.
You are probably getting an ActivityNotFoundException when you call startActivity() in GoodloginActivity because there is no Activity known to the system that responds to:
ACTION = "com.goodboy.loginIntent.action.main" and
CATEGORY = CATEGORY_DEFAULT
Have a look at your logcat output.
I've been playing around with this for some time now and am hoping that someone smarter than I will be able to help. My boss has given me an opportunity to learn to develop Android apps and I'm struggling with this one issue. I need to build several apps with multiple activities but can't seem to get past this point. I'm sure it's a problem in my coding, but with so many different ways of doing things, I'm a little confused at this point.
I am building an app that opens a Main activity with two buttons on the page. One is the close button and works fine. I want the next button to open a mapActivity that is set to my campus' location. I am not a student working on a project I just work for a community college. ;-)
What's really wierd is that the EXACT same google.maps code works fine by itself. I just can't get the button to open the Activity without crashing.
Here is my manifest.xml, main.xml, my main.java, Map.java and map.xml. would you please comment and point me in the right direction?
Thanks in advance,
Dave
here are two errors:
11-21 14:50:58.968: W/dalvikvm(437): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-21 14:50:58.978: E/AndroidRuntime(437): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=edu.mtsac.mapproject.MAP }
This says the Activity was not found but I can see it in my source files, and in the manifest here:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.mtsac.mapproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps" />
<activity
android:label="#string/app_name"
android:name=".Main" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- map activity -->
<activity
android:label="Map"
android:name=".Map" >
<intent-filter >
<action android:name="edu.mtsac.mapproject.MAP" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
My Main.xml and Map.xml files are simple:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="#+id/mapBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Map" />
</RelativeLayout>
Map.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0jevUfyLD_b1Eikgpm_mo7KVDspzhPJdRDDaxEw"
android:clickable="true"
android:enabled="true" />
</LinearLayout>
the Main.java
package edu.mtsac.mapproject;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Main extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button mapBtn = (Button) findViewById(R.id.mapBtn);
mapBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(Main.this, Map.class));
}
});
Button closeBtn = (Button) findViewById(R.id.closeBtn);
closeBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
finish();
}
});
};// end onCreate()
}
and lastly the Map.java
package edu.mtsac.mapproject;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
public class Map extends MapActivity {
MapController mc;
GeoPoint p;
MapView mapview;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
mapview = (MapView) findViewById(R.id.mapView);
mapview.displayZoomControls(true);
mapview.setBuiltInZoomControls(true);
mapview.setSatellite(true);
mc = mapview.getController();
String coord[] = { "34.047517", "-117.847050" };
double lat = Double.parseDouble(coord[0]);
double lng = Double.parseDouble(coord[1]);
p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(17);
mapview.invalidate();
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
I don't see any activity in your manifest registered to handle this action edu.mtsac.mapproject.MAP. I assume that exception is happening when you call:
startActivity(new Intent("edu.mtsac.mapproject.MAP"));
It looks like you're probably trying to start your Map Activity for which you don't need to specify an Action. Just do something like:
startActivity(new Intent(this, Map.class));
You probably want to read this doc on intents to understand what's really going on here and how you should be using these classes.
In the "map" button click implementation you create an Intent whose action is "edu.mtsac.mapproject.MAP". Since your manifest's Intent Filter is looking for action "android.intent.action.MAP" it will not resolve to your activity.
I believe you were confused by explicit vs. implicit intents. Explicit intents use the specific name of the activity you want to use but implicit intents only define an action you want to accomplish.
To get this to work change the map button to start the action in your manifest.
In your Main.java, try to use this code instead:
Button mapBtn = (Button) findViewById(R.id.mapBtn);
mapBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(Main.this, Map.class));
}
});
I am trying to transfer an int value between two activities using intents, but my app keeps crashing. When I comment out the transfer of any data and simply use an intent, everything seems to work. I cannot tell what is wrong.
Activity 1 (HeartRateActivity):
//Imports
public class HeartRateActivity extends Activity {
/** Called when the activity is first created. */
Button nextActivity;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
nextActivity = (Button)findViewById(R.id.nextActivity);
nextActivity.setOnClickListener(new Button.OnClickListener(){
#Override
public void onClick(View v) {
Intent intent = new Intent(HeartRateActivity.this, NextActivity.class);
intent.putExtra("age", 2);
startActivity(intent);
}
});
}
}
My NextActivity.java
package com.heartRate;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class NextActivity extends Activity {
TextView display;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.next);
int age = getIntent().getIntExtra("age", 0);
display = (TextView) findViewById(R.id.display);
display.setText(age);
}
}
My AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.heartRate" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HeartRateActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity android:name=".NextActivity"
android:label="#string/app_name" />
</application>
</manifest>
My main.xml (used by HeartRateActivity)
<?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:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello"
/>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="#+id/nextActivity" android:text="nextActivity"></Button>
</LinearLayout>
My next.xml(used by NextActivity) is similar and i dont think thats the issue...:
<?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:text="TextView" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/display"></TextView>
</LinearLayout>
I would appreciate help in solving this issue! Thank you
Replace
display.setText(age);
with
display.setText(Integer.toString(age));
If you provide an int as a parameter, it uses it as a resource ID, which, in this case, obviously doesn't exist.
just try do like this.
display = (TextView) findViewById(R.id.display);
display.setText(Integer.toString(age));
and surely it will work
Make sure that your Id and Intent Destination all must be Ok.
then just put between intent from initialize ans start.
with put
intent.putExtra("age", Double);
from get this.
double d = getIntent().getStringExtra("age");
Make sure that R.id.display is a valid TextView in your next layout.
Just so we're clear, you're saying when you include the ...
intent.putExtra("age", 2);
in the sending Activity, and the ...
int age = getIntent().getIntExtra("age", 0);
in the receiving Activity, the application crashes or expereinces problems? And, by excluding those 2 statements the application performs normally? I'm just curious what does LogCat show? Even though you application is crashing LogCat will have several entries as to what was happening just prior to the close.