android Intent.ACTION_VIEW crash when call market URL - android

I want to create a feedback field for my application. I just want redirect the user to the market like this
String APP_MARKET_URL = "market://details?id=com.my.application";
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse(APP_MARKET_URL));
this.startActivity(intent);
But when i execute it i have this error:
02-13 11:07:33.147: W/dalvikvm(238): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
02-13 11:07:33.155: E/AndroidRuntime(238): Uncaught handler: thread main exiting due to uncaught exception
02-13 11:07:33.225: E/AndroidRuntime(238): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.picca.pointage.NoterApplication }
02-13 11:07:33.225: E/AndroidRuntime(238): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.app.Activity.startActivityForResult(Activity.java:2749)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.app.Activity.startActivity(Activity.java:2855)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.preference.Preference.performClick(Preference.java:829)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:190)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.widget.ListView.performItemClick(ListView.java:3285)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1640)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.os.Handler.handleCallback(Handler.java:587)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.os.Handler.dispatchMessage(Handler.java:92)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.os.Looper.loop(Looper.java:123)
02-13 11:07:33.225: E/AndroidRuntime(238): at android.app.ActivityThread.main(ActivityThread.java:4363)
02-13 11:07:33.225: E/AndroidRuntime(238): at java.lang.reflect.Method.invokeNative(Native Method)
02-13 11:07:33.225: E/AndroidRuntime(238): at java.lang.reflect.Method.invoke(Method.java:521)
02-13 11:07:33.225: E/AndroidRuntime(238): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-13 11:07:33.225: E/AndroidRuntime(238): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-13 11:07:33.225: E/AndroidRuntime(238): at dalvik.system.NativeStart.main(Native Method)
I use android 1.5. I did not put specific entry in the manifest.
Anyone have an idea or an other method for call my market page?

Expanding on a previous comment, you can check if the Intent can be resolved on the device before starting a new Activity with it using code like this:
PackageManager pm = context.getPackageManager();
ComponentName cn = intent.resolveActivity(pm);
if (cn != null) {
this.startActivity(intent);
}

Try adding the following flat to your intent.
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

If you're running this code on the emulator, you should know that there is no Android Market application on the emulator, so it will throw you this exception. There should be no problem on most of the real devices. Hope this helps.

Related

Android apk downloaded from GooglePlay crashes after update in Firmware 4.1.1

I have a game in Google Play. It have been working fine in the previous 3 updates. But in the 4th after you download and install the update the game crashes only in Android 4.1.1 devices.
It happens because somehow GooglePlay installed incorrectly the application and the native library is not correctly set up.
Reading some Google forms I believe this is know problem of that android firmware. I already worked around that by saving the native library in the res files and coping it to /data/data/com.minix.android.Game/files and loading it from there. Yet the players lost all of their progress, like if the corrupt installation clears the game data.
02-28 15:40:49.050: W/dalvikvm(23159): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/minix/android/Game;
02-28 15:40:49.050: W/dalvikvm(23159): Class init failed in newInstance call (Lcom/minix/android/Game;)
02-28 15:40:49.050: D/AndroidRuntime(23159): Shutting down VM
02-28 15:40:49.050: W/dalvikvm(23159): threadid=1: thread exiting with uncaught exception (group=0x410382a0)
02-28 15:40:49.050: D/KeyguardViewMediator(2465): setHidden false
02-28 15:40:49.050: D/WindowManager(2465): mInputFocus is not null.
02-28 15:40:49.050: D/WindowManager(2465): mInputFocus is not null.
02-28 15:40:49.050: E/AndroidRuntime(23159): FATAL EXCEPTION: main
02-28 15:40:49.050: E/AndroidRuntime(23159): java.lang.ExceptionInInitializerError
02-28 15:40:49.050: E/AndroidRuntime(23159): at java.lang.Class.newInstanceImpl(Native Method)
02-28 15:40:49.050: E/AndroidRuntime(23159): at java.lang.Class.newInstance(Class.java:1319)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.app.ActivityThread.access$600(ActivityThread.java:140)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.os.Handler.dispatchMessage(Handler.java:99)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.os.Looper.loop(Looper.java:137)
02-28 15:40:49.050: E/AndroidRuntime(23159): at android.app.ActivityThread.main(ActivityThread.java:4898)
02-28 15:40:49.050: E/AndroidRuntime(23159): at java.lang.reflect.Method.invokeNative(Native Method)
02-28 15:40:49.050: E/AndroidRuntime(23159): at java.lang.reflect.Method.invoke(Method.java:511)
02-28 15:40:49.050: E/AndroidRuntime(23159): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
02-28 15:40:49.050: E/AndroidRuntime(23159): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
02-28 15:40:49.050: E/AndroidRuntime(23159): at dalvik.system.NativeStart.main(Native Method)
02-28 15:40:49.050: E/AndroidRuntime(23159): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load minix: findLibrary returned null
02-28 15:40:49.050: E/AndroidRuntime(23159): at java.lang.Runtime.loadLibrary(Runtime.java:365)
02-28 15:40:49.050: E/AndroidRuntime(23159): at java.lang.System.loadLibrary(System.java:535)
02-28 15:40:49.050: E/AndroidRuntime(23159): at com.minix.android.Game.GameActivity <clinit>(Unknown Source)
02-28 15:40:49.050: E/AndroidRuntime(23159): ... 15 more
Several reasons that might cause this:
You don't have this in your code:
static {
System.loadLibrary("mylibraryname");
}
You changed your package name in the code or in the package itself and they don't match.
You use an expired or invalid signature to sign your app.

