Google API Spreadsheet - Android

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Google API Spreadsheet - Android

Postby kntforever » Mon Nov 08, 2010 8:03 am

Dear Mr. / Ms.

Hope you are well

I am a student who is currently doing an assignment: developing in Android Emulator to use Google Spreadsheet API.

I have a problem for the following source coude...Could you please help?

Android has always appeared "Stop expectedly"..

Or could you please send me an example of Google Spread API in Android therefore I could study.

Many thanks and Best Regards

KIEN

import android.app.Activity;
import android.os.Bundle;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.data.spreadsheet.SpreadsheetEntry;
import com.google.gdata.data.spreadsheet.SpreadsheetFeed;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;

public class Spreadsheet extends Activity {
private TextView test;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

test = (TextView) findViewById(R.id.test);

// Create a new Spreadsheet service
SpreadsheetService myService = new SpreadsheetService("My Application");
try {
myService.setUserCredentials("aaaaa@gmail.com",
"xxxx");

//Email and password are correct - using GMAIL.COM

} catch (AuthenticationException e) {
e.printStackTrace();
}

// Get a list of all entries
URL metafeedUrl = null;
try {
metafeedUrl = new URL(
"http://spreadsheets.google.com/feeds/spreadsheets/private/full");
} catch (MalformedURLException e) {
e.printStackTrace();
}

SpreadsheetFeed resultFeed = null;
try {
resultFeed = myService.getFeed(metafeedUrl, SpreadsheetFeed.class);
} catch (IOException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
}
List<SpreadsheetEntry> entries = resultFeed.getEntries();

String res = "";
test = (TextView) findViewById(R.id.test);
for (int i = 0; i < entries.size(); i++) {
SpreadsheetEntry entry = entries.get(i);

res += entry.getTitle().getPlainText() + "\n";

}

test.setText(res);
Toast.makeText(this, "Total Entries: " + entries.size(), Toast.LENGTH_SHORT).show();
}
}
kntforever
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Nov 08, 2010 7:58 am

Top

Re: Google API Spreadsheet - Android

Postby urvish » Sun Jul 31, 2011 7:47 pm

i have also this problem plz give me solution fast.
urvish
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Jul 30, 2011 4:36 pm

Re: Google API Spreadsheet - Android

Postby techkanika » Mon Aug 08, 2011 2:52 pm

hi kntforever ,

I did R&D regarding gdata API for google spreadsheet usage in our application. For this first of all we need to
register our application. We will get client ID after registeration.

The whole step is described in the following link :

http://code.google.com/apis/spreadsheets/data/3.0/developers_guide.html

and share the error you are getting in logcat when your application crashes.

Kanika
Thanks
Kanika Rakheja
User avatar
techkanika
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Fri May 28, 2010 7:49 am

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests