java - Android Intent not starting activity -
i'm having issues getting startactivity(intent) open next activity. when press associated button it's printing string debug console, new activity isn't starting. doing wrong.
public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); button cambtn = (button) findviewbyid(r.id.btncamera); cambtn.setonclicklistener(new view.onclicklistener(){ @override public void onclick(view view){ startcameraoption(view); } }); } public void startcameraoption(view view){ intent intent = new intent(mainactivity.this, cameraoption.class); intent.putextra("launcher","launched."); system.out.println("starting next activity,"); startactivity(intent); } }
there's mainactivity.
here manifest.
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.sample.cloudvision"> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.read_external_storage"/> <uses-permission android:name="android.permission.camera"/> <uses-permission android:name="android.permission.write_external_storage" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:screenorientation="portrait" android:name="com.google.sample.cloudvision.mainactivity" android:label="@string/app_name" android:theme="@style/apptheme.noactionbar"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".cameraoption"> </activity> <activity android:name=".picturechosenclass"> </activity> </application> </manifest>
per comments need change cameraoptions extend appcompatactivity or activity instead of mainactivity
Comments
Post a Comment