Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid : Two Different button calling two different class not working properly
    primarykey
    data
    text
    <p>This is a very naive issue. I want to call two different class from two different buttons. The below code is working fine but the <strong>GalleryView.class</strong> is getting executed only for once.The moment i call the <strong>SelectImage.class</strong> which is a dialogue seems to be working fine but the other one showing up only once.Please throw some light on this.</p> <p>Thanks &amp; Regards Avijit Paul</p> <pre><code>private Button button,button1; public static String filename = "prefs"; SharedPreferences prefs; public vp_default() { // TODO Auto-generated constructor stub } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); prefs = getSharedPreferences(filename,0); button = (Button)findViewById(R.id.view_gallery_button); button.setOnClickListener(this); button1 = (Button)findViewById(R.id.sel_image_button); button1.setOnClickListener(this); } @Override public void onClick(View v) { String setPhnNo = "9231512345"; boolean stat = prefs.contains(setPhnNo); switch(v.getId()) { case R.id.view_gallery_button: if(stat!=false) { startActivity(new Intent(getApplicationContext(), VirtualPainterActivity.class)); } else { startActivity(new Intent(getApplicationContext(), GalleryView.class)); } break; case R.id.sel_image_button: startActivity(new Intent(getApplicationContext(), SelectImage.class)); break; } } </code></pre> <p>}</p> <p>//manifest.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mcc.vp.apps" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="15" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:label="@string/app_name" android:name=".vp_default" &gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:label="@string/app_name" android:name=".VirtualPainterActivity" android:theme="@android:style/Theme.Dialog"&gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.vp_regn" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:label="@string/app_name" android:name=".GalleryView"&gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.vp_gview" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:label="@string/app_name" android:name=".SelectImage" &gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:label="@string/app_name" android:name=".ViewImage"&gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.vp_view_img" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload