depicus

  just another nerd on the interweb…



  • home
  • gallery
  • play page
  • privacy
  • support
  • videos
  • what is depicus

Posts Tagged ‘Java’

Android TextView making clickable url links

Friday, December 9th, 2011



So simple

View Code JAVA
1
2
3
4
5
6
7
8
9
10
11
12
 
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.help);
 
        TextView urlText;
        urlText = (TextView) findViewById(R.id.lblInfo4);
        String text = "Finally if you need more information then please pop over to <a href='http://support.depicus.com'>support.depicus.com</a> or " +
        		"tweet me <a href='http://twitter.com/#!/depicus'>@depicus</a>.";
        urlText.setText(Html.fromHtml(text));
        urlText.setMovementMethod(LinkMovementMethod.getInstance());
	}

And it should look like this

Tags: Clickable, Java, TextView, URL
Posted in Android | Comments Off

Android: Getting the Broadcast Address of your Wifi connection

Sunday, May 1st, 2011



If you ever need to know the broadcast address of your wifi connection…

View Code JAVA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
private InetAddress getBroadcastAddress() throws IOException {
	WifiManager myWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
	DhcpInfo myDhcpInfo = myWifiManager.getDhcpInfo();
	if (myDhcpInfo == null) {
		System.out.println("Could not get broadcast address");
		return null;
	}
	int broadcast = (myDhcpInfo.ipAddress & myDhcpInfo.netmask)
				| ~myDhcpInfo.netmask;
	byte[] quads = new byte[4];
	for (int k = 0; k < 4; k++)
	quads[k] = (byte) ((broadcast >> k * 8) & 0xFF);
	return InetAddress.getByAddress(quads);
}

Tags: Java, Wifi
Posted in Android | Comments Off

Android: Getting the Wifi Ip Address

Sunday, May 1st, 2011



This is how to get the ip address of your Android phone.

View Code JAVA
1
2
3
4
WifiManager myWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo myWifiInfo = myWifiManager.getConnectionInfo();
int ipAddress = myWifiInfo.getIpAddress();
System.out.println("WiFi address is " + android.text.format.Formatter.formatIpAddress(ipAddress));

Make sure you also add

View Code JAVA
1
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

to your Application Manifest.

Tags: Java, Wifi
Posted in Android | 3 Comments »

AS400 iSeries Java program completed with exit code 134

Monday, December 6th, 2010



Having spent a few days stuck on this issue.

FATAL ERROR in native method: Received NULL object reference
java.lang.Throwable
Java program completed with exit code 134

Most of the google hits talked about PTF’s not being up to day. For me the error was the jar file I referenced was not in /QIBM/Userdata/Java400/ext. Stupid rookie mistake I know but the test system had the file from a previous project so I didn’t even check it. I had the CLASSPATH set to a directory where the jar file was but despite this when we went live it didn’t work. I was suitably red faced but at least this may help you avoid the embarrassment,

Tags: AS400, iSeries, Java, Red Face
Posted in Computers, Software Development | Comments Off

  • how i pay the bills

  • depicus in africa

    depicus in africa
  • my charity page

    JustGiving - Sponsor me now!
  • friends

    • Agency Manager
    • AllClear Travel
    • Climbing Tikes
    • Globe Bloggers
    • Marchday
    • The Travel Toad
  • gallery

    Bisley Developments Ltd IMG_3673 IMG_1973 IMG_3879
  • videos

    Vimeo

    YouTube
  • twitter

    • No public Twitter messages.
  • recent comments

    • john coull: correction to above, its www.oakley-ukstore.com
    • john coull: they are at it again. adverts on facebook . they are being hosted by enotch.com on ip address...
    • steve: The site are selling £120+ Oakley sun glasses for £13.00 I think its safe to say they may be either...
    • rob: have received a pair of glasses not what ive ordered they are now telling me the ones ive ordered are out of...
    • phil: hi i have purchased some (stupidly),not arrived yet, will they arrive/will they be fake/plz help

Copyright © - depicus | Entries (RSS) | Comments (RSS)

WordPress theme butchered and amended by me.