1. Are you ready for the Galaxy S20? Here is everything we know so far!

Android app development linking issues.

Discussion in 'Android Development' started by ujjval rathod, Jun 30, 2017.

  1. ujjval rathod

    ujjval rathod Newbie
    Thread Starter

    I am trying to make a Android app in that I have encounter some errors in linking the activities. When I click on plus icon on floating action button it should go to the next activity. but right now the app just stops and doent work the way I want. I am uploading the code if someone can give suggestions. Here is my XML code.

    Code (Text):
    1.  
    2. > <?xml version="1.0" encoding="utf-8"?>
    3. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    4.     xmlns:app="http://schemas.android.com/apk/res-auto"
    5.     xmlns:tools="http://schemas.android.com/tools"
    6.     android:layout_width="match_parent"
    7.     android:layout_height="match_parent">
    8.  
    9.     <android.support.design.widget.FloatingActionButton
    10.         android:id="@+id/floatingActionButton3"
    11.         android:layout_width="match_parent"
    12.         android:layout_height="wrap_content"
    13.  
    14.         android:layout_gravity="bottom|right"
    15.         android:layout_marginBottom="26dp"
    16.         android:layout_marginEnd="22dp"
    17.         android:layout_marginRight="22dp"
    18.         android:clickable="true"
    19.         android:eek:nClick="nextAct"
    20.         app:fabSize="mini"
    21.         app:srcCompat="@android:drawable/ic_input_add"
    22.         android:layout_alignParentBottom="true"
    23.         android:layout_alignParentRight="true"
    24.         android:layout_alignParentEnd="true" />
    25.  
    26.  
    27.     <SearchView
    28.         android:layout_width="wrap_content"
    29.         android:layout_height="wrap_content"
    30.         android:layout_gravity="bottom|right"
    31.         android:background="@color/colorPrimaryDark"
    32.         android:layout_above="@+id/floatingActionButton3"
    33.         android:layout_alignLeft="@+id/floatingActionButton3"
    34.         android:layout_alignStart="@+id/floatingActionButton3"
    35.         android:layout_marginBottom="18dp"
    36.         android:id="@+id/searchView" />
    37.  
    38.     <android.support.design.widget.TextInputLayout
    39.         android:layout_width="match_parent"
    40.         android:layout_height="wrap_content"
    41.         android:layout_alignParentTop="true"
    42.         android:layout_toEndOf="@+id/searchView"
    43.         android:layout_gravity="bottom|right"
    44.         android:gravity="center"
    45.         android:layout_alignLeft="@+id/searchView"
    46.         android:layout_alignStart="@+id/searchView"
    47.         android:id="@+id/textInputLayout3">
    48.  
    49.     </android.support.design.widget.TextInputLayout>
    50.  
    51.     <ImageButton
    52.         android:id="@+id/imageButton"
    53.         android:layout_width="wrap_content"
    54.         android:layout_height="wrap_content"
    55.         android:layout_above="@+id/searchView"
    56.         android:layout_alignLeft="@+id/searchView"
    57.         android:layout_alignStart="@+id/searchView"
    58.         android:layout_marginBottom="13dp"
    59.         android:background="@android:drawable/button_onoff_indicator_on"
    60.         app:srcCompat="@android:drawable/ic_menu_preferences" />
    61. </RelativeLayout>
    62.  


    Here is my JAVA code for the activity. I have created an Intent i to swich from this activity to next one. I have also tried some lines which I have commented as they didn't work.

    Code (Text):
    1.  
    2. > package com.example.ujjval.dateandtimepicker;
    3. import android.app.Activity;
    4. import android.content.Intent;
    5. import android.os.Bundle;
    6. import android.support.design.widget.FloatingActionButton;
    7. import android.view.View;
    8.  
    9. /**
    10.  * Created by UJJVAL on 6/25/2017.
    11.  */
    12.  
    13. public class secondactivity extends Activity{
    14.  
    15.  
    16.     [USER=1021285]@override[/USER]
    17.         // Method to link the JAVA class and Layout.
    18.     protected void onCreate(Bundle savedInstanceState){
    19.  
    20.         super.onCreate(savedInstanceState);
    21.         setContentView(R.layout.secondlayout );
    22.     }
    23.         // Method to call the main dateandtime activity
    24.        // FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.floatingActionButton3);
    25.          //   fab.setOnClickListener(new View.OnClickListener() {
    26.        // [USER=1021285]@override[/USER]
    27.          public void nextAct(View v){
    28.  
    29.         Intent i = new Intent(this, MainActivity.class);
    30.         startActivity(i);
    31.     }
    32.  
    33. }
    34.  
     


    #1 ujjval rathod, Jun 30, 2017
    Last edited by a moderator: Jun 30, 2017

    1. Download the Forums for Android™ app!


      Download

       
  2. Deleted User

    Deleted User Guest

    When you say the app "stops and doesn't work", do you mean it crashes?
    If so, can you post the stack trace from the Logcat output please?
     
  3. ujjval rathod

    ujjval rathod Newbie
    Thread Starter

    Information:Gradle tasks [:app:assembleDebug]
    Error:Content is not allowed in prolog.
    Error:Execution failed for task ':app:buildInfoDebugLoader'.
    > Exception while loading build-info.xml : org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
    at com.android.utils.XmlUtils.parseUtfXmlFile(XmlUtils.java:514)
    at com.android.build.gradle.internal.incremental.InstantRunBuildContext.loadFromXmlFile(InstantRunBuildContext.java:626)
    at com.android.build.gradle.internal.incremental.BuildInfoLoaderTask.executeAction(BuildInfoLoaderTask.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:632)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:615)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
    at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196)
    at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193)
    at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
    at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:50)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:43)
    at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:40)
    at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
    at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
    at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:75)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    Information:BUILD FAILED
    Information:Total time: 4.182 secs
    Information:2 errors
    Information:0 warnings
    Information:See complete output in console
     
  4. Deleted User

    Deleted User Guest

    Looks like a problem with build-info.xml.
    what's in that file?
     
  5. ujjval rathod

    ujjval rathod Newbie
    Thread Starter

    I am not able to find that file..I think that is not there in the project.. Anyways what I think wrong is in the .java file which I have shared.. I have created an onCreate method, is that right? What do you think? The first method over there is to link java and xml and the second method nextAct is onCrete instance in xml like
    android:eek:nClick="nextAct".
     
  6. Deleted User

    Deleted User Guest

    It's not a problem with your code. You have a build configuration issue.
    It may help to see what is in your build.gradle file
     
  7. Deleted User

    Deleted User Guest

    No, forget the above, I can see exactly what your problem is. Your XML layout file has an error

    Remove the leading '>' character from this line.
     
  8. ujjval rathod

    ujjval rathod Newbie
    Thread Starter

    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
    applicationId "com.example.ujjval.dateandtimepicker"
    minSdkVersion 15
    targetSdkVersion 25
    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.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
    }
     
  9. Deleted User

    Deleted User Guest

    See post #7. Correct the problem in your XML layout file.
     
  10. ujjval rathod

    ujjval rathod Newbie
    Thread Starter

    Actually that is not a problem in the actual code I think that was a typing mistake.
    Also, it shows with the red mark if there is error
     
  11. ujjval rathod

    ujjval rathod Newbie
    Thread Starter

    the error was resolved by cleaning the project
     
    Deleted User likes this.
Loading...
Similar Threads - Android app development
  1. Just Foryou
    Replies:
    3
    Views:
    171
  2. mysorian
    Replies:
    0
    Views:
    169
  3. JHolt
    Replies:
    0
    Views:
    707
  4. GamerROMInc
    Replies:
    0
    Views:
    726
  5. lalitkumar110301
    Replies:
    1
    Views:
    1,027
  6. willy macharia
    Replies:
    0
    Views:
    688
  7. Achal Mehra
    Replies:
    0
    Views:
    388
  8. Pauliepaul75
    Replies:
    3
    Views:
    1,164
  9. Janisroze
    Replies:
    1
    Views:
    1,900
  10. Ashbeck Henderson
    Replies:
    1
    Views:
    447

Share This Page

Loading...