App crash running OpenCV apps in Android Emulator

I'm trying to use some emulators to run my apps for debugging. This app runs perfectly on my phone, but when I load it up into the emulator it crashes whenever I invoke an opencv function. The emulator is using the intel atom x86 cpu. Do I have to run them with the arm7?
Stack trace:
02-13 04:25:51.986: E/AndroidRuntime(2006): FATAL EXCEPTION: main
02-13 04:25:51.986: E/AndroidRuntime(2006): java.lang.ExceptionInInitializerError
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.uas.Processor.extract(Processor.java:48)
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.uas.ImageProcessorActivity.onMenuItemClick(ImageProcessorActivity.java:626)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.widget.PopupMenu.onMenuItemSelected(PopupMenu.java:142)
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:156)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.widget.AbsListView$1.run(AbsListView.java:3423)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.os.Handler.handleCallback(Handler.java:725)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.os.Handler.dispatchMessage(Handler.java:92)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.os.Looper.loop(Looper.java:137)
02-13 04:25:51.986: E/AndroidRuntime(2006): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-13 04:25:51.986: E/AndroidRuntime(2006): at java.lang.reflect.Method.invokeNative(Native Method)
02-13 04:25:51.986: E/AndroidRuntime(2006): at java.lang.reflect.Method.invoke(Method.java:511)
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-13 04:25:51.986: E/AndroidRuntime(2006): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-13 04:25:51.986: E/AndroidRuntime(2006): at dalvik.system.NativeStart.main(Native Method)
02-13 04:25:51.986: E/AndroidRuntime(2006): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.uas-1.apk,libraryPath=/data/app-lib/com.uas-1]: findLibrary returned null
02-13 04:25:51.986: E/AndroidRuntime(2006): at java.lang.Runtime.loadLibrary(Runtime.java:365)
02-13 04:25:51.986: E/AndroidRuntime(2006): at java.lang.System.loadLibrary(System.java:535)
02-13 04:25:51.986: E/AndroidRuntime(2006): at org.opencv.core.Mat.<clinit>(Mat.java:2065)
02-13 04:25:51.986: E/AndroidRuntime(2006): ... 20 more

How to track down an error in an Android app?

