i have preference activity and added PreferenceScreen to show alertdialog for about in the app
my prefs.xml
<PreferenceScreen android:title="@string/aboutmenu" android:key="about" android:summary="">
<intent
android:action="android.intent.action.DEFAULT"
android:targetPackage="com.prefs.learn"
android:targetClass="com.prefs.learn.About"
/>
</PreferenceScreen>
and here is my About.java class
package com.prefs.learn;
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
public class About extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pp();
}
public void pp(){
final AlertDialog d = new AlertDialog.Builder(this)
.setIcon(R.drawable.ic_launcher)
.setCancelable(false)
.setTitle("About")
.setPositiveButton(android.R.string.ok, null)
.setMessage("About stuff bla bla bla")
.create();
d.show();
}
}
and i have also added About in android manifest file
<activity android:name=".About" >
</activity>
now i want when user click About in the preferences it shows alertdialog and yes it does shows alertdialog but when i clock ok it shows blank activity as i know i extended it as "extends Activity"
but if i dont do like this alertdialog builder cant be used throw error anybody can help me
0 comments:
Post a Comment