GithubHelp home page GithubHelp logo

android_me's Introduction

Android_Me

App that lets you style your own Android! This uses Fragments to create a flexible and responsive UI.

This is a exercise repository for the AndroidMe example app which is part of the Advanced Android App Development course on Udacity.

How to use this repo while taking the course

Each code repository in this class has a chain of commits that looks like this:

listofcommits

These commits show every step you'll take to create the app. They include Exercise commits and Solution commits.

Exercise commits contain instructions for completing the exercise, while solution commits show the completed exercise. You can tell what a commit is by looking at its commit message.

For example, TFCM.01-Exercise-AddGradleDependencies is the first code step in the Firebase Cloud Messaging (FCM) lesson. This is the exercise commit, and the exercise is called Add Gradle Dependencies.

Each commit also has a branch associated with it of the same name as the commit message, seen below:

branches Access all branches from this tab

listofbranches

branchesdropdown

The branches are also accessible from the drop-down in the "Code" tab

Working with the Course Code

Here are the basic steps for working with and completing exercises in the repo. This information is linked whenever you start a new exercise project, so don't feel you need to memorize all of this! In fact, skim it now, make sure that you know generally how to do the different tasks, and then come back when you start your first exercise.

The basic steps are:

  1. Clone the repo
  2. Checkout the exercise branch
  3. Find and complete the TODOs
  4. Optionally commit your code changes
  5. Compare with the solution

Step 1: Clone the repo

As you go through the course, you'll be instructed to clone the different exercise repositories, so you don't need to set these up now. You can clone a repository from github in a folder of your choice with the command:

git clone https://github.com/udacity/REPOSITORY_NAME.git

Step 2: Checkout the exercise branch

As you do different exercises in the code, you'll be told which exercise you're on, as seen below: exerciseexample

To complete an exercise, you'll want to check out the branch associated with that exercise. For the exercise above, the command to check out that branch would be:

git checkout TFCM.01-Exercise-AddGradleDependencies

Step 3: Find and complete the TODOs

This branch should always have Exercise in the title. Once you've checked out the branch, you'll have the code in the exact state you need. You'll even have TODOs, which are special comments that tell you all the steps you need to complete the exercise. You can easily navigate to all the TODOs using Android Studio's TODO tool. To open the TODO tool, click the button at the bottom of the screen that says TODO. This will display a list of all comments with TODO in the project.

We've numbered the TODO steps so you can do them in order: todos

Step 4: Optionally commit your code changes

After You've completed the TODOs, you can optionally commit your changes. This will allow you to see the code you wrote whenever you return to the branch. The following git code will add and save all your changes.

git add .
git commit -m "Your commit message"

Step 5: Compare with the solution

Most exercises will have a list of steps for you to check off in the classroom. Once you've checked these off, you'll see a pop up window with a link to the solution code. Note the Diff link:

solutionwindow

The Diff link will take you to a Github diff as seen below: diff

All of the code that was added in the solution is in green, and the removed code (which will usually be the TODO comments) is in red.

Report Issues

Notice any issues with a repository? Please file a github issue in the repository.

Archival Note

This repository is deprecated; therefore, we are going to archive it. However, learners will be able to fork it to their personal Github account but cannot submit PRs to this repository. If you have any issues or suggestions to make, feel free to:

android_me's People

Contributors

sudkul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android_me's Issues

GridView causes OutOfMemory Exception

When trying to run app on gennymotion emulator I got outOfMemoryError and app crashes. (all branches from TFragments.04-Solution-CreateMasterListFragment up)

Sync Issues

After cloning the repo, android studio attempted to sync the project and failed. This is the error message I got.

Caused by: java.lang.IllegalStateException: Failed to find target with hash string 'android-25' in: C:\Users\Willi\AppData\Local\Android\Sdk

classpath

