I am stumped, I get No Activity to handle intent, I have checked the manifest etc. Can someone have a quick look at this and see what I am doing wrong here.
This is my java class
'import com.one2.indoor.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
public class Menu extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageButton tut1 = (ImageButton) findViewById(R.id.activitymain);
tut1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity (new Intent("com.indoor.ActivityMain"));
}
});
}'
This is my ActivityMain class
'import com.one2.indoor.R;
import android.app.Activity;
import android.os.Bundle;
public class ActivityMain extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.tutorial);
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
}'
and finally my manifest
'<activity
android:name="com.indoor.Main"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.indoor.Menu"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="com.indoor.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.indoor.ActivityMain"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="com.indoor.ACTIVITYMAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.indoor.ActivityMain" />
</activity>
</application>
</manifest>
I just cant see it, why I'm getting the error. Any help be much appreciated
The path to your activity in the manifest and your startActivity is possibly incorrect. It should be com.one2.indoor.ActivityMain, or whatever is specified as its package.
Alternatively, I think you can just put .ActivityMain in the manifest for the name, and it will figure out the path automatically.
Finally, try using startActivity(new Intent(YourActivity.this, TargetActivity.class))
Like synergy8 said and you should accept his answer but you need a new intent in the android manifest declared by a new activity.
So to be more clear you should see your manifest have something like this sorry im doing this on a mobilr smart phone
<activity
android:label="#string/app_name"
android:name=".MainActivity" > //your activity name replaces .main activity
<intent-filter >
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
That should do it, if you look at the first activity created there u will see it, just copy and paste it and changr the .main in the intent filter and the .mainactivity that it has in the activity
Basically from what I see and what synergy said you are importing a package that does not exist? Com.indoor.activity , when your package is com.one2.indoor.activity
First, action strings are case-sensitive. "com.indoor.ActivityMain" does not equal "com.indoor.ACTIVITYMAIN".
Second, you probably do not want those extra <intent-filter> elements anyway. Only put an <intent-filter> on an activity if you want third-party apps to invoke that activity directly (e.g., your MAIN/LAUNCHER activity). Otherwise, get rid of the <intent-filter> and use the Intent structure pointed out by Synergy807: startActivity(new Intent(this, ActivityMain.class))
I guess it will be com.one2.indoor.ActivityMain.Also make sure that the names should be exactly same as they are case sensitive.
Related
I recently was studying making an AlarmReminder on youtube by this man's tutorial videos: DelaroyStudios.
Anyway... I followed his tutorial and made it work on a separate app. So next I modified it to the way I want my alarmreminder to be and tried to add it to my activity, however when I click the button routing to its activity launcher, it won't go off. By the way here's the repo: https://github.com/delaroy/AlarmReminder
I tried debugging but I can't see errors, so I really don't know where to start in fixing this part. But I suspect its on the dependencies on the gradle perhaps? or some other factor? Anyway please take a look at my code where I suspect the problem might be coming from.
Here's the manifests:
My Manifest
<application
android:name=".FireApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="com.loginpack.splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.loginpack.LoginActivity" />
<activity android:name=".MainActivity" />
<activity android:name="com.Welcome.Welcome" />
<activity android:name="com.Welcome.CalendarActivity" />
<activity android:name="com.Welcome.Video" />
<activity android:name=".Profile" />
<activity android:name="com.Welcome.Image">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity android:name="com.alarmreminder.MainReminder">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.alarmreminder.AddReminderActivity"
android:label="#string/title_activity_add_reminder"
android:parentActivityName="com.alarmreminder.MainReminder"
android:theme="#style/AppTheme">
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.alarmreminder.MainReminder"
/>
</activity>
<activity android:name="com.Welcome.Info" />
<activity android:name=".Profile2" />
<activity android:name=".Profile3"/>
I checked the code and I suspect nothing except for some deprecated codes that were usually couldn't have affected the overall performance of the activity to the point that it can't even be opened and debugged. Please help me find a way to make this work. or perhaps if you know any method for me to debug activities without any errors showing. Oh and by the way this is what shows in the Verbose when I click on the activity.
Here's the code of the Activity mentioned:
public class MainReminder extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {
private FloatingActionButton mAddReminderButton;
private Toolbar mToolbar;
AlarmCursorAdapter mCursorAdapter;
AlarmReminderDbHelper alarmReminderDbHelper = new AlarmReminderDbHelper(this);
ListView reminderListView;
private static final int VEHICLE_LOADER = 0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mainalarm);
mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
mToolbar.setTitle(R.string.app_name);
reminderListView = findViewById(R.id.list);
View emptyView = findViewById(R.id.empty_view);
reminderListView.setEmptyView(emptyView);
mCursorAdapter = new AlarmCursorAdapter(this, null);
reminderListView.setAdapter(mCursorAdapter);
reminderListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
Intent intent = new Intent(MainReminder.this, AddReminderActivity.class);
Uri currentVehicleUri = ContentUris.withAppendedId(AlarmReminderContract.AlarmReminderEntry.CONTENT_URI, id);
// Set the URI on the data field of the intent
intent.setData(currentVehicleUri);
startActivity(intent);
}
});
mAddReminderButton = findViewById(R.id.fab);
mAddReminderButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), AddReminderActivity.class);
startActivity(intent);
}
});
getLoaderManager().initLoader(VEHICLE_LOADER, null, this);
}
#Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
String[] projection = {
AlarmReminderContract.AlarmReminderEntry._ID,
AlarmReminderContract.AlarmReminderEntry.KEY_TITLE,
AlarmReminderContract.AlarmReminderEntry.KEY_DATE,
AlarmReminderContract.AlarmReminderEntry.KEY_TIME,
AlarmReminderContract.AlarmReminderEntry.KEY_REPEAT,
AlarmReminderContract.AlarmReminderEntry.KEY_REPEAT_NO,
AlarmReminderContract.AlarmReminderEntry.KEY_REPEAT_TYPE,
AlarmReminderContract.AlarmReminderEntry.KEY_ACTIVE
};
return new CursorLoader(this, // Parent activity context
AlarmReminderContract.AlarmReminderEntry.CONTENT_URI, // Provider content URI to query
projection, // Columns to include in the resulting Cursor
null, // No selection clause
null, // No selection arguments
null); // Default sort order
}
#Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
mCursorAdapter.swapCursor(cursor);
}
#Override
public void onLoaderReset(Loader<Cursor> loader) {
mCursorAdapter.swapCursor(null);
}
}
PS: In the my manifest I didn't make it as the main launcher, since its only an activity after all.
When I add
<action android:name="android.intent.action.MAIN" />
in the manifest file, the application starts from the 2nd activity.
If I don't put the action,
<action android:name="android.intent.action.MAIN" />
then the application does not start.
If I remove
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The Gradle gives an error.
"Error running Main2Activity: The activity must be exported or contain an intent-filter"
here is my code for manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.dell_7560.experiment3">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Main2Activity"
android:label="#string/title_activity_main2">
<!--if I remove this, I get an error mentioned above-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
activity 1 file
package com.example.dell_7560.experiment3;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
public class MainActivity extends AppCompatActivity {
LinearLayout ll;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ll=(LinearLayout)findViewById(R.id.ll1);
ll.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent i=new Intent(MainActivity.this,Main2Activity.class);
startActivity(i);
}
});
}
}
activity 2 file
package com.example.dell_7560.experiment3;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
public class Main2Activity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
poupulateListView();
}
public void poupulateListView() {
//get the values from res
Resources res=getResources();
String data_items[]=res.getStringArray(R.array.details);
//build a adapter
ArrayAdapter<String> adapter=new ArrayAdapter<String>
(this,
android.R.layout.simple_list_item_1,//using a default layout
data_items)//elements fed to the adapter
{
#Override
public View getView(int position, View convertView, ViewGroup parent)
{
View view=super.getView(position,convertView,parent);
TextView tv=(TextView)view.findViewById(android.R.id.text1);
tv.setTextColor(getResources().getColor(R.color.occurYellow));
return view;
}
};
//why do we android before R? cause normally we use R.id.something
//configure the adapter
ListView lv=(ListView) findViewById(R.id.list_view_1);
lv.setAdapter(adapter);
}
}
manifest file only add between application tag below line.
<activity android:name=".Main2Activity"
android:label="#string/title_activity_main2"/>
In manifest file only first activity which call on app start that activity add only intent filter other then activity only called above code.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
The intent filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
In the manifests tells the launcher which is the main activity to launch. Those 2 things must be present so it is recognised as an activity to be launch.
If you have 2 activities with this intent filter, and from the first one you remove one of the parameters, its not recognised anymore and the next one matching will be used. In this case, your second activity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This is to indicate that this activity is the activity that android must be start when open the app. You should have one activity with this.
I am trying to setup multiple buttons but I seem to be having trouble doing it. I have 2 onClickListener functions in the same activity. Am I right in doing this or should this be done some other way? btnChpt3 works but when I input the onclicklistener for btnChpt3_1 it force closes as soon as it opens. Thanks.
MainMenu.java
package com.th3ramr0d.learnar670_1;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainMenu extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button chapterThree = (Button) findViewById(R.id.btnChpt3);
chapterThree.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent(MainMenu.this, Chapter3.class));
}
});
Button chapterThree_1 = (Button) findViewById(R.id.btnChpt3_1);
chapterThree_1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent(MainMenu.this, Chapter3_1.class));
}
});
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
}
So I added a new class to handle the buttons on a sub menu page. But now I am running into the same problem I was previously where the button wont open. I am guessing its because the code isnt being ran for some reason.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.th3ramr0d.learnar670_1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainMenu"
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=".SubMenuChapter3"
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=".Chapter3"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.th3ramr0d.learnar670_1.CHAPTER3" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Chapter4"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.th3ramr0d.learnar670_1.CHAPTER4" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
You can see here that my .MainMenu launches. I am guessing that means it launches at startup. So the button works. However, now I want the button associated with .SubMenuChapter3 to launch and it does nothing. Here Program runs with no errors but button wont open you can see I had the same problem until codepg was nice enough to tell me where I was wrong. But I want to use several of these sub menus so how would I do that?
Your problem, after reading, is that you are referencing a button that you have created in another layout which you are not inflating.
In the setContentView(R.layout.activity_main); you are inflating activity_main so you can only have onclick listeners for buttons and elements in that xml.
Make sure that you add btnChpt3 in this xml or if this button is supposed too be in another layout then have another activity or fragment control that layout by inflating it.
Right now this method Button chapterThree = (Button) findViewById(R.id.btnChpt3); is returning a null pointer exception.
I can see from your comments that you are inflating the view activity_main but Button with id bthChpt3_1 is in another file. This is an error as you can use findViewById(R.id.buttonId) to find the id of a button which exists within the view you are using. Since the button is in another xml file, it will throw a null pointer exception.
I have been following the mybringback tutorials on youtube and I tried implementing what I learned. Trying to get a button on my main page to open another page. Finally got the program to run without errors but now when I press the button nothing opens.
Main .xml file where my button is
<Button
android:id="#+id/btnChpt3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="Appearance and Grooming Policies"
android:textSize="18sp"
android:textStyle="bold|italic"
android:gravity="center"
/>
Name of .xml file im trying to get to is chapter3.xml
Menu.java
package com.th3ramr0d.learnar670_1;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Menu extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button chapterThree = (Button) findViewById(R.id.btnChpt3);
chapterThree.setOnClickListener(new View.OnClickListener() {
// #Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("com.th3ramr0d.learnar670_1.CHAPTER3"));
}
});
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
}
And my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.th3ramr0d.learnar670_1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
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=".Menu"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.th3ramr0d.learnar670_1.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".Chapter3"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.th3ramr0d.learnar670_1.CHAPTER3" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
So button ided as btnChpt3 wont open up my .xml file named chapter3.xml. Thanks for the help.
Here is my Chapter3.java
package com.th3ramr0d.learnar670_1;
import android.app.Activity;
import android.os.Bundle;
public class Chapter3 extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.chapter3);
}
}
Here is my MainActivity.java
package com.th3ramr0d.learnar670_1;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#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;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Copy this and paste in your AndroidManifest and try,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.th3ramr0d.learnar670_1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Menu"
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=".Chapter3"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.th3ramr0d.learnar670_1.CHAPTER3" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
To help you understand the problem,
<category android:name="android.intent.category.LAUNCHER" />
The code above in the AndroidManifest defines the activity to be launced when the App Icon is pressed. As per your earlier manifest, it launches the activity MainActivity which also sets it setContentView(R.layout.activity_main); by default as the IDE creates a Hello World program.
So when you launch you app, its MainActivity (that looks the same layout you have designed) which is loading and not Menu activity which you want to load. Hence making few changes in the manifest where we declare the Menu activity as the launcher now launches Menu activity which has the piece of code to process your button click.
I hope this helped!
Actually you can try a more convenient way of starting activities inside your application:
startActivity(new Intent(Menu.this, Chapter3.class))
Also you can read more how it works here:
http://developer.android.com/training/basics/firstapp/starting-activity.html
Good day.
Try replacing the line :
startActivity(new Intent("com.th3ramr0d.learnar670_1.CHAPTER3"));
with the code below :
Intent intent = new Intent(Menu.this, Chapter3.class);
startActivity(intent);
Try reverting your code to the original code, copy your layout activity_main.xml and rename it menu.xml.
now in the layout menu.xml change this line:
android:text="Appearance and Grooming Policies"
to:
android:text="Go to menu"
and the line:
android:id="#+id/btnChpt3"
with:
android:id="#+id/btnMenu"
and replace the line:
setContentView(R.layout.activity_main);
in Menu.java with:
setContentView(R.layout.menu.xml);
finally in MainActivity.java add the following to your oncreate method:
Button btnGoToMenu = (Button) findViewById(R.id.btnMenu);
btnGoToMenu.setOnClickListener(new View.OnClickListener() {
// #Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, Menu.class);
startActivity(intent);
}
});
and re-run the application.
So I am trying to run this app I am using to learn about threads and intents however the app will not run, But I don't have any warning/error underlines in the code, could anyone help me please.
Manifest code:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.learn.tam.Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SPLASH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.learn.tam.StartingPoint"
android:label="#string/app_name" >
</activity>
</application>
</manifest>
and Activity code
package com.example.learn.tam;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try {
sleep(5000);
}
catch (InterruptedException e){
e.printStackTrace();
}
finally{
Intent openStartingPoint = new Intent("com.example.learn.tam.StartingPoint");
startActivity(openStartingPoint);
}
}
};
timer.start();
}
}
any help would be appreciated please
Change
<intent-filter>
<action android:name="android.intent.action.SPLASH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
to
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Since your app is probably not shown on the home screen (the MAIN category is needed).
And also change
Intent openStartingPoint = new Intent("com.example.learn.tam.StartingPoint");
startActivity(openStartingPoint);
to
Intent openStartingPoint = new Intent(Splash.this, StartingPoint.class );
startActivity(openStartingPoint);
Since your StartingPoint does not define an Intent-Action with "com.example.learn.tam.StartingPoint"
See if that fixes anything.
Remove this:
<action android:name="android.intent.action.SPLASH" />
And replace it with this:
<action android:name="android.intent.action.MAIN" />