I have recently put an app on google play and some people have reported errors. I have never had an error with this app and I dont know what is causing it. This is the error that it says:
android.content.ActivityNotFoundException: No Activity found to handle Intent {act=android.intent.action.VIEW dat=http://a47.video2.blip.tv/12990004359402/RoosterTeeth-RedVsBlueEpisode1933.flv?brs=1011&bri=1.4 typ=video/flv }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
at android.app.Activity.startActivityForResult(Activity.java:2817)
at android.app.Activity.startActivity(Activity.java:2923)
at red.vs.blue.videos.SeasonOneListView.onListItemClick(SeasonOneListView.java:157)
at android.app.ListActivity$2.onItemClick(ListActivity.java:321)
at android.widget.AdapterView.performItemClick(AdapterView.java:284)
at android.widget.ListView.performItemClick(ListView.java:3382)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
I would really like some help. I am a noob so if there is more info you need about this problem to help me feel free to ask.
Most likely some users don't have a native video player in their phone.
Weird, but possible.
Yes. Your users with the errors probably don't have a video player installed than can handle a URL with the file type of video/flv.

Sqliteexception while updating timestamp?

I have this code:
String sql="UPDATE LAST_OPEN SET LAST_OPEN="+DATE+" WHERE STUDENT_ID ="+STUDENT_ID+" AND ITEM_ID="+ITEM_ID+" AND ITEM_NAME="+ITEM_TYPE+";";
db.execSQL(sql);
Where LAST_OPEN field is timestamp.I tried to run the same query in SQlite Browser it was working fine.But when this Sql is executed in app it shows this:
02-13 13:12:39.468: E/AndroidRuntime(2366): FATAL EXCEPTION: main
02-13 13:12:39.468: E/AndroidRuntime(2366): android.database.sqlite.SQLiteException: near "13": syntax error: UPDATE LAST_OPEN SET LAST_OPEN=2012-02-13 13:12:39 WHERE STUDENT_ID =5 AND ITEM_ID=1 AND ITEM_NAME=Activity;
02-13 13:12:39.468: E/AndroidRuntime(2366): at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
-13 13:12:39.468: E/AndroidRuntime(2366): at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1727)
02-13 13:12:39.468: E/AndroidRuntime(2366): at com.cuelearn.databases.last_open.update(last_open.java:205)
02-13 13:12:39.468: E/AndroidRuntime(2366): at com.cuelearn.main.threeshelf$1.onClick(threeshelf.java:197)
02-13 13:12:39.468: E/AndroidRuntime(2366): at android.view.View.performClick(View.java:2408)
02-13 13:12:39.468: E/AndroidRuntime(2366): at android.view.View$PerformClick.run(View.java:8816)
02-13 13:12:39.468: E/AndroidRuntime(2366): at android.os.Handler.handleCallback(Handler.java:587)
02-13 13:12:39.468: E/AndroidRuntime(2366): at android.os.Handler.dispatchMessage(Handler.java:92)
02-13 13:12:39.468: E/AndroidRuntime(2366): at android.os.Looper.loop(Looper.java:123)
02-13 13:12:39.468: E/AndroidRuntime(2366): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-13 13:12:39.468: E/AndroidRuntime(2366): at java.lang.reflect.Method.invokeNative(Native Method)
02-13 13:12:39.468: E/AndroidRuntime(2366): at java.lang.reflect.Method.invoke(Method.java:521)
02-13 13:12:39.468: E/AndroidRuntime(2366): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-13 13:12:39.468: E/AndroidRuntime(2366): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
Can anyone tell where I am getting wrong?
Try with this sql statement :
String sql="UPDATE LAST_OPEN SET LAST_OPEN='"+DATE+"' WHERE STUDENT_ID ="+STUDENT_ID+" AND ITEM_ID="+ITEM_ID+" AND ITEM_NAME="+ITEM_TYPE+";";
as I know, when you are using any string data in sql statement you need to add '' in the beginning of the variable and at the end of it.
Try to change
LAST_OPEN=2012-02-13 13:12:39
with
LAST_OPEN = "2012-02-13 13:12:39"
The space between the numbers can be the problem. Hope this helps.

Null pointer exception when trying to access an object's atribute passed from another activity in android