I have this error for sync of this app :(

Could not find com.android.tools.build:gradle:3.2.1.  

I 've updated my android studio and upgraded the classpath to 3.2.1
what should I do for this issue?

Why scaleType for FrameLayout?

In the file named activity_android_me at the line number 37 you have used android:scaleType="centerInside" , I can't add inside mine?

Is this code out of date?...

I downloaded all the necessary plugins and tools that the sdk said were missing, but I'm still getting these error messages.

ERROR: Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
ERROR: Failed to resolve: com.android.support:appcompat-v7:25.1.0

And I haven't even touched the code yet... This is straight out of the box...

I'm missing the drawable folder

I'm trying to follow along with the online app development class but I'm constantly being hit

with rode blocks like the drawable folder being missing, errors in the code straight out of the box,
missing images, and the fact that the file structure doesn't really match the video because of the fact
that some of them are missing...

This caused me to reach a conclusion... Either someone needs to update the videos or update the

videos and the code so it all works properly and is compatible with todays version of Java, Android
Studio, Android SDK, etc...

TFragments.00-Startingcode

i tried to commit a change in a comment area. After commit when i tried to push it shows error failed . also when i want to pull how can i work it out for my next exercise in android studio. I am a new user

Gradle Issue

I am using the latest version of Android Studio and for some reason, it shows me errors on the build.gradle file right when I import it.
The First error is on the targetSdkVersion which is by default 25. The error says Google Play requires it to be 26 or higher (so I changed this to 26)
The second error is with the android support library. When I fix it and sync the gradle file, I get this error:
ERROR: Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app

This is the code for my build.gradle file currently:
`apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.android.android_me"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
`

fragment issue (out of course content)

I have an app , I tried to apply what I learned recently , I already created and displayed a fragment in my main activity , my issue as following :
I have implemented Button in my fragment layout
I want to make use of this button to close fragment ,
I already tried to use interface to establish the communication between fragment and its host activity , But an error raised , and I don't know why , anyone can help please ?
1
2
3

app crashed after adding three fragments

app is working fine till 2 fragments but get crashed after i add three fragments
android.support.v7.widget.AppCompatImageView cannot be cast to android.view.ViewGroup
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957)

Failed to crunch files

Error:Failed to crunch file C:\Users\hp\Downloads\Android_Me-TFragments.00-StartingCode\Android_Me-TFragments.00-StartingCode\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\25.1.0\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png into C:\Users\hp\Downloads\Android_Me-TFragments.00-StartingCode\Android_Me-TFragments.00-StartingCode\app\build\intermediates\res\merged\debug\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png

Can't change container ID of fragment BodyPartFragment

When trying to launch the solution for the exercise DisplayThreeFragments app crashes with the error:
Caused by: java.lang.IllegalStateException: Can't change container ID of fragment BodyPartFragment{302569e id=0x7f0b0058}: was 2131427416 now 2131427417
on the emulator Nexus 5 API 24

However, if I add fragmentManager.executePendingTransactions() after each transaction - it works.

App crashes after implementing button in fragment_master_list.xml

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.android_me, PID: 11756
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.android_me/com.example.android.android_me.ui.MainActivity}: android.view.InflateException: Binary XML file line #2: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.view.InflateException: Binary XML file line #2: The specified child already has a parent. You must call removeView() on the child's parent first.
Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:5034)
at android.view.ViewGroup.addView(ViewGroup.java:4865)
at android.view.ViewGroup.addView(ViewGroup.java:4837)
at android.view.LayoutInflater.inflate(LayoutInflater.java:524)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.android.android_me.ui.MainActivity.onCreate(MainActivity.java:21)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process: Sending signal. PID: 11756 SIG: 9
Application terminated.

Out of Memory exception

Hi when i run this app on my device ,On scrolling the MasterListview i got the out of memory exception.
This is maybe because of
http://stackoverflow.com/questions/22043232/out-of-memory-exception-with-custom-gridview
/*
You are attempting to allocate too much memory for image data. As you explained in the comments, your images are fairly large and they are being read as soon as the adapter is created.

Reading this into memory will consume 4 bytes per pixel, so if your images are 1024 pixels square, the math is:

1024 × 1024 × 4 = 4MB
15 images × 4 MB/image = 60MB

This likely exceeds the heap budget of 48MB */

Application crash after scrolling.

You should load images with some image library eg. Glide. Activity cannot handle all the images resources while loading with setResources.
It result in application crash with some memory issue.

cannot run the project

all projects gave me the same error

Launching 'app' on Pixel 2 API 24.
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant: debug

Could not find com.android.support:appcompat-v7:25.1.0

I'm getting this error in Android_Me-TFragments.02-Solution-DisplayThreeFragments:

Could not find com.android.support:appcompat-v7:25.1.0

I tried to run the solution because it wouldn't work in the exercise code in the first place.

Please fix this!

Issue in cloning

When i clone the project i mean copy the link and clone in android studio its not load the exact branch for example if i load 00 exercise it just give me starter code
How can i solve this issue because i want to do all exercises without waste my time doing from start all code.
Thanks in Advance

Creating Intent every time the user selects a body part.

It seems to me that creating the intent each time a body part is clicked is much more expensive than holding onto the selected positions and creating the intent when the user clicks next. This can be accomplished by simply moving the Intent creation logic to the onClick even for the next button.

Repo not what is used in Advanced COurse?

This repo doesn't seem to have any of the same structure that is being used in the Advanced Android Course that refers to this repo? I don't see any drawables, or any of the starter code mentioned in the course for the Android_Me project. Am I missing something?

Gradle issue.

I am using the latest version of Android Studio and for some reason, it shows me errors on the build.gradle file right when I import it.
The First error is on the targetSdkVersion which is by default 25. The error says Google Play requires it to be 26 or higher (so I changed this to 26)
The second error is with the android support library. When I fix it and sync the gradle file, I get this error:
ERROR: Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app

This is the code for my build.gradle file currently:
`apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.android.android_me"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
`

NPE on GridView

How is it possible to call
GridView gridView = (GridView) findViewById(R.id.images_grid_view);
gridView.setNumColumns(2);

Always give Null Pointer Exception in my code?

Build fails with android studio

I am trying to build this with android studio 4.2.1 on macOS Catalina, but it fails with following error.

Unable to find method 'com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V'
com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Tried stopping gradle process, didn't help.

JDK: jdk1.8.0_202.jdk
Android gradle plugin version: 2.2.3
Gradle version: 4.8.1

Any suggestions ?

Shows Null pointer exception

FATAL EXCEPTION: main
Process: com.example.android.android_me, PID: 7719
java.lang.NullPointerException: Attempt to invoke interface method 'void com.example.android.android_me.ui.MasterListFragment$OnImageClickListener.onImageSelected(int)' on a null object reference at com.example.android.android_me.ui.MasterListFragment$1.onItemClick(MasterListFragment.java:74)

Link for Diff Code for Exercise.05 comes up empty

problem: the link for Exercise.05 diff tries to compare branches exercise.04 with exercise.05 solutions.
solution: just need to change the link to compare branches exercise.05 with exercise.05 solutions.

OnClickListener NextButton

The onClickListener() for the Next button should've been set in the onCreate() method in order to have access to it even if the user doesn't click on any item from the list since it can display the default values for the headIndex,bodyIndex and legIndex.

Solution:

  • declare intent as global variable to have access to it and use this variable in the onImageSelected() method.
  • set the onClickListener for the Next button in the onCreate() method
  • set the logic for the Extras(Bundle) also in onClick() method and start the AndroidMeActivity

Replacing Fragment when a simple update would accomplish the same

In the 2pane view, the video and solution show replacing the fragment for each body part when a new item is selected. This seems overly complex, and does not convey anything about communicating back into that fragment. A much easier option would be to make the imageview held in a class variable and update its resource when the Index is updated.

Exercise 4 - Master List Fragment

Exercise 4 does not line up at all with the material. TODOs for creating files but no indication of the dependencies between them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.