aporter / coursera-android-labs Goto Github PK
View Code? Open in Web Editor NEWSkeletons and Tests - Programming Mobile Applications for Android Handheld Systems
License: MIT License
Skeletons and Tests - Programming Mobile Applications for Android Handheld Systems
License: MIT License
I'm try to import the archive, so "Cannot find file"C:\XXXX\XXXX\TheAnswer\settings.jar"
Corrupt pdf file. Cannot open downloaded pdf "Lab1-DevelopmentEnvironment_AndroidStudioUsers.pdf"
File is damaged or wasn't correctly decoded.
In Step 5 of "Lab1-DevelopmentEnvironment_AndroidStudioUsers.pdf" it says
"In this part you'll learn to import a pre-existing application into Eclipse and then run it."
I believe that should say
"In this part you'll learn to import a pre-existing application into Android Studio and then run it."
When i try to lunch the test in Lab4_UILabTest i have this error:
this is my code:
package course.labs.todomanager;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ListView;
import android.widget.RemoteViews;
import android.widget.TextView;
import course.labs.todomanager.ToDoItem.Priority;
import course.labs.todomanager.ToDoItem.Status;
public class ToDoManagerActivity extends ListActivity {
private static final int ADD_TODO_ITEM_REQUEST = 0;
private static final String FILE_NAME = "TodoManagerActivityData.txt";
private static final String TAG = "Lab-UserInterface";
// IDs for menu items
private static final int MENU_DELETE = Menu.FIRST;
private static final int MENU_DUMP = Menu.FIRST + 1;
ToDoListAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create a new TodoListAdapter for this ListActivity's ListView
mAdapter = new ToDoListAdapter(getApplicationContext());
// Put divider between ToDoItems and FooterView
getListView().setFooterDividersEnabled(true);
// TODO - Inflate footerView for footer_view.xml file
TextView footerView = (TextView) getLayoutInflater().inflate(R.layout.footer_view, null);
// NOTE: You can remove this block once you've implemented the assignment
// TODO - Add footerView to ListView
getListView().addFooterView(footerView);
// TODO - Attach Listener to FooterView
footerView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//TODO - Attach Listener to FooterView. Implement onClick().
Intent startNewActivity = new Intent(ToDoManagerActivity.this, AddToDoActivity.class);
startActivityForResult(startNewActivity, ADD_TODO_ITEM_REQUEST);
//TODO - Implement OnClick().
}
});
// TODO - Attach the adapter to this ListActivity's ListView
//si occupa di gestire la visualizazzione grafica di set di dati, come le liste.
setListAdapter(mAdapter);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i(TAG,"Entered onActivityResult()");
// TODO - Check result code and request code
// if user submitted a new ToDoItem
// Create a new ToDoItem from the data Intent
// and then add it to the adapter
ToDoItem td = null;
if(resultCode == RESULT_OK && requestCode == ADD_TODO_ITEM_REQUEST){
Date d = null;
try {
d = ToDoItem.FORMAT.parse(data.getStringExtra("date"));
} catch (ParseException e) {
e.printStackTrace();
}
td = new ToDoItem( data.getStringExtra("title") ,Priority.valueOf(data.getStringExtra("priority")), Status.valueOf(data.getStringExtra("status")), d);
mAdapter.add(td);
}
}
// Do not modify below here
@Override
public void onResume() {
super.onResume();
// Load saved ToDoItems, if necessary
if (mAdapter.getCount() == 0)
loadItems();
}
@Override
protected void onPause() {
super.onPause();
// Save ToDoItems
saveItems();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(Menu.NONE, MENU_DELETE, Menu.NONE, "Delete all");
menu.add(Menu.NONE, MENU_DUMP, Menu.NONE, "Dump to log");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_DELETE:
mAdapter.clear();
return true;
case MENU_DUMP:
dump();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void dump() {
for (int i = 0; i < mAdapter.getCount(); i++) {
String data = ((ToDoItem) mAdapter.getItem(i)).toLog();
Log.i(TAG, "Item " + i + ": " + data.replace(ToDoItem.ITEM_SEP, ","));
}
}
// Load stored ToDoItems
private void loadItems() {
BufferedReader reader = null;
try {
FileInputStream fis = openFileInput(FILE_NAME);
reader = new BufferedReader(new InputStreamReader(fis));
String title = null;
String priority = null;
String status = null;
Date date = null;
while (null != (title = reader.readLine())) {
priority = reader.readLine();
status = reader.readLine();
date = ToDoItem.FORMAT.parse(reader.readLine());
mAdapter.add(new ToDoItem(title, Priority.valueOf(priority),
Status.valueOf(status), date));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
} finally {
if (null != reader) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
// Save ToDoItems to file
private void saveItems() {
PrintWriter writer = null;
try {
FileOutputStream fos = openFileOutput(FILE_NAME, MODE_PRIVATE);
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
fos)));
for (int idx = 0; idx < mAdapter.getCount(); idx++) {
writer.println(mAdapter.getItem(idx));
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != writer) {
writer.close();
}
}
}
}
and this is the line of the test that give me the error;
public Test1_SubmitTest() { super(ToDoManagerActivity.class); }
The ActivityClass Lab 2 Application works well, but the tests don't run. I get the following error:
Warning:Dependency Lab2_ActivityLabTest:Lab2_ActivityLab:unspecified on project Lab2_ActivityLabTest resolves to an APK archive which is not supported as a compilation dependency. File: /Users/frank/AndroidStudioProjects/Lab2_ActivityLabTest/Lab2_ActivityLab/build/outputs/apk/Lab2_ActivityLab-release-unsigned.apk
Is it possible to get the project working on Android Studio, or do I have to install Eclipse? Where are the Gradle build-files?
hi i am not able to import the lab3 files.
any help please
Failed to import Week-2 Test Projects to Android Studio completely. Please let me know the procedures to import those projects.
My Android Studio version: 3.1.2
Build #AI-173.4720617, built on April 14, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.3
Gradle version: 4.4.1
Android Plugin version: 3.1.2
Please, help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.