Error On Startactivity
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up error to startActivity(intent), whats going wrong? up vote 3 down vote favorite Below here in code startActivity(intent) gives me an error Here's my code: public class MyWebViewClient3 extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (Uri.parse(url).getHost().equals("www.facebook.com")) { // This is my web site, so do not override; let my WebView load the page return false; } // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent);//this is where it goes wrong return true; } } android url android-intent webview tabs share|improve this question edited Mar 20 '13 at 5:55 Atrix1987 2,95711632 asked Mar 20 '13 at 5:46 Gaurav 38110 Whats the error bro..? compile time..? Run time exception..? –ngesh Mar 20 '13 at 5:49 tried "http://" its not working... –Gaurav Mar 20 '13 at 5:51 You can't call startActivity from WebViewClient. –SKK Mar 20 '13 at 5:52 @ngesh: The method startActivity(Intent) is undefined for the type MyWebViewClient –Gaurav Mar 20 '13 at 5:52 @santhosh: yeah i tried this in other examples it works bt not for this, i cnt get it why is this happening... –Gaurav Mar 20 '13 at 5:54 add a comment| 1 Answer 1 active oldest votes up vote 8 down vote accepted WebViewClient client is not a context , so you cannot start Activity from here.. You might want to get Context as a reference and then say context.startActivity(intent); After vmironov's suggestion.. @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (Uri.parse(url).getHost().equals("www.facebook.com")) { // This is my web site, so do not override; let my WebView load the page return false; } // Otherwise, the link is not for a page on my site, so launch another Activity that hand
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only http://stackoverflow.com/questions/15516230/error-to-startactivityintent-whats-going-wrong takes a minute: Sign up Error in startActivity up vote 1 down vote favorite 1 I keep getting an error with this source code. Does anyone know what im doing wrong? package com.fttech.da; 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 { /** Called when the activity is first created. */ @Override public void http://stackoverflow.com/questions/6414691/error-in-startactivity onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Intent intent = new Intent(this, DorothyTalk.class); setContentView(R.layout.main_menu); Button talk = (Button)findViewById(R.id.talk); talk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(intent); } }); } } Every time i click the button i get a Force close error. Here is the second activity source code. package com.fttech.da; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class DorothyTalk extends Activity{ private TextView text1; private EditText edit; private Button respond; private String name; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.dorothyDialog); } } android android-activity share|improve this question edited Jun 20 '11 at 16:53 Elenasys 57.5k11164146 asked Jun 20 '11 at 16:51 theITRanger22 114519 what's the error from logcat? –John Boker Jun 20 '11 at 16:54 Please add your AndroidManifest.xml and logs from LogCat with stacktrace. –inazaruk Jun 20 '11 at 16:54 Add your log please. –damluar Jun 20 '11 at 16:56 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted do you have something like
Ragesh Kanagaraj 3,637 Points Unfortunately app stopped Error while starting Intent I tried re creating the https://coderanch.com/t/564621/Android/startActivity-error-Android-graph-view same scenario, created a layout for new Activity. When I start the Intent I am getting a error on series of logs, and in my emulator it says unfortunately app not working. My Logs : Process: com.example.ragesh.mystory, PID: 8743 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.ragesh.mystory/com.example.ragesh.mystory.StoryStart}; have you declared this activity in your AndroidManifest.xml? error on startactivity at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1761) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1485) at android.app.Activity.startActivityForResult(Activity.java:3736) at android.app.Activity.startActivityForResult(Activity.java:3697) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) at android.app.Activity.startActivity(Activity.java:4007) at android.app.Activity.startActivity(Activity.java:3975) at com.example.ragesh.mystory.MainActivity.startStory(MainActivity.java:41) at com.example.ragesh.mystory.MainActivity.access$000(MainActivity.java:15) at com.example.ragesh.mystory.MainActivity$1.onClick(MainActivity.java:31) at android.view.View.performClick(View.java:4756) at android.view.View$PerformClick.run(View.java:19749) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) MyCode : public class MainActivity extends ActionBarActivity { private static final String TAG=MainActivity.class.getSimpleName(); private EditText enterNameWiget; private Button startStoryButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); enterNameWiget=(EditText) findViewById(R.id.idEditText); startStoryButton=(Button) findViewById(R.id.idButton); startStoryButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startStory(); } }); } private void startStory() { Intent intent=new Intent(MainActivity.this,StoryStart.class); startActivity(intent); } } 1 Answer Abdalla Ali 2,921 Points Abdalla Ali A
This Site Careers Other all forums Forum: Android startActivity error for Android graph view bd tuhin Greenhorn Posts: 1 posted 4 years ago hi all, I have a code but it doesn't work ! can you please help me on it? it will show graph in android field. but startActivity doesn't properly !! can anyone help me please ? <<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> int DataCnt = 6; SortedData[][] //This is an 2D array --------------- [[FASTWEB-2012, -66, 0], [FASTWEB-1-001CA2B8E818, -85, 0], [FASTWEB-2012, -66, 5], [FASTWEB-1-001CA2B8E818, -85, 5], [FASTWEB-2012, -66, 10], [FASTWEB-1-001CA2B8E818, -85, 10]] TerminalCount[][] ////This is an 2D array ------------------- [[FASTWEB-2012, 3], [FASTWEB-1-001CA2B8E818, 3]] XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer(); switch (TermDimenSnRow) //suppose I have TermDimenSnRow = 2 { case 1: break; case 2: TimeSeries series2 = new TimeSeries("WiFi 1"); TimeSeries series3 = new TimeSeries("WiFi 2"); for( int i2 = 0; i2 < DataCnt; i2++) { if(TerminalCount[0][0].equals(SortedData[i2][0])) { int WifiRSSIVal = (Integer.parseInt(String.valueOf(SortedData[i2][1]))); int WifiTimeVal = (Integer.parseInt(String.valueOf(SortedData[i2][2]))); series2.add(WifiRSSIVal, WifiTimeVal); } } for( int i3 = 0; i3 < DataCnt; i3++) { if(TerminalCount[1][0].equals(SortedData[i3][0])) { int WifiRSSIVal = (Integer.parseInt(String.valueOf(SortedData[i3][1]))); int WifiTimeVal = (Integer.parseInt(String.valueOf(SortedData[i3][2]))); series3.add(WifiRSSIVal, WifiTimeVal); } } dataset.addSeries(series2); XYSeriesRenderer renderer2 = new XYSeriesRenderer(); mRenderer.addSeriesRenderer(renderer2); dataset.addSeries(series3); XYSeriesRenderer renderer3 = new XYSeriesRenderer(); mRenderer.addSeriesRenderer(renderer3); break; case 3: break; - - - - - case 10: break; Intent intent = ChartFactory.getLineChartIntent(context, dataset, mRenderer, "Graph 1"); this.startActivity(intent); //I have tried here by this (startActivity(intent)) <<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Darryl Burke Bartender Posts: 5148 11 I like... posted 4 years ago bd tuhin, please BeForthrightWhenCrossPostingToOtherSites http://www.javaprogrammingforums.com/whats-wrong-my-code/13472-startactivity-error-android-graph-view.html http://www.java-forums.org/android-examples/54070-startactivity-error-android-graph-view.html Any more? luck, db There are no new questions, but there may be new answers. Darryl Burke Bartender Posts: 5148 11 I like... posted 4 years ago Moved from 'Java in General' luck