6 Replies - 481 Views - Last Post: 09 June 2013 - 04:26 PM

#1 XxLegendxX  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 81
  • Joined: 10-April 12

App Widgets ?

Posted 09 June 2013 - 01:32 PM

Hi there, I am trying to make a web browsing app. I have the event listener and event handler functionality inside of a button so right now if you clicked on my app icon on the phone you would then see the button that you would have to click in order to finally get to the internet. I need to know how to make it so that if you just click on the app icon you could go straight to the internet. I tried the android developers website to try to figure out how to turn it into a app widget but I cant understand it and the code didn't work for me. Please help.

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: App Widgets ?

#2 EndLessMind  Icon User is offline

  • Android Expert
  • member icon

Reputation: 272
  • View blog
  • Posts: 1,250
  • Joined: 13-March 09

Re: App Widgets ?

Posted 09 June 2013 - 01:37 PM

Hi.
The only thing your code dose, is opening the webbrower on you phone.
If you want to make your own webbroswer, i suggest you look in to WebView
If you're lazy, just move the code from inside the onclick-method and paste int
in the onCreate-method
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12226
  • View blog
  • Posts: 45,301
  • Joined: 27-December 08

Re: App Widgets ?

Posted 09 June 2013 - 01:54 PM

In the future, please make sure to post your code using code tags rather than an image. It makes it easier for our members to help you if they need to copy the code to test it, etc. Some members also have filters or blocks that make it difficult to properly view images.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12226
  • View blog
  • Posts: 45,301
  • Joined: 27-December 08

Re: App Widgets ?

Posted 09 June 2013 - 01:54 PM

Edit: Database dupe and on my phone. Will delete later.
Was This Post Helpful? 0
  • +
  • -

#5 XxLegendxX  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 81
  • Joined: 10-April 12

Re: App Widgets ?

Posted 09 June 2013 - 01:58 PM

I actually do just want to take the lazy way for right now. I tried moving it to the onCreate() but I doesn't work.?

oh sorry ill try using the code tags next time

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#6 EndLessMind  Icon User is offline

  • Android Expert
  • member icon

Reputation: 272
  • View blog
  • Posts: 1,250
  • Joined: 13-March 09

Re: App Widgets ?

Posted 09 June 2013 - 02:17 PM

What do you mean it don't work?
Dose nothing happen? Dose the app crash?
What dose the logcat tell you?
Was This Post Helpful? 0
  • +
  • -

#7 XxLegendxX  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 81
  • Joined: 10-April 12

Re: App Widgets ?

Posted 09 June 2013 - 04:26 PM

I tried putting it in the onstart() and that worked. What I mean by it didn't work was that when I clicked on the app icon nothing happened it went to a blank screen instead of the website specified.
package com.downs.webbrowser;



import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

	
	}
	// Called after onCreate has finished, use to restore UI state  
		@Override  
		public void onRestoreInstanceState(Bundle savedInstanceState) {    
			super.onRestoreInstanceState(savedInstanceState);    
			// Restore UI state from the savedInstanceState.   
			// This bundle has also been passed to onCreate.  
			// Will only be called if the Activity has been     
			// killed by the system since it was last visible. 
			
		
		}
		
	    // Called before subsequent visible lifetimes  
		// for an Activity process.  
		@Override  
		public void onRestart(){   
			super.onRestart();    
			// Load changes knowing that the Activity has already   
			// been visible within this process.  
			
			
		
		}
		
	    // Called at the start of the visible lifetime.  
		@Override  
		public void onstart(){    
			super.onstart();    
			// Apply any required UI change now that the Activity is visible.  
			
			
			Uri uri = Uri.parse("http://www.google.com");
			 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
			 startActivity(intent);
		
			 
			 
			 
			 
			 
		}
		
	    // Called at the start of the active lifetime.  
		@Override  
		public void onresume(){    
			super.onresume();    
			// Resume any paused UI updates, threads, or processes required    
			// by the Activity but suspended when it was inactive.
		
		
		}

	    // Called to save UI state changes at the  
	    // end of the active life cycle.  
		@Override  
		public void onSaveInstanceState(Bundle savedInstanceState) {   
		
			// Save UI state changes to the savedInstanceState.    
			// This bundle will be passed to onCreate and     
			// onRestoreInstanceState if the process is    
			// killed and restarted by the run time.    
			super.onSaveInstanceState(savedInstanceState);  
			
		
		}

		// Called at the end of the active lifetime.  
		@Override  
		public void onpause(){    
			// Suspend UI updates, threads, or CPU intensive processes    
			// that donít need to be updated when the Activity isnít    
			// the active foreground Activity.    
			super.onpause();  
		
		}
		
		// Called at the end of the visible lifetime. 
		@Override  
		public void onstop(){   
			// Suspend remaining UI updates, threads, or processing    
			// that arenít required when the Activity isnít visible.    
			// Persist all edits or state changes    
			// as after this call the process is likely to be killed.    
			super.onstop();  
		
		
		}
		
		// Sometimes called at the end of the full lifetime.  
		@Override  
		public void onDestroy(){    
			// Clean up any resources including ending threads,    
			// closing database connections etc.    
			super.onDestroy(); 
			
		 
		}
	
	
	

}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1