I'm passing an object from activity to another. Then from that activity to another one.
When I try to access an attribute of the passed object from the 3rd activity, i get a null pointer exception.
I've set the attribute also. So i don't understand the reason for it.
Code from the first activity:
private Task t;
public void onClick(View v) {
if(v == this.btnAdd){
this.addItem(this.txtTask.getText().toString());
this.addTask(this.txtTask.getText().toString());
}
}
private void addTask(String taskName){
if(taskName.length()>0){
t = new Task(taskName);
this.tasks.add(t);
}
}
public void onItemClick(AdapterView<?> parent, View view, int position,
long id3) {
Intent myIntent = new Intent(getApplicationContext(), TabSwitch.class);
myIntent.putExtra("taskItem", t);
startActivity(myIntent);
}
});
From the second activity:
private TextView selectedTask;
Intent i=getIntent();
Task taskItem = (Task) i.getSerializableExtra("taskItem");
i = new Intent().setClass(this, Info.class);
i.putExtra("taskItem", taskItem);
From the 3rd activity:
Intent i=getIntent();
Task task =(Task) i.getSerializableExtra("taskItem");
selectedTask.setText(task.getTaskName());
Here is the log:
02-13 22:03:02.868: E/AndroidRuntime(572): FATAL EXCEPTION: main
02-13 22:03:02.868: E/AndroidRuntime(572): java.lang.RuntimeException: Unable to start activity ComponentInfo{sam.todo.OnTime/sam.todo.OnTime.TabSwitch}: java.lang.RuntimeException: Unable to start activity ComponentInfo{sam.todo.OnTime/sam.todo.OnTime.Info}: java.lang.NullPointerException
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.os.Handler.dispatchMessage(Handler.java:99)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.os.Looper.loop(Looper.java:123)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-13 22:03:02.868: E/AndroidRuntime(572): at java.lang.reflect.Method.invokeNative(Native Method)
02-13 22:03:02.868: E/AndroidRuntime(572): at java.lang.reflect.Method.invoke(Method.java:507)
02-13 22:03:02.868: E/AndroidRuntime(572): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-13 22:03:02.868: E/AndroidRuntime(572): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-13 22:03:02.868: E/AndroidRuntime(572): at dalvik.system.NativeStart.main(Native Method)
02-13 22:03:02.868: E/AndroidRuntime(572): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{sam.todo.OnTime/sam.todo.OnTime.Info}: java.lang.NullPointerException
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.startActivityNow(ActivityThread.java:1487)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:654)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.widget.TabHost.setCurrentTab(TabHost.java:326)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.widget.TabHost.addTab(TabHost.java:216)
02-13 22:03:02.868: E/AndroidRuntime(572): at sam.todo.OnTime.TabSwitch.onCreate(TabSwitch.java:30)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
02-13 22:03:02.868: E/AndroidRuntime(572): ... 11 more
02-13 22:03:02.868: E/AndroidRuntime(572): Caused by: java.lang.NullPointerException
02-13 22:03:02.868: E/AndroidRuntime(572): at sam.todo.OnTime.Info.onCreate(Info.java:34)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-13 22:03:02.868: E/AndroidRuntime(572): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
02-13 22:03:02.868: E/AndroidRuntime(572): ... 20 more
Does your Activity maintain its life cycle properly? Looks like not. If you leave, say, activity A in favor of activity B (so the stack of activities is A > B), then once activity A becomes invisible the OS may decide to kill it (there are hacks to prevent it, but those are hacks, so you better avoid them). So when you come back to the activity A from B, the OS will restore the activity A for you (however it's you who is responsible for proper activity state maintaining - the Activity API has special callbacks for that - persist/restore your tasks at those points). Here is the official tutorial on this: Managing the Activity Lifecycle.
Is the null pointer exception being thrown because the object t is null?! Looks that way. Make sure you're creating t somewhere.
If all these activities are under the same Application, I would recommend you simply extend the Application class with your own custom application class that stores this object that is persistent through out the application (unless it is interrupted and then closed, read Arhimed's comment below). This is a much more robust solution as it is resilient to activity life cycles.
Here is a link that should help with implementing this:
https://stackoverflow.com/a/708317/220710

Categories

Resources