Here is my SRC code for a Go Launcher EX theme im building and having
a runtime error when opening the application. in Eclipse i see no
error at all, the source code is supposed to determine if go laucher
is installed and open it or if not sent intent to market to download
and if no market intent to browser to download the direct apk.
In my Developer Console under errors for my app here is what its
saying
Crash
Exception class java.lang.ClassNotFoundException
--------------------------------------------------------------------------------
Source method PathClassLoader.findClass()
*More Info*
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.jaisonbrooks.golauncher/
com.jaisonbrooks.golauncher.golauncher.template}:
java.lang.ClassNotFoundException:
com.jaisonbrooks.golauncher.golauncher.template in loader
dalvik.system.PathClassLoader[/data/app/
com.jaisonbrooks.golauncher-1.apk]
*Source Code*
package com.jaisonbrooks.golauncher;
import com.jaisonbrooks.golauncher.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
public class template extends Activity {
/** Called when the activity is first created. */
class CustomAlertDialog extends AlertDialog {
public CustomAlertDialog(Context context) {
super(context);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
boolean ret = super.onKeyDown(keyCode, event);
finish();
return ret;
}
}
private CustomAlertDialog mDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
if (isExistSkin("com.gau.go.launcherex")) {
startGOLauncher("com.gau.go.launcherex");
finish();
return;
}
mDialog = new CustomAlertDialog(this);
mDialog.setTitle(R.string.dialogtitle);
mDialog.setMessage(getResources().getString(R.string.dialogcontent));
mDialog.setButton(DialogInterface.BUTTON_POSITIVE,
getResources().getString(R.string.dialogok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String marketuriString = "market://search?
q=pname:com.gau.go.launcherex";
Intent EMarketintent = new Intent(Intent.ACTION_VIEW,
Uri.parse(marketuriString));
EMarketintent.setPackage("com.android.vending");
EMarketintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(marketuriString));
try {
startActivity(EMarketintent);
} catch (ActivityNotFoundException e) {
String link = "http://61.145.124.93/soft/3GHeart/
com.gau.go.launcherex.apk";
Uri browserUri = Uri.parse(link);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, browserUri);
browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(browserIntent);
} catch (ActivityNotFoundException e2) {
// TODO: handle exception
e2.printStackTrace();
}
} catch (Exception e3) {
// TODO: handle exception
e3.printStackTrace();
}
finish();
}
});
mDialog.show();
}
@Override
protected void onDestroy() {
super.onDestroy();
android.os.Process.killProcess(android.os.Process.myPid());
}
private boolean isExistSkin(String packageName) {
try {
createPackageContext(packageName,
Context.CONTEXT_IGNORE_SECURITY);
} catch (NameNotFoundException e) {
return false;
}
return true;
}
private void startGOLauncher(String packageName){
PackageManager packageMgr = this.getPackageManager();
Intent launchIntent =
packageMgr.getLaunchIntentForPackage(packageName);
if (null != launchIntent){
try
{
this.startActivity(launchIntent);
}
catch(ActivityNotFoundException e)
{
}
}
}
}
If any body could help me find a solution for the error message that
would really awesome. Im still working on learning the in's and out to
java